Commit ec947016 authored by Russ Cox's avatar Russ Cox
Browse files

cmd/compile: allow embed into any string or byte slice type

The current implementation requires saying "string" or "[]byte"
and disallows aliases, defined types, and even "[]uint8".
This was not 100% intended and mostly just fell out of when
the checks were being done in the implementation (too early,
before typechecking).

After discussion on #43217 (forked into #43602),
the consensus was to allow all string and byte slice types,
same as we do for string conversions in the language itself.
This CL does that.

It's more code than you'd expect because the decision has
to be delayed until after typechecking.

But it also more closely aligns with the version that's
already on dev.regabi.

Fixes #43602.

Change-Id: Iba919cfadfbd5d7116f2bf47e2512fb1d5c36731
Reviewed-on: https://go-review.googlesource.com/c/go/+/282715


Trust: Russ Cox <rsc@golang.org>
Reviewed-by: default avatarJay Conrod <jayconrod@google.com>
parent 54198b04
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment