mirror of
https://github.com/golang/go
synced 2024-11-12 02:20:23 -07:00
disallow ordinary-type.(T), as in spec.
R=ken OCL=25705 CL=25705
This commit is contained in:
parent
461dd9126c
commit
955638e2fb
@ -2851,6 +2851,9 @@ ifaceas1(Type *dst, Type *src, int explicit)
|
||||
if(src == T || dst == T)
|
||||
return Inone;
|
||||
|
||||
if(explicit && !isinter(src))
|
||||
yyerror("cannot use .(T) on non-interface type %T", src);
|
||||
|
||||
if(isinter(dst)) {
|
||||
if(isinter(src)) {
|
||||
if(eqtype(dst, src, 0))
|
||||
|
@ -107,7 +107,8 @@ func newBasicType(name string, kind int, size int) Type {
|
||||
// Prebuilt basic types
|
||||
var (
|
||||
Missing = newBasicType(missingString, MissingKind, 1);
|
||||
DotDotDot = newBasicType(dotDotDotString, DotDotDotKind, unsafe.Sizeof(true.(interface{})));
|
||||
empty interface{};
|
||||
DotDotDot = newBasicType(dotDotDotString, DotDotDotKind, unsafe.Sizeof(empty));
|
||||
Bool = newBasicType("bool", BoolKind, unsafe.Sizeof(true));
|
||||
Int = newBasicType("int", IntKind, unsafe.Sizeof(int(0)));
|
||||
Int8 = newBasicType("int8", Int8Kind, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user