[svn] r7388: nemerle/trunk: Tests.nproj
ncc/testsuite/negative/cyclic.n ncc/typing/TyVarEnv.n
VladD2
svnadmin at nemerle.org
Tue Feb 6 06:42:29 CET 2007
Log:
Add tests. Some fixes.
Author: VladD2
Date: Tue Feb 6 06:42:26 2007
New Revision: 7388
Modified:
nemerle/trunk/Tests.nproj
nemerle/trunk/ncc/testsuite/negative/cyclic.n
nemerle/trunk/ncc/typing/TyVarEnv.n
Modified: nemerle/trunk/Tests.nproj
==============================================================================
--- nemerle/trunk/Tests.nproj (original)
+++ nemerle/trunk/Tests.nproj Tue Feb 6 06:42:26 2007
@@ -33,8 +33,13 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>ncc\testsuite\</OutputPath>
+ <StartProgram>
+ </StartProgram>
+ <WorkingDirectory>K:\MyProjects\Nemerle\nemerle\ncc\testsuite</WorkingDirectory>
+ <CmdArgs>-d:negative -p "-nowarn:10003 -def:RUNTIME_MS" -s > negative.results</CmdArgs>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
Modified: nemerle/trunk/ncc/testsuite/negative/cyclic.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/negative/cyclic.n (original)
+++ nemerle/trunk/ncc/testsuite/negative/cyclic.n Tue Feb 6 06:42:26 2007
@@ -1,10 +1,20 @@
class Bug854
{
- public Foo[T](x : T) : void where T : T { // E: cyclic constraint on type variable T
+ public Foo[T](x : T) : void where T : T { // E: A constraint of 'T' type parameter is cyclic \(T => T\)
_ = x.Foo()
}
}
+public class X[A, // E: A constraint of 'A' type parameter is cyclic \(A => B => C => A\)
+ B, // E: A constraint of 'B' type parameter is cyclic \(B => C => A => B\)
+ C, D, E] // E: A constraint of 'C' type parameter is cyclic \(C => A => B => C\)
+
+ where A: B
+ where B: C
+ where C: A
+ where D: E
+{
+}
class A : B {} // E: type definition for `A' is cyclic
class B : A {}
Modified: nemerle/trunk/ncc/typing/TyVarEnv.n
==============================================================================
--- nemerle/trunk/ncc/typing/TyVarEnv.n (original)
+++ nemerle/trunk/ncc/typing/TyVarEnv.n Tue Feb 6 06:42:26 2007
@@ -436,8 +436,7 @@
}
}
- mutable isConstraintsCyclic = false;
-
+ mutable cyclicConstraints = [];
def tryDetectCyclicConstraints ()
{
@@ -479,9 +478,9 @@
def path = scan (tyRef);
unless (path.IsEmpty)
{ // We have cycle! Extract information about it...
- isConstraintsCyclic = true;
def info = path.ToString(" => ");
def tyParam = path.Head;
+ cyclicConstraints ::= tyRef;
Message.Error ( // try find location of type parametr
match (tp.tyvars.Find(x => x.ToString() == tyParam)) {
| Some(name) => name.Location
@@ -498,11 +497,19 @@
unless (tyParams.IsEmpty)
tryDetectCyclicConstraints ();
- unless (isConstraintsCyclic)
+ if (cyclicConstraints.IsEmpty)
foreach (tv : StaticTyVar in tyParams)
// FIXME: check Intersection invariants and flag error
// to the user, otherwise we'll get an ICE
tv.SetConstraints (get (tv.id));
+ else
+ foreach (tv : StaticTyVar in tyParams)
+ {
+ if (cyclicConstraints.Contains (tv)) // skip cyclic constraints.
+ tv.SetConstraints (GenericParameterAttributes.None, []);
+ else
+ tv.SetConstraints (get (tv.id));
+ }
(tenv, tyParams)
}
More information about the svn
mailing list