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
// cannot use O here, because compiler crashes// F0(*A)F1() (*O, error)
F2() (*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.
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: