[svn] r7458: nemerle/trunk/ncc/typing/Typer.n
nikov
svnadmin at nemerle.org
Wed Feb 21 20:53:13 CET 2007
Log:
Fix bug 937.
Author: nikov
Date: Wed Feb 21 20:53:12 2007
New Revision: 7458
Modified:
nemerle/trunk/ncc/typing/Typer.n
Modified: nemerle/trunk/ncc/typing/Typer.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer.n (original)
+++ nemerle/trunk/ncc/typing/Typer.n Wed Feb 21 20:53:12 2007
@@ -766,14 +766,32 @@
}
+ /** Heuristics to decide how we treat rhs of 'is' operator: type or pattern
+ */
static CanBeTypeName (expr : PT.PExpr) : bool
{
match (expr) {
- | PT.PExpr.Ref => true
+ | PT.PExpr.Ref
+ | <[ void -> void ]> => true
+
| <[ $expr . $_ ]>
| <[ $expr . [ .. $_ ] ]>
- | <[ $expr [ .. $_ ] ]> =>
+ | <[ $expr [ .. $_ ] ]>
+ | <[ void -> $expr ]>
+ | <[ $expr -> void ]> =>
CanBeTypeName (expr)
+
+ | <[ $expr1 -> $expr2 ]> =>
+ CanBeTypeName (expr1) && CanBeTypeName (expr2)
+
+ | <[ @* (.. $exprs) ]> =>
+ if (exprs.Exists ( _ is <[ void ]> )) {
+ Message.Error (expr.Location, $"$expr is not a valid type. Tuple cannot have void elements.");
+ true
+ }
+ else
+ exprs.ForAll (CanBeTypeName)
+
| _ => false
}
}
More information about the svn
mailing list