[svn] r7413: nemerle/trunk/ncc/typing/OverloadPossibility.n
nemerle/trunk/ncc/typing/Typer.n vs-plugin/tru...
IT
svnadmin at nemerle.org
Tue Feb 13 17:49:50 CET 2007
Log:
Location for overloaded methods.
Author: IT
Date: Tue Feb 13 17:49:45 2007
New Revision: 7413
Modified:
nemerle/trunk/ncc/typing/OverloadPossibility.n
nemerle/trunk/ncc/typing/Typer.n
vs-plugin/trunk/ConsoleTest/Program.cs
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/QuickTip2.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
Modified: nemerle/trunk/ncc/typing/OverloadPossibility.n
==============================================================================
--- nemerle/trunk/ncc/typing/OverloadPossibility.n (original)
+++ nemerle/trunk/ncc/typing/OverloadPossibility.n Tue Feb 13 17:49:45 2007
@@ -132,7 +132,7 @@
| OpCode (ch, unch) =>
TExpr.OpCode (if (local_context.IsChecked) ch else unch)
| _ =>
- TExpr.StaticRef (from, meth, method_typarms)
+ TExpr.StaticRef (this.Location, null, from, meth, method_typarms)
}
else
TExpr.MethodRef (expr, meth, method_typarms, notvirtual = expr is TExpr.This && !(meth.Attributes %&& NemerleAttributes.Virtual))
@@ -203,6 +203,12 @@
this.method_typarms = method_typarms;
}
+ public this (loc : Location, typer : Typer, ty : TyVar, expr : TExpr, from : MType.Class,
+ member : IMember, method_typarms : list [TyVar] = null)
+ {
+ this(typer, ty, expr, from, member, method_typarms);
+ this.loc = loc;
+ }
[Nemerle.OverrideObjectEquals]
public Equals (o : OverloadPossibility) : bool
Modified: nemerle/trunk/ncc/typing/Typer.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer.n (original)
+++ nemerle/trunk/ncc/typing/Typer.n Tue Feb 13 17:49:45 2007
@@ -2238,17 +2238,22 @@
}
}
-
public ConstructMethodOverload (m : IMethod, pt_from : PT.PExpr = null,
maybe_varargs = false) : list [OverloadPossibility]
{
+ ConstructMethodOverload (Location_stack.top(), m, pt_from, maybe_varargs)
+ }
+
+ ConstructMethodOverload (loc : Location, m : IMethod, pt_from : PT.PExpr = null,
+ maybe_varargs = false) : list [OverloadPossibility]
+ {
def bounds = m.GetHeader ().typarms.Map (fun (tv) { tv.LowerBound });
def make_overload () {
def from = ConstructEnclosingType (pt_from, m, bounds);
def (ty, vars) = from.TypeOfMethodWithTyparms (m);
- OverloadPossibility (this, ty, null, from, m,
+ OverloadPossibility (loc, this, ty, null, from, m,
method_typarms = vars)
}
@@ -2263,7 +2268,7 @@
}
- InterpretGlobal (pt_from : PT.PExpr, symbol : IMember) : list [OverloadPossibility]
+ InterpretGlobal (loc : Location, pt_from : PT.PExpr, symbol : IMember) : list [OverloadPossibility]
{
def single (mem) {
//Message.Debug ($"access of $mem");
@@ -2303,7 +2308,7 @@
TypeToConstructor (pt_from, mem :> TypeInfo)
| MemberKinds.Method | MemberKinds.Constructor =>
- ConstructMethodOverload (mem :> IMethod, pt_from, maybe_varargs = true)
+ ConstructMethodOverload (loc, mem :> IMethod, pt_from, maybe_varargs = true)
| MemberKinds.Property
| MemberKinds.Field =>
@@ -2323,7 +2328,8 @@
}
- InterpretGlobals (pt_from : PT.PExpr,
+ InterpretGlobals (loc : Location,
+ pt_from : PT.PExpr,
symbols : list [IMember],
expected : TyVar,
dump_errors : bool)
@@ -2333,7 +2339,7 @@
foreach (symbol in symbols) {
if (dump_errors) {
- foreach (op in InterpretGlobal (pt_from, symbol)) {
+ foreach (op in InterpretGlobal (loc, pt_from, symbol)) {
try {
solver.PushState ();
messenger.NeedMessage = true;
@@ -2346,12 +2352,12 @@
def not_ok =
try {
solver.PushState ();
- InterpretGlobal (pt_from, symbol).IsEmpty;
+ InterpretGlobal (loc, pt_from, symbol).IsEmpty;
} finally {
solver.PopState ();
}
unless (not_ok)
- foreach (op in InterpretGlobal (pt_from, symbol)) {
+ foreach (op in InterpretGlobal (loc, pt_from, symbol)) {
def ok =
try {
solver.PushState ();
@@ -2653,7 +2659,7 @@
[]
}
- def from_global = InterpretGlobals (pt_from, globals, expected, dump_errors = false);
+ def from_global = InterpretGlobals (expr.Location, pt_from, globals, expected, dump_errors = false);
//Message.Debug ($ "type name g: $globals $from_global");
match (from_this + from_global) {
@@ -2669,7 +2675,7 @@
$ "none of the meanings of "
"`$expr' meets the type "
"$expected:");
- _ = InterpretGlobals (pt_from, globals, expected, dump_errors = true);
+ _ = InterpretGlobals (expr.Location, pt_from, globals, expected, dump_errors = true);
}
[]
| overloads => overloads
Modified: vs-plugin/trunk/ConsoleTest/Program.cs
==============================================================================
--- vs-plugin/trunk/ConsoleTest/Program.cs (original)
+++ vs-plugin/trunk/ConsoleTest/Program.cs Tue Feb 13 17:49:45 2007
@@ -12,6 +12,7 @@
Test1 test = new Test1();
test.Init();
+ test.QuickTip002();
test.QuickTip001();
test.Complete_in_return_type_1();
test.Complete_in_return_type_2();
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/QuickTip2.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/QuickTip2.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/QuickTip2.n Tue Feb 13 17:49:45 2007
@@ -4,6 +4,11 @@
{
public class Class1
{
+ WriteLineTest() : void
+ {
+ WriteLine/*002:-1*/("");
+ }
+
Foo() : void
{
def bar()
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n Tue Feb 13 17:49:45 2007
@@ -16,6 +16,17 @@
public partial class Test1
{
[Test]
+ public QuickTip002() : void
+ {
+ def file = FileQuickTip2;
+ def (line, col) = ReadLocation(file, "002");
+ def result = _project.GetQuickTipInfo(file, line, col);
+
+ Assert.IsNotNull(result, "result is null");
+ Assert.IsTrue (result.Text.Split('\n')[0].IndexOf("WriteLine") > 0);
+ }
+
+ [Test]
public QuickTip001() : void
{
def file = FileQuickTip2;
More information about the svn
mailing list