[svn] r7086: nemerle/trunk/ncc: testsuite/negative/assign-tyclash.n
typing/Typer.n
malekith
svnadmin at nemerle.org
Wed Dec 13 13:16:56 CET 2006
Log:
Don't allow subtyping in mutable definition when explicit cast is used. Resolves #809.
Author: malekith
Date: Wed Dec 13 13:16:55 2006
New Revision: 7086
Modified:
nemerle/trunk/ncc/testsuite/negative/assign-tyclash.n
nemerle/trunk/ncc/typing/Typer.n
Modified: nemerle/trunk/ncc/testsuite/negative/assign-tyclash.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/negative/assign-tyclash.n (original)
+++ nemerle/trunk/ncc/testsuite/negative/assign-tyclash.n Wed Dec 13 13:16:55 2006
@@ -17,3 +17,12 @@
q(C());
}
}
+
+// bug #809
+class A { }
+class B : A { }
+
+mutable x = B ();
+x = A (); // OK
+mutable b : B = B();
+b = A (); // E: expected B, got A in assigned value
Modified: nemerle/trunk/ncc/typing/Typer.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer.n (original)
+++ nemerle/trunk/ncc/typing/Typer.n Wed Dec 13 13:16:55 2006
@@ -1750,7 +1750,7 @@
def tv = FreshTyVar ();
def val = TypeExpr (val, tv);
def (val, decl_ty) =
- if (is_mutable) {
+ if (is_mutable && !(val is TExpr.TypeConversion)) {
def tv' = FreshTyVar ();
tv'.ForceProvide (tv);
(ImplicitCast (val, tv'), tv')
More information about the svn
mailing list