You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two go file in a package, one with a type definitial and an alias declaration
package compilererror
typeAstruct {
cC
}
typeO=A
and a second file with a used type and a using type
package compilererror
typeDummyinterface {
// Dummy(A)
}
typeBinterface {
// cannot use O here, because compiler crashes// F0(*A)F1() (*O, error)
F2() (*O, error)
}
typeCinterface {
F3(*O) error
}
What did you expect to see?
Compiling this package succeeds.
What did you see instead?
Compiling this package results in a compiler error:
compilererror/c.go:21:6: internal compiler error: cannot handle alias type declaration (issue #25838): %!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference)
Please file a bug report including a short program that triggers the error.
https://golang.org/issue/new
With go release 1.16 a similar error is reported but with a working error message (not the nil pointer exception) complaining about the type alias.
Possibilities to circumvent this problem.
There are several strange ways to avoid this compile error:
add a dummy interface (as shown in b.go) USING the original type instead of the alias (just uncomment this line)
replace the FIRST occurrence of the alias type (O) in a file by the original type (A) (or just uncomment F0)
rename the file c.go to be alphabetically before b.c (or just e.g. a.go)
put all the stuff in one file
The text was updated successfully, but these errors were encountered:
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?
I have two go file in a package, one with a type definitial and an alias declaration
and a second file with a used type and a using type
What did you expect to see?
Compiling this package succeeds.
What did you see instead?
Compiling this package results in a compiler error:
With go release 1.16 a similar error is reported but with a working error message (not the nil pointer exception) complaining about the type alias.
Possibilities to circumvent this problem.
There are several strange ways to avoid this compile error:
O
) in a file by the original type (A) (or just uncommentF0
)c.go
to be alphabetically beforeb.c
(or just e.g.a.go
)The text was updated successfully, but these errors were encountered: