You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With revision 33d3e7bbd3ef, on Linux 64-bit compile the program from
http://play.golang.org/p/vcOARDUEC3 as "typecheck"
Then run:
$ go list std | grep -v cmd | xargs -n 1 ./typecheck
The output is:
failed type check: /home/kamil/go/src/pkg/compress/lzw/reader.go:90:17: invalid
operation: mismatched types uint32 and int
failed type check: /home/kamil/go/src/pkg/debug/dwarf/buf.go:116:5: invalid operation:
mismatched types int64 and int
failed type check: /home/kamil/go/src/pkg/encoding/asn1/asn1.go:160:3: invalid
operation: mismatched types byte and int
failed type check: /home/kamil/go/src/pkg/exp/ssa/interp/interp.go:202:57: invalid
operation: instr (variable of type exp/ssa.Instruction) has no single field or method Pos
failed type check: /home/kamil/go/src/pkg/math/big/rat.go:140:15: invalid operation:
mismatched types uint64 and int
failed type check: /home/kamil/go/src/pkg/net/lookup_unix.go:56:20: undeclared name:
cgoLookupHost
failed type check: /home/kamil/go/src/pkg/os/types.go:64:6: invalid operation:
mismatched types FileMode and int
failed type check: /home/kamil/go/src/pkg/os/user/lookup.go:9:9: undeclared name: current
failed type check: /home/kamil/go/src/pkg/runtime/softfloat64.go:234:11: invalid
operation: mismatched types uint64 and int
failed type check: /home/kamil/go/src/pkg/strconv/atof.go:326:5: invalid operation:
cannot compare mant (variable of type uint64) == 2 << flt.mantbits (value of type
int)
failed type check: /home/kamil/go/src/pkg/text/scanner/scanner.go:540:6: invalid
operation: mismatched types uint64 and int
The errors regarding "mistmatched types T and int" refer to lines that look
like (example from the last line of output):
for s.Whitespace&(1<<uint(ch)) != 0 {
so it seems like the types package has trouble determining the correct type for the
shift expression.
The text was updated successfully, but these errors were encountered:
Sorry if you already knew about it, I couldn't find the issue that mentioned it (4538)
and I didn't realize there were also test cases in exp/gotype, I checked through the
ones in go/types.
I don't really understand the aversion against bugs being filed for this package. Since
it's pending inclusion in 1.1 isn't it better to track any issues that may come up,
despite it being in development?
No worries. This particularly issue is just one that happens to be in the works right
now. Since there's still much in flux here, issues filed against it only cause more work
in this specific case. Note also that whether go/types stays in 1.1 is not yet decided -
there's an open issue) since putting it in 1.1 freezes the API and we may want to gain
more experience with it.
This was fixed, likely by revision f10ff2e7c9bd (CL 7381052).
The suggested command above doesn't report any shift errors anymore, and after changing
the import in the "typecheck" command to:
ctxt := build.Default
ctxt.CgoEnabled = false
pkg, err := ctxt.Import(pkgName, ".", 0)
it also doesn't report undeclared names.
The text was updated successfully, but these errors were encountered: