-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
FrozenDueToAgeLanguageChangeSuggested changes to the Go languageSuggested changes to the Go languagev2An incompatible library changeAn incompatible library change
Milestone
Description
Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem. Thanks.
What steps will reproduce the problem?
Try to compile attached file. It will fail with:
main.go:13: v.IsNil undefined (type reflect.Value has no field IsNil)
What is the expected output? What do you see instead?
It would be nice if it is compilable. The core of example is the switch:
var a reflect.Value
switch v := a.(type) {
case *reflect.InterfaceValue,
*reflect.PtrValue:
if v.IsNil() {
fmt.Printf("null")
}
}
Both reflect.InterfaceValue and reflect.PtrValue has IsNil method but if
compiler sees the multiple type case, it suppose that v is just
reflect.Value and could not find IsNil method.
What is your $GOOS? $GOARCH?
linux, amd64
Which revision are you using? (hg identify)
affe0f093696+ tip
Please provide any additional information below.
This issue was discussed during review of
http://golang.org/cl/179125 with Russ Cox.
Attachments:
- main.go (203 bytes)
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeLanguageChangeSuggested changes to the Go languageSuggested changes to the Go languagev2An incompatible library changeAn incompatible library change