[nem-en] When macro emits typed expr
Alexey Borzenkov
snaury at gmail.com
Mon Aug 14 10:57:44 CEST 2006
Hi everyone,
For a long time I had this problem with foreach (when enumerated
expression is some complex macro, for example), now I was able to
shorten it into a simple test case. As you can see below, when typed
expr is part of some more complex pexpr and when typed expr has some
variable definitions in some inner block (which, it seems, must also
be part of some complex expression), the compiler complains that these
variables are not registered. I'm not sure why this happens though,
does anyone have any ideas? Maybe when typing PExpr.Typed it should
somehow re-register variable definitions inside them?...
// macro.n
// APPTYPE: dll
// REFERENCE: Nemerle.Compiler
using Nemerle;
using Nemerle.Compiler;
macro mymacro(expr)
{
def typer = Nemerle.Macros.ImplicitCTX();
def texpr = typer.TypeExpr(expr);
<[ $(texpr : typed).GetType() ]>
}
// program.n
// DEPEND: macro.n
mymacro({ def n = object(); n } : object);
ncc.exe -no-color -t:library -r:Nemerle.Compiler -out:macro.dll macro.n
ncc.exe -no-color -r:macro.dll -out:program.exe program.n
program.n:4:29:4:30: warning: unregistered local a local value n, 1172
error: internal compiler error: assertion failed in file
typing/Typer2.n, line 753
at Nemerle.Compiler.Typer2.DoWalk(Context ctx, TExpr expr)
at Nemerle.Compiler.Typer2.Walk(Context ctx, TExpr expr)
at Nemerle.Compiler.Typer2.DoWalk(Context ctx, TExpr expr)
at Nemerle.Compiler.Typer2.Walk(Context ctx, TExpr expr)
at Nemerle.Compiler.Typer2.DoWalk(Context ctx, TExpr expr)
at Nemerle.Compiler.Typer2.Walk(Context ctx, TExpr expr)
at Nemerle.Compiler.Typer2.DoWalk(Context ctx, TExpr expr)
at Nemerle.Compiler.Typer2.Walk(Context ctx, TExpr expr)
at Nemerle.Compiler.Typer2.DoWalk(Context ctx, TExpr expr)
at Nemerle.Compiler.Typer2.Walk(Context ctx, TExpr expr)
at Nemerle.Compiler.Typer2.DoWalk(Context ctx, TExpr expr)
at Nemerle.Compiler.Typer2.Walk(Context ctx, TExpr expr)
at Nemerle.Compiler.Typer2.Run()
at Nemerle.Compiler.Typer..ctor(MethodBuilder m)
at Nemerle.Compiler.MethodBuilder.RunBodyTyper()
at Nemerle.Compiler.MethodBuilder.Compile()
at Nemerle.Compiler.TypeBuilder.EmitImplementation()
at Nemerle.Compiler.TypesManager._N_emit_impl_25083.apply_void(TypeBuilder
_N_25082)
at Nemerle.Compiler.TypesManager._N_maybe_f_25534.apply_void(TypeBuilder
_N_25533)
at Nemerle.Collections.List.Iter['a](list`1 l, FunctionVoid`1 f)
at Nemerle.Core.list`1.Iter(FunctionVoid`1 f)
at Nemerle.Compiler.TypesManager.Iter(list`1 builders, FunctionVoid`1 f)
at Nemerle.Compiler.TypesManager.compile_all_tyinfos(Boolean aux_phase)
at Nemerle.Compiler.TypesManager._N__N_l24661_24752.apply_void()
at Nemerle.Compiler.Solver.Enqueue(FunctionVoid action)
at Nemerle.Compiler.TypesManager.EmitDecls()
at Nemerle.Compiler.ManagerClass.Run()
at Nemerle.CommandlineCompiler.MainClass.main_with_catching()
error: child process exited abnormally
... while compiling program.n
More information about the devel-en
mailing list