mirror of
https://github.com/golang/go
synced 2024-11-05 18:36:08 +00:00
gc: skip undefined symbols in import .
Fixes #1284. R=ken3, rsc CC=golang-dev https://golang.org/cl/3210041
This commit is contained in:
parent
b15c4245c5
commit
cab83650d1
4 changed files with 43 additions and 0 deletions
|
@ -363,6 +363,8 @@ importdot(Pkg *opkg, Node *pack)
|
|||
for(s = hash[h]; s != S; s = s->link) {
|
||||
if(s->pkg != opkg)
|
||||
continue;
|
||||
if(s->def == N)
|
||||
continue;
|
||||
if(!exportname(s->name) || utfrune(s->name, 0xb7)) // 0xb7 = center dot
|
||||
continue;
|
||||
s1 = lookup(s->name);
|
||||
|
|
11
test/fixedbugs/bug313.dir/a.go
Normal file
11
test/fixedbugs/bug313.dir/a.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
// Copyright 2010 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.
|
||||
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func a() {
|
||||
fmt.DoesNotExist() // ERROR "undefined"
|
||||
}
|
11
test/fixedbugs/bug313.dir/b.go
Normal file
11
test/fixedbugs/bug313.dir/b.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
// Copyright 2010 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.
|
||||
|
||||
package main
|
||||
|
||||
import . "fmt"
|
||||
|
||||
func b() {
|
||||
Println()
|
||||
}
|
19
test/fixedbugs/bug313.go
Normal file
19
test/fixedbugs/bug313.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
// errchk $G -e $D/$F.dir/[ab].go
|
||||
|
||||
// Copyright 2010 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 1284
|
||||
|
||||
package bug313
|
||||
|
||||
/*
|
||||
6g bug313.dir/[ab].go
|
||||
|
||||
Before:
|
||||
bug313.dir/b.go:7: internal compiler error: fault
|
||||
|
||||
Now:
|
||||
bug313.dir/a.go:10: undefined: fmt.DoesNotExist
|
||||
*/
|
Loading…
Reference in a new issue