summaryrefslogtreecommitdiff
path: root/usr/austin/eval/decls.go
diff options
context:
space:
mode:
authorAustin Clements <aclements@csail.mit.edu>2009-07-31 17:11:34 -0700
committerAustin Clements <aclements@csail.mit.edu>2009-07-31 17:11:34 -0700
commit3c50080d6eb9eba73c6b47e2e38fe0a333117dba (patch)
tree77fe5599532ead3106e29971d454d5cb38e4906a /usr/austin/eval/decls.go
parent9b500244455523d0531ded5badeb7697a430afca (diff)
downloadgolang-3c50080d6eb9eba73c6b47e2e38fe0a333117dba.tar.gz
Implement type compatibility and fix places where I thought
types were supposed to be identical but only needed to be compatible. This gets rid of the Type.literal method. I renamed the Type.rep method to Type.lit because I believe it corresponds to the term "literal" as used in the spec. R=rsc APPROVED=rsc DELTA=228 (57 added, 35 deleted, 136 changed) OCL=32606 CL=32608
Diffstat (limited to 'usr/austin/eval/decls.go')
-rw-r--r--usr/austin/eval/decls.go20
1 files changed, 11 insertions, 9 deletions
diff --git a/usr/austin/eval/decls.go b/usr/austin/eval/decls.go
index 1ab5c97a7..3b1ed70ae 100644
--- a/usr/austin/eval/decls.go
+++ b/usr/austin/eval/decls.go
@@ -16,15 +16,17 @@ import (
type Value interface
type Type interface {
- // literal returns this type with all names recursively
- // stripped. This should only be used when determining
- // assignment compatibility. To strip a named type for use in
- // a type switch, use .rep().
- literal() Type;
- // rep returns the representative type. If this is a named
- // type, this is the unnamed underlying type. Otherwise, this
- // is an identity operation.
- rep() Type;
+ // compat returns whether this type is compatible with another
+ // type. If conv is false, this is normal compatibility,
+ // where two named types are compatible only if they are the
+ // same named type. If conv if true, this is conversion
+ // compatibility, where two named types are conversion
+ // compatible if their definitions are conversion compatible.
+ compat(o Type, conv bool) bool;
+ // lit returns this type's literal. If this is a named type,
+ // this is the unnamed underlying type. Otherwise, this is an
+ // identity operation.
+ lit() Type;
// isBoolean returns true if this is a boolean type.
isBoolean() bool;
// isInteger returns true if this is an integer type.