Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1:/tmp/cvs-serv28676/F:/nice/src/bossa/syntax
Modified Files:
Pattern.java TypeIdent.java
Log Message:
improvemed the error message when trying to dispatch on a type parameter.
Index: Pattern.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v
retrieving revision 1.62
retrieving revision 1.63
diff -C2 -d -r1.62 -r1.63
*** Pattern.java 7 Jul 2003 18:27:09 -0000 1.62
--- Pattern.java 9 Jul 2003 23:03:20 -0000 1.63
***************
*** 117,121 ****
if (typeConstructor != null)
{
! tc = typeConstructor.resolveToTC(scope);
if (exactlyAt && !TypeConstructors.instantiable(tc))
User.error
--- 117,121 ----
if (typeConstructor != null)
{
! tc = typeConstructor.resolveToTCForPattern(scope);
if (exactlyAt && !TypeConstructors.instantiable(tc))
User.error
Index: TypeIdent.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/TypeIdent.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** TypeIdent.java 28 May 2003 12:57:26 -0000 1.23
--- TypeIdent.java 9 Jul 2003 23:03:20 -0000 1.24
***************
*** 114,117 ****
--- 114,127 ----
throw User.error(this, this + " is not a class");
}
+
+ public mlsub.typing.TypeConstructor resolveToTCForPattern(TypeMap scope)
+ {
+ TypeSymbol res = scope.lookup(name);
+
+ if (res instanceof TypeConstructor)
+ return (TypeConstructor) res;
+
+ throw User.error(this, this + " is not a declared class or interface");
+ }
public TypeSymbol resolvePreferablyToItf(TypeMap scope)
|