mirror of
https://github.com/golang/go
synced 2024-11-26 18:06:55 -07:00
cmd/gc: fix spurious 'use of untyped nil' error
Fixes #6402 LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/81340044
This commit is contained in:
parent
6119dc1b52
commit
21b2e16842
@ -1144,7 +1144,10 @@ defaultlit(Node **np, Type *t)
|
||||
}
|
||||
if(n->val.ctype == CTNIL) {
|
||||
lineno = lno;
|
||||
yyerror("use of untyped nil");
|
||||
if(!n->diag) {
|
||||
yyerror("use of untyped nil");
|
||||
n->diag = 1;
|
||||
}
|
||||
n->type = T;
|
||||
break;
|
||||
}
|
||||
|
13
test/fixedbugs/issue6402.go
Normal file
13
test/fixedbugs/issue6402.go
Normal file
@ -0,0 +1,13 @@
|
||||
// errorcheck
|
||||
|
||||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Issue 6402: spurious 'use of untyped nil' error
|
||||
|
||||
package p
|
||||
|
||||
func f() uintptr {
|
||||
return nil // ERROR "cannot use nil as type uintptr in return argument"
|
||||
}
|
Loading…
Reference in New Issue
Block a user