metaborg / stratego

Apache License 2.0
10 stars 6 forks source link

Internal compiler stacktrace in code generation (java_to_string_all_element_0_0 on Chars([TP])) #24

Open Apanatshka opened 2 years ago

Apanatshka commented 2 years ago

Describe the bug During compilation, when generating code, the compiler fails with a stacktrace (repeated a couple of times). It's on a java-to-string-all-element call on the term Chars([TP]).

mb.stratego.common.StrategoExceptions$ExceptionalFail: Invoking Stratego strategy 'stratego2-strj-sep-comp' failed exceptionally

Project This is when compiling a Stratego 2 project.

Versions Spoofax 3 0.16.16

To Reproduce

strategies
  A :: TP
  A = topdown(try(B))

  // note how B is not marked TP. When B is marked TP this bug is worked around.
  B = id

Observed behaviour The compiler gives no remark on inserted casts, warnings or errors but fails during compilation.

Expected behaviour An error in A that it cannot prove TP for try(B).

Additional context The stacktrace is probably not super useful since the problem occured earlier when the bad Java AST was built, but here it is:

Caused by: org.spoofax.interpreter.core.InterpreterErrorExit: Internal error: 'with' clause failed unexpectedly in 'java-to-string-all'
    [Chars(TP)]
    stratego2_strj_sep_comp_0_0
    stratego2_strj_sep_comp_0_0
    log_timed_1_2
    xtc_input_1_0
    xtc_temp_files_1_0
    restore_always_2_0
    strj_or_die2_0_1
    strj2_0_0
    log_timed_1_2
    list_loop_1_0
    output_java_0_0
    with_1_1
    java_to_string_0_0
    java_to_string_0_0_fragment_4
    java_to_string_0_0_fragment_3
    java_to_string_0_0_fragment_2
    java_to_string_0_0_fragment_1
    java_to_string_all_0_0
    with_1_1
    map_1_0
    java_to_string_all_element_0_0
    map_1_0
    java_to_string_0_0
    java_to_string_0_0_fragment_4
    java_to_string_0_0_fragment_3
    java_to_string_0_0_fragment_2
    java_to_string_0_0_fragment_1
    java_to_string_0_0_fragment_0
    java_to_string_all_0_0
    with_1_1
    map_1_0
    java_to_string_all_element_0_0
    java_to_string_0_0
    java_to_string_0_0_fragment_4
    java_to_string_0_0_fragment_3
    java_to_string_0_0_fragment_2
    java_to_string_0_0_fragment_1
    java_to_string_0_0_fragment_0
    block_structure_string_0_0
    java_to_string_all_0_0
    with_1_1
    map_1_0
    java_to_string_all_element_0_0
    map_1_0
    java_to_string_0_0
    java_to_string_0_0_fragment_4
    java_to_string_all_0_0
    with_1_1
    map_1_0
    java_to_string_all_element_0_0
    java_to_string_0_0
    java_to_string_0_0_fragment_4
    java_to_string_0_0_fragment_3
    block_structure_string_0_0
    java_to_string_all_0_0
    with_1_1
    map_1_0
    java_to_string_all_element_0_0
    map_1_0
    java_to_string_0_0
    java_to_string_0_0_fragment_4
    java_to_string_0_0_fragment_3
    java_to_string_0_0_fragment_2
    java_to_string_all_0_0
    with_1_1
    map_1_0
    java_to_string_all_element_0_0
    java_to_string_0_0
    java_to_string_0_0_fragment_4
    java_to_string_0_0_fragment_3
    block_structure_string_0_0
    java_to_string_all_0_0
    with_1_1
    map_1_0
    java_to_string_all_element_0_0
    map_1_0
    java_to_string_0_0
    java_to_string_0_0_fragment_4
    java_to_string_0_0_fragment_3
    java_to_string_all_0_0
    with_1_1
    map_1_0
    java_to_string_all_element_0_0
    java_to_string_0_0
    java_to_string_0_0_fragment_4
    java_to_string_0_0_fragment_3
    java_to_string_0_0_fragment_2
    expr_to_string_0_0
    expr_to_string_0_0_fragment_0
    java_to_string_all_0_0
    with_1_1
    map_1_0
    java_to_string_all_element_0_0
    java_to_string_0_0
    java_to_string_0_0_fragment_4
    java_to_string_0_0_fragment_3
    java_to_string_0_0_fragment_2
    java_to_string_0_0_fragment_1
    with_1_1
    list_to_args_string_0_0
    java_to_string_all_0_0
    with_1_1
    map_1_0
    java_to_string_all_element_0_0
    map_1_0
    java_to_string_0_0
    java_to_string_0_0_fragment_4
    java_to_string_0_0_fragment_3
    java_to_string_0_0_fragment_2
    java_to_string_0_0_fragment_1
    with_1_1
    list_to_args_string_0_0
    java_to_string_all_0_0
    with_1_1
    map_1_0
    java_to_string_all_element_0_0
    map_1_0
    java_to_string_0_0
    java_to_string_0_0_fragment_4
    java_to_string_0_0_fragment_3
    java_to_string_0_0_fragment_2
    java_to_string_0_0_fragment_1
    with_1_1
    list_to_args_string_0_0
    java_to_string_all_0_0
    with_1_1
    map_1_0
    java_to_string_all_element_0_0
    map_1_0
    java_to_string_0_0
    java_to_string_0_0_fragment_4
    java_to_string_0_0_fragment_3
    java_to_string_0_0_fragment_2
    java_to_string_0_0_fragment_1
    with_1_1
    list_to_args_string_0_0
    java_to_string_all_0_0
    with_1_1
    map_1_0
    java_to_string_all_element_0_0
    map_1_0
    java_to_string_0_0
    java_to_string_0_0_fragment_4
    java_to_string_0_0_fragment_3
    java_to_string_0_0_fragment_2
    java_to_string_0_0
    java_to_string_0_0_fragment_4
    java_to_string_0_0_fragment_3
    java_to_string_0_0_fragment_2
    java_to_string_all_0_0
    with_1_1
    map_1_0
    java_to_string_all_element_0_0
    java_to_string_0_0
    java_to_string_0_0_fragment_4
    java_to_string_0_0_fragment_3
    java_to_string_0_0_fragment_2
    java_to_string_0_0_fragment_1
    java_to_string_all_0_0
    with_1_1 <==
    map_1_0
    java_to_string_all_element_0_0