[nem-bug] [Nemerle 0000620]: MainParser.ParseExpr("def f(){}") and MainParser.ParseExpr("") cause NullReferenceException

feedback at nemerle.org feedback at nemerle.org
Sun Feb 19 14:13:30 CET 2006


The following issue has been RESOLVED.
======================================================================
<http://nemerle.org/bugs/view.php?id=620> 
======================================================================
Reported By:                steffen
Assigned To:                nazgul
======================================================================
Project:                    Nemerle
Issue ID:                   620
Category:                   Compiler
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     resolved
Resolution:                 fixed
Fixed in Version:           
======================================================================
Date Submitted:             02-15-2006 20:08 CET
Last Modified:              02-19-2006 14:13 CET
======================================================================
Summary:                    MainParser.ParseExpr("def f(){}") and
MainParser.ParseExpr("") cause NullReferenceException
Description: 
When compiling the following code:

_ = $"$(def f(){})";

the compiler crashes:

error: internal compiler error: got some unknown exception of type
System.NullReferenceException: Object reference not set to an instance of
an object
in <0x0003a> Nemerle.Compiler.MainParser:peek_sibling_token ()
in <0x00014> Nemerle.Compiler.MainParser:flag_sibling_keyword
(System.String kw)in <0x0278d>
Nemerle.Compiler.MainParser:parse_embedded_expr (TokenStoppers stop)
in <0x003c8> Nemerle.Compiler.MainParser:parse_expr (TokenStoppers stop)
in <0x0010f> Nemerle.Compiler.MainParser:ParseExpr
(Nemerle.Compiler.GlobalEnv env, Nemerle.Compiler.LexerBase lexer, Boolean
allow_empty)
in <0x0009d> Nemerle.Compiler.MainParser:ParseExpr
(Nemerle.Compiler.GlobalEnv env, System.String expr, Boolean allow_empty)
in <0x0024d> Nemerle.IO.Helper:make_splice_distribution (System.String
str, Nemerle.Compiler.GlobalEnv _env)
in <0x00207> Nemerle.IO.sprintMacro:Run (Nemerle.Compiler.Typer _N_778,
Nemerle.Core.list`1 parms)
in <0x0027d> Nemerle.Compiler.MacroRegistry:expand_macro
(Nemerle.Compiler.Typer ctx, Nemerle.Compiler.Parsetree.PExpr expr)
in <0x000bf> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected,
Boolean is_toplevel_in_seq)
in <0x00012> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected)
in <0x0015d> Nemerle.Compiler.Typer:TypeLocalDefinition (Boolean
is_mutable, Nemerle.Compiler.Parsetree.Name name,
Nemerle.Compiler.Parsetree.PExpr val)
in <0x00873> Nemerle.Compiler.Typer:DoType
(Nemerle.Compiler.Parsetree.PExpr expression, Nemerle.Compiler.TyVar
expected, Boolean is_toplevel_in_seq)
in <0x000d5> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected,
Boolean is_toplevel_in_seq)
in <0x00012> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected)
in <0x03e0d> Nemerle.Compiler.Typer:DoType
(Nemerle.Compiler.Parsetree.PExpr expression, Nemerle.Compiler.TyVar
expected, Boolean is_toplevel_in_seq)
in <0x000d5> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected,
Boolean is_toplevel_in_seq)
in <0x00012> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected)
in <0x05119> Nemerle.Compiler.Typer:DoType
(Nemerle.Compiler.Parsetree.PExpr expression, Nemerle.Compiler.TyVar
expected, Boolean is_toplevel_in_seq)
in <0x000d5> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected,
Boolean is_toplevel_in_seq)
in <0x00012> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected)
in <0x0001d> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e)
in <0x0047c> Nemerle.Compiler.Typer:RunTyper ()
in <0x00300> Nemerle.Compiler.Typer:.ctor (Nemerle.Compiler.MethodBuilder
m)
in <0x0003d> Nemerle.Compiler.MethodBuilder:RunBodyTyper ()
in <0x000e9> Nemerle.Compiler.MethodBuilder:Compile ()
in <0x0015b> Nemerle.Compiler.TypeBuilder:EmitImplementation ()
in <0x00043> Nemerle.Compiler.TypesManager+_N_emit_impl_23258:apply_void
(Nemerle.Compiler.TypeBuilder _N_23257)
in <0x0012c> Nemerle.Compiler.TypesManager+_N_maybe_f_23695:apply_void
(Nemerle.Compiler.TypeBuilder _N_23694)
in <0x00087> Nemerle.Collections.List:Iter[TypeBuilder]
(Nemerle.Core.list`1 l, Nemerle.Builtins.FunctionVoid`1 f)
in <0x0000d> Nemerle.Core.list`1[Nemerle.Compiler.TypeBuilder]:Iter
(Nemerle.Builtins.FunctionVoid`1 )
in <0x00065> Nemerle.Compiler.TypesManager:Iter (Nemerle.Core.list`1
builders, Nemerle.Builtins.FunctionVoid`1 f)
in <0x0001d> Nemerle.Compiler.TypesManager:Iter
(Nemerle.Builtins.FunctionVoid`1 f)
in <0x001d3> Nemerle.Compiler.TypesManager:compile_all_tyinfos (Boolean
aux_phase)
in <0x00034> Nemerle.Compiler.TypesManager+_N__N_l22845_22929:apply_void
()
in <0x00040> Nemerle.Compiler.Solver:Enqueue
(Nemerle.Builtins.FunctionVoid action)
in <0x00059> Nemerle.Compiler.TypesManager:EmitDecls ()
in <0x00193> Nemerle.Compiler.Passes:Run ()
in <0x000a2> Nemerle.CommandlineCompiler.MainClass:main_with_catching ()

However

_ = $"$(def f(){}; ())";

compiles.




When Compiling the following:

_ = $"$()";


the compiler crashes with a similar error message:

error: internal compiler error: got some unknown exception of type
System.NullReferenceException: Object reference not set to an instance of
an object
in <0x000bf> Nemerle.Compiler.MainParser:ParseExpr
(Nemerle.Compiler.GlobalEnv env, Nemerle.Compiler.LexerBase lexer, Boolean
allow_empty)
in <0x0009d> Nemerle.Compiler.MainParser:ParseExpr
(Nemerle.Compiler.GlobalEnv env, System.String expr, Boolean allow_empty)
in <0x0024d> Nemerle.IO.Helper:make_splice_distribution (System.String
str, Nemerle.Compiler.GlobalEnv _env)
in <0x00207> Nemerle.IO.sprintMacro:Run (Nemerle.Compiler.Typer _N_778,
Nemerle.Core.list`1 parms)
in <0x0027d> Nemerle.Compiler.MacroRegistry:expand_macro
(Nemerle.Compiler.Typer ctx, Nemerle.Compiler.Parsetree.PExpr expr)
in <0x000bf> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected,
Boolean is_toplevel_in_seq)
in <0x00012> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected)
in <0x0015d> Nemerle.Compiler.Typer:TypeLocalDefinition (Boolean
is_mutable, Nemerle.Compiler.Parsetree.Name name,
Nemerle.Compiler.Parsetree.PExpr val)
in <0x00873> Nemerle.Compiler.Typer:DoType
(Nemerle.Compiler.Parsetree.PExpr expression, Nemerle.Compiler.TyVar
expected, Boolean is_toplevel_in_seq)
in <0x000d5> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected,
Boolean is_toplevel_in_seq)
in <0x00012> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected)
in <0x03e0d> Nemerle.Compiler.Typer:DoType
(Nemerle.Compiler.Parsetree.PExpr expression, Nemerle.Compiler.TyVar
expected, Boolean is_toplevel_in_seq)
in <0x000d5> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected,
Boolean is_toplevel_in_seq)
in <0x00012> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected)
in <0x05119> Nemerle.Compiler.Typer:DoType
(Nemerle.Compiler.Parsetree.PExpr expression, Nemerle.Compiler.TyVar
expected, Boolean is_toplevel_in_seq)
in <0x000d5> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected,
Boolean is_toplevel_in_seq)
in <0x00012> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected)
in <0x0001d> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e)
in <0x0047c> Nemerle.Compiler.Typer:RunTyper ()
in <0x00300> Nemerle.Compiler.Typer:.ctor (Nemerle.Compiler.MethodBuilder
m)
in <0x0003d> Nemerle.Compiler.MethodBuilder:RunBodyTyper ()
in <0x000e9> Nemerle.Compiler.MethodBuilder:Compile ()
in <0x0015b> Nemerle.Compiler.TypeBuilder:EmitImplementation ()
in <0x00043> Nemerle.Compiler.TypesManager+_N_emit_impl_23258:apply_void
(Nemerle.Compiler.TypeBuilder _N_23257)
in <0x0012c> Nemerle.Compiler.TypesManager+_N_maybe_f_23695:apply_void
(Nemerle.Compiler.TypeBuilder _N_23694)
in <0x00087> Nemerle.Collections.List:Iter[TypeBuilder]
(Nemerle.Core.list`1 l, Nemerle.Builtins.FunctionVoid`1 f)
in <0x0000d> Nemerle.Core.list`1[Nemerle.Compiler.TypeBuilder]:Iter
(Nemerle.Builtins.FunctionVoid`1 )
in <0x00065> Nemerle.Compiler.TypesManager:Iter (Nemerle.Core.list`1
builders, Nemerle.Builtins.FunctionVoid`1 f)
in <0x0001d> Nemerle.Compiler.TypesManager:Iter
(Nemerle.Builtins.FunctionVoid`1 f)
in <0x001d3> Nemerle.Compiler.TypesManager:compile_all_tyinfos (Boolean
aux_phase)
in <0x00034> Nemerle.Compiler.TypesManager+_N__N_l22845_22929:apply_void
()
in <0x00040> Nemerle.Compiler.Solver:Enqueue
(Nemerle.Builtins.FunctionVoid action)
in <0x00059> Nemerle.Compiler.TypesManager:EmitDecls ()
in <0x00193> Nemerle.Compiler.Passes:Run ()
in <0x000a2> Nemerle.CommandlineCompiler.MainClass:main_with_catching ()


======================================================================

----------------------------------------------------------------------
 nazgul - 02-19-06 14:13 
----------------------------------------------------------------------
Fixed on trunk (r6133).

BTW, after this patch I was successful with following sequence:

$ ./nemish.exe 
Welcome to Nemerle interpreter (using ncc 0.9.2.3).

Please enter expressions appended with ";;".
Type "Help;;" for more info.

Please wait while evaluating the config file..
- def f() {};;
def f : void  -> void 
def it : void 
- def foo () { System.Console.WriteLine ("Kamil"); };;
def foo : void  -> void 
def it : void 
- foo ();;
Kamil
def it : void 
- def f (x) { x + 1 };;
def f : System.Int32 -> System.Int32
def it : void 
- f (132);;
def it = 133 : System.Int32

Issue History
Date Modified  Username       Field                    Change              
======================================================================
02-15-06 20:08 steffen        New Issue                                    
02-19-06 14:13 nazgul         Status                   new => resolved     
02-19-06 14:13 nazgul         Resolution               open => fixed       
02-19-06 14:13 nazgul         Assigned To               => nazgul          
02-19-06 14:13 nazgul         Note Added: 0001092                          
======================================================================




More information about the bugs mailing list