Skip to content

Commit 5e5d2d2

Browse files
committed
Revert "compiler/natives/src/reflect: Return true in IsNil for implicitly converted nil interface."
This reverts commit 1fb1aaa. The change in that commit was not a complete and correct solution. Instead of resolving the underlying problem, it masked a symptom, allowing the TestCallConvert test to pass. A better fix will follow next.
1 parent 7729020 commit 5e5d2d2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/natives/src/reflect/reflect.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ func (v Value) Elem() Value {
924924
switch k := v.kind(); k {
925925
case Interface:
926926
val := v.object()
927-
if val == js.Global.Get("$ifaceNil") { // TODO: Do we need to check for val == js.InternalObject(0) here?
927+
if val == js.Global.Get("$ifaceNil") {
928928
return Value{}
929929
}
930930
typ := reflectType(val.Get("constructor"))
@@ -1108,7 +1108,7 @@ func (v Value) IsNil() bool {
11081108
case Map:
11091109
return v.object() == js.InternalObject(false)
11101110
case Interface:
1111-
return v.object() == js.Global.Get("$ifaceNil") || v.object() == js.InternalObject(0)
1111+
return v.object() == js.Global.Get("$ifaceNil")
11121112
default:
11131113
panic(&ValueError{"reflect.Value.IsNil", k})
11141114
}

0 commit comments

Comments
 (0)