language semantics: Go doesn't enforce private types when using type deduction with :=
operator
#59823
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
v2
An incompatible library change
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Playground examples:
var v lib.myType = lib.Foo()
- https://go.dev/play/p/YG1mv5bZCp2v := lib.Foo()
- https://go.dev/play/p/_XOR5LCDKUcWhat did you expect to see?
Using private types should have failed with type deduction the same ways it does for explicit declarations of the same type.
What did you see instead?
Private types are enforced only with explicit declarations but are not enforced for deducted variable types.
The text was updated successfully, but these errors were encountered: