]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/go/types/conversions.go
[dev.typeparams] merge dev.regabi (618e3c1) into dev.typeparams
[gostls13.git] / src / go / types / conversions.go
index 0756b575ae4039a91f72bfff35075f9f78a6184d..69463f0ca60e1b33b3c253c96e0ac4be384d146d 100644 (file)
@@ -55,8 +55,8 @@ func (check *Checker) conversion(x *operand, T Type) {
                // - Keep untyped nil for untyped nil arguments.
                // - For integer to string conversions, keep the argument type.
                //   (See also the TODO below.)
-               if IsInterface(T) || constArg && !isConstType(T) {
-                       final = Default(x.typ)
+               if IsInterface(T) || constArg && !isConstType(T) || x.isNil() {
+                       final = Default(x.typ) // default type of untyped nil is untyped nil
                } else if isInteger(x.typ) && isString(T) {
                        final = x.typ
                }