[svn] r7708: nemerle/trunk/ncc: generation/Typer4.n
hierarchy/ClassMembers.n testsuite/negative/void-parm3...
divan
svnadmin at nemerle.org
Sun Jun 17 21:44:06 CEST 2007
Log:
Add check for void generic specifier of static method.
Author: divan
Date: Sun Jun 17 21:44:04 2007
New Revision: 7708
Modified:
nemerle/trunk/ncc/generation/Typer4.n
nemerle/trunk/ncc/hierarchy/ClassMembers.n
nemerle/trunk/ncc/testsuite/negative/void-parm3.n
nemerle/trunk/ncc/testsuite/positive/valuetype-conv.n
Modified: nemerle/trunk/ncc/generation/Typer4.n
==============================================================================
--- nemerle/trunk/ncc/generation/Typer4.n (original)
+++ nemerle/trunk/ncc/generation/Typer4.n Sun Jun 17 21:44:04 2007
@@ -706,6 +706,7 @@
Util.cassert (Message.SeenError);
null
+ | StaticRef (_expr, meth, tp)
| MethodRef (_expr, meth, tp, _) =>
foreach (t in tp)
when (t.Fix ().Equals (InternalType.Void))
Modified: nemerle/trunk/ncc/hierarchy/ClassMembers.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/ClassMembers.n (original)
+++ nemerle/trunk/ncc/hierarchy/ClassMembers.n Sun Jun 17 21:44:04 2007
@@ -907,25 +907,27 @@
public ClearBeforeBodyTypingHandlers() : void { BeforeBodyTyping = null; }
+ #region CompletionSpecific
//***********************************************************************
// This members available only under completion engine.
- static ThrowNotSupported[T] () : T
- { throw System.NotSupportedException ("available on in code-completion use-case") }
+ static NotSupported () : System.Exception
+ { System.NotSupportedException ("available on in code-completion use-case") }
- public virtual EnsureCompiled() : void { ThrowNotSupported () }
- public virtual BodyMessages : SCG.List[CompilerMessage] { get { ThrowNotSupported () } }
+ public virtual EnsureCompiled() : void { throw NotSupported () }
+ public virtual BodyMessages : SCG.List[CompilerMessage] { get { throw NotSupported () } }
public virtual BodyTokens : Token.BracesGroup
{
- get { ThrowNotSupported() }
+ get { throw NotSupported() }
set { throw System.NotSupportedException ("available on in code-completion use-case " + value.ToString ()) }
}
- public virtual BodyParsed : PT.PExpr { get { ThrowNotSupported () } }
- public virtual IsBodyCompilable : bool { get { ThrowNotSupported () } }
- public virtual BodyTyped : TExpr { get { ThrowNotSupported () } }
+ public virtual BodyParsed : PT.PExpr { get { throw NotSupported () } }
+ public virtual IsBodyCompilable : bool { get { throw NotSupported () } }
+ public virtual BodyTyped : TExpr { get { throw NotSupported () } }
// End: This members available only under completion engine.
//***********************************************************************
+ #endregion
public Body : PT.PExpr {
get {
Modified: nemerle/trunk/ncc/testsuite/negative/void-parm3.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/negative/void-parm3.n (original)
+++ nemerle/trunk/ncc/testsuite/negative/void-parm3.n Sun Jun 17 21:44:04 2007
@@ -7,4 +7,21 @@
_ = G (f (0)); //E: cannot use `void' in generic specifier
}
}
+class B {
+ public static F[A, B] (_ : A -> B) : void {}
+ public static G[A] (_ : A) : void {}
+ public static Q () : void {
+ def f (_) {};
+ _ = F (f); //E: cannot use `void' in generic specifier
+ _ = G (f (0)); //E: cannot use `void' in generic specifier
+ }
+}
+public module FuncHelper2 {
+ public static Pipe[A, B, C] (_fab : A -> B, _fbc : B -> C) : void {
+ def d2i ( x : int ) : int { x + 1 }
+ def print ( x : int ) : void { System.Console.WriteLine (x) }
+ //without void check it generates unverifiable/bad code
+ Pipe (d2i, print); //E: cannot use `void' in generic specifier
+ }
+}
()
Modified: nemerle/trunk/ncc/testsuite/positive/valuetype-conv.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/positive/valuetype-conv.n (original)
+++ nemerle/trunk/ncc/testsuite/positive/valuetype-conv.n Sun Jun 17 21:44:04 2007
@@ -35,7 +35,6 @@
}
- f ( () );
f (g ());
// bug 503
@@ -66,7 +65,6 @@
3
1
2.3
-f [System.Object] called
g called
f [System.Object] called
"foo"
More information about the svn
mailing list