rsdn / nemerle

Nemerle language. Main repository.
http://nemerle.org
Other
620 stars 89 forks source link

ICE (NullReferenceException) while compiling code with object initializer macro (<-) #320

Open Stitchous opened 12 years ago

Stitchous commented 12 years ago

Compiling this code:

using Nemerle.Extensions; using System.Console;

module Program { public struct Test { public mutable UintField : uint; }

Main() : void
{
  def test = Test() <- { UintField = 0; };
 }

}

produces following ICE:

error : internal compiler error: got some unknown exception of type System.NullReferenceException: Object reference not set to an instance of an object. at Nemerle.Compiler.MethodBuilder.get_BodyLocation() at Nemerle.Compiler.Typer.RunFullTyping() at Nemerle.Compiler.MethodBuilder.RunBodyTyper() at Nemerle.Compiler.MethodBuilder.Compile() at Nemerle.Compiler.TypeBuilder.EmitImplementation() at Nemerle.Compiler.TypesManager._N_emit_impl60312.apply_void(TypeBuilder ti) at Nemerle.Compiler.TypesManager._N_maybe_f60555.apply_void(TypeBuilder ti) at Nemerle.Collections.NList.Iter[T](list1 l, FunctionVoid1 f) at Nemerle.Compiler.TypesManager.Iter(list1 builders, FunctionVoid1 f) at Nemerle.Compiler.TypesManager.compile_all_tyinfos(Boolean aux_phase) at Nemerle.Compiler.TypesManager._N__N_lambda5973659839.apply_void() at Nemerle.Compiler.Solver.Enqueue(FunctionVoid action) at Nemerle.Compiler.ManagerClass.Run() at Nemerle.CommandlineCompiler.MainClass.main_with_catching()

Workaround: UintField = 0U;

NN--- commented 12 years ago

I cannot reproduce it. Which version of compiler is used ?

Please check with latest version, maybe it was fixed: https://github.com/rsdn/nemerle/downloads

Stitchous commented 12 years ago

just got latests sources from https://github.com/rsdn/nemerle.git, built fresh installer (BuildInstallerFull-4.cmd) and reproduced that error

NN--- commented 12 years ago

Works well for me with the latest source. Maybe you have Nemerle compiler installed in the system ? Try to uninstall and remove Nemerle directory from Program Files entirely.

How do you check ? I did:

cd bin\Release\net-4.0\Stage4
ncc test.n

Maybe you have a different code?

using Nemerle.Extensions;
using System.Console;

module Program
{
  public struct Test
  {
    public mutable UintField : uint;
  }

  Main() : void
  {
    def test = Test() <- { UintField = 0; };
  }
}
Stitchous commented 12 years ago

ncc /debug+ test.n

NN--- commented 12 years ago

Reproduced :)

NN--- commented 12 years ago

Actually if are willing to help fixing this issue, you can debug compiler and find out what causes this happen.