Skip to content
This repository has been archived by the owner on May 9, 2021. It is now read-only.

Commit

Permalink
Hang on to the type information even when the typechecker fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsymonds committed Sep 9, 2014
1 parent 3f17141 commit ff22a87
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,8 @@ func (p *pkg) typeCheck() error {
astFiles = append(astFiles, f.f)
}
pkg, err := config.Check(anyFile.f.Name.Name, p.fset, astFiles, info)
if err != nil {
return err
}
// Remember the typechecking info, even if config.Check failed,
// since we will get partial information.
p.typesPkg = pkg
p.typesInfo = info
return err
Expand Down
4 changes: 3 additions & 1 deletion testdata/var-decl.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
package foo

import "fmt"
import "net/http"

// Q is a test type.
type Q bool

var myInt int = 7 // MATCH /should.*int.*myInt.*inferred/
var myInt int = 7 // MATCH /should.*int.*myInt.*inferred/
var mux *http.ServeMux = http.NewServeMux() // MATCH /should.*\*http\.ServeMux.*inferred/

var myZeroInt int = 0 // MATCH /should.*= 0.*myZeroInt.*zero value/
var myZeroFlt float32 = 0. // MATCH /should.*= 0\..*myZeroFlt.*zero value/
Expand Down

0 comments on commit ff22a87

Please sign in to comment.