[Nice-commit] Nice/src/bossa/syntax typecheck.nice,1.58,1.59 analyse.nice,1.59,1.60
Brought to you by:
bonniot
|
From: <bo...@us...> - 2003-04-28 15:49:33
|
Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1:/tmp/cvs-serv20549/src/bossa/syntax
Modified Files:
typecheck.nice analyse.nice
Log Message:
Restricted variables for which type is inferred to have a monomorphic type.
This avoids the polymorphic reference problem, in a restrictive manner.
Index: typecheck.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v
retrieving revision 1.58
retrieving revision 1.59
diff -C2 -d -r1.58 -r1.59
*** typecheck.nice 24 Apr 2003 12:29:42 -0000 1.58
--- typecheck.nice 28 Apr 2003 15:49:23 -0000 1.59
***************
*** 561,565 ****
{
typecheck(decl.value);
! notNull(decl.left).type = notNull(decl.value).getType();
}
--- 561,580 ----
{
typecheck(decl.value);
! mlsub.typing.Polytype type = notNull(decl.value).getType();
! notNull(decl.left).type = type;
!
! // Check that the type is not polymorphic, as this could be unsafe.
! if (type.isMonomorphic())
! return;
!
! type.simplify();
! if (type.isMonomorphic())
! return;
!
! throw new bossa.util.UserError
! (decl,
! "The value has a polymorphic type: " + type +
! "\nOmitting the type here is not supported by Nice yet." +
! "\nPlease declare the monomorphic type of " + decl.getName());
}
Index: analyse.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -d -r1.59 -r1.60
*** analyse.nice 24 Apr 2003 12:32:17 -0000 1.59
--- analyse.nice 28 Apr 2003 15:49:27 -0000 1.60
***************
*** 33,37 ****
buildInfo(varScope, typeScope)
{
! final t = new SymbolTable();
return new Info(vars: new SymbolTable(), typeVars: t,
outerVarScope: varScope, outerTypeScope: typeScope,
--- 33,37 ----
buildInfo(varScope, typeScope)
{
! final SymbolTable<TypeSymbol> t = new SymbolTable();
return new Info(vars: new SymbolTable(), typeVars: t,
outerVarScope: varScope, outerTypeScope: typeScope,
|