-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: internal compiler error compiling a rune literal #29350
Comments
Interestingly, if you add |
Congrats, you found a compiler bug! From the error message looks like there’s a missing dowidth call. This should bisect nicely if anyone is up for it. Since it exists in 1.11 this isn’t a release blocker for 1.12, although I’m tentatively marking for 1.12 milestone because I suspect the fix will be simple, localized, and safe. |
Some more oddities - This compiles with 1.10.3, but not with 1.11.2 or 1.12beta1 package main
import "fmt"
var ITETests = []struct {
ifTrue interface{}
ifFalse interface{}
}{
{
ifTrue: '⊨', // char appears in file as 0xe2 0x8a 0xa8
ifFalse: '⊭'}, // char appears in file as 0xe2 0x8a 0xad
}
func TestITE() {
for _, res := range ITETests {
fmt.Printf("expected %q\n", res.ifFalse)
}
} But, this does not with 1.10.3, 1.11.2 and 1.12beta1 - package main
var ITETests = []struct {
ifTrue interface{}
ifFalse interface{}
}{
{
ifTrue: '⊨', // char appears in file as 0xe2 0x8a 0xa8
ifFalse: '⊭'}, // char appears in file as 0xe2 0x8a 0xad
}
|
Minimal repro:
Seems to be due to the implicit conversion. Changing |
Change https://golang.org/cl/155380 mentions this issue: |
What version of Go are you using (
go version
)?Both of these:
(and play.golang.org)
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 a silly little test for a silly little function I use, and it has a var pre-initialized with some literals, and one day I decided to copy this test to another package, and suddenly it would not compile.
Here it is alone in its own program, also failing to compile.
And here's a playground with it: https://play.golang.org/p/ksGkIh7cVod
What did you expect to see?
This is copied from the one _test.go file where I first wrote it and where it compiles and runs just fine. The relevant bytes in this test's source file are identical, and there is no BOM on either file. I can't see anything relevant that's different between the files where it works and where it fails, other than the fact that the one where it works is larger and has other vars and functions.
What did you see instead?
This may be a "new" bug as it does compile and run fine with 1.10:
The text was updated successfully, but these errors were encountered: