Ziaw / npad

Nemerle pad. Very simple nemerle IDE for language snippets fast run.
14 stars 8 forks source link

Code with quotation without module body not worked #9

Closed ghost closed 12 years ago

ghost commented 12 years ago

This code not worked properly in Npad:

using System.Console;

def expr = <[ 1 + 1 ]>;
def expr2 = <[ 1 + 1 ]>;
WriteLine($"expr type is $expr");
WriteLine($"expr2 type is $expr2");

error says:

snippet.n:2:14:2:19: error: you must specify `partial' modifier on all declarations of type `_N_MacroContexts'
snippet.n:2:14:2:19: error: first defined here
Nemerle.Core.AssertionException: assertion ``this.tenv == null'' failed in file ncc\hierarchy\TypeBuilder.n, line 884
   в Nemerle.Compiler.TypeBuilder.make_tyenvs() в e:\OpenSource\Nemerle\Nemerle\ncc\hierarchy\TypeBuilder.n:строка 885
   в Nemerle.Compiler.TypeBuilder.FixupDefinedClass() в e:\OpenSource\Nemerle\Nemerle\ncc
Ziaw commented 12 years ago

Code is not correct and can't be compiled by command line compiler.

Quasiquatation has been designed for usage in the macros only. This sample can be compiled with required Nemerle.Compiler.dll, -r Nemerle.Compiler switch, but runtime error throws. Because Nemerle AST requires initialized compiler context.

NPad crash is a bug that should be fixed, but code can not be executed correctrly.

ghost commented 12 years ago

Thats it, this crash is bug, in VS it compiles but not runs.

Ziaw commented 12 years ago

I was recompile NPad and can't reproduce a crash.

Your code compilation shows compiler error propertly.

This code:

using System.Console;
using Nemerle.Compiler; // reference

def expr = <[ 1 + 1 ]>;
def expr2 = <[ 1 + 1 ]>;
WriteLine($"expr type is $expr");
WriteLine($"expr2 type is $expr2");

works on my NPad without any modifications. Because NPad initializes compiler context.

Try to recompile NPad with latest Nemerle version.

ghost commented 12 years ago

yes with reference it's ok, but without it is a problem, and error is very informateless. It seems Nemerle.Compiler reference removes this error. Yes error is in invalid code and unreferenced Nemerle.Compiler.