Compiler crash on repeaded assignments in state definition #292

Closed
opened 2021-01-25 20:22:08 +09:00 by zxq9 · 0 comments
zxq9 commented 2021-01-25 20:22:08 +09:00 (Migrated from gitlab.com)

Created by: nikita-fuchs

Instead of error responses, I'm getting a compiler crash for the following case:

contract MultiAssign =

    record state = { 
        testvalue: int}


    stateful entrypoint init(one: int) = 
        { 
            testvalue = one,
            testvalue = 42}
    
    public entrypoint read_test_value() : int =
        state.testvalue

Receiving:

 Http request for https://latest.compiler.aepps.com/compile failed with status code 400. Status: . 
Error data: [{"message":"Compiler crashed, with reason: {case_clause,\n                                [{set,\n                                  {typed,\n                                   [{file,no_file},{line,10},{col,25}],\n                                   {id,\n                                    [{file,no_file},{line,10},{col,25}],\n                                    \"one\"},\n                                   {id,\n                                    [{file,no_file},{line,8},{col,35}],\n                                    \"int\"}}},\n                                 {set,\n                                  {typed,\n                                   [{file,no_file},{line,11},{col,25}],\n                                   {int,\n                                    [{file,no_file},{line,11},{col,25}],\n                                    42},\n                                   {id,\n                                    [{file,no_file},{line,11},{col,25}],\n                                    \"int\"}}}]}\n[{aeso_ast_to_fcode,field_value,2,\n                    [{file,\"/app/_build/default/lib/aesophia/src/aeso_ast_to_fcode.erl\"},\n                     {line,1890}]},\n {aeso_ast_to_fcode,'-expr_to_fcode/3-fun-3-',3,\n                    [{file,\"/app/_build/default/lib/aesophia/src/aeso_ast_to_fcode.erl\"},\n                     {line,527}]},\n {lists,map,2,[{file,\"lists.erl\"},{line,1239}]},\n {aeso_ast_to_fcode,expr_to_fcode,3,\n                    [{file,\"/app/_build/default/lib/aesophia/src/aeso_ast_to_fcode.erl\"},\n                     {line,530}]},\n {aeso_ast_to_fcode,decl_to_fcode,2,\n                    [{file,\"/app/_build/default/lib/aesophia/src/aeso_ast_to_fcode.erl\"},\n                     {line,307}]},\n {lists,foldl,3,[{file,\"lists.erl\"},{line,1263}]},\n {aeso_ast_to_fcode,to_fcode,2,\n                    [{file,\"/app/_build/default/lib/aesophia/src/aeso_ast_to_fcode.erl\"},\n                     {line,262}]},\n {aeso_ast_to_fcode,ast_to_fcode,2,\n                    [{file,\"/app/_build/default/lib/aesophia/src/aeso_ast_to_fcode.erl\"},\n                     {line,161}]}]\n","pos":{"col":0,"line":0},"type":"data_error"}]
    at processResponse (http.js:40)
*Created by: nikita-fuchs* Instead of error responses, I'm getting a compiler crash for the following case: ``` contract MultiAssign = record state = { testvalue: int} stateful entrypoint init(one: int) = { testvalue = one, testvalue = 42} public entrypoint read_test_value() : int = state.testvalue ``` Receiving: ``` Http request for https://latest.compiler.aepps.com/compile failed with status code 400. Status: . Error data: [{"message":"Compiler crashed, with reason: {case_clause,\n [{set,\n {typed,\n [{file,no_file},{line,10},{col,25}],\n {id,\n [{file,no_file},{line,10},{col,25}],\n \"one\"},\n {id,\n [{file,no_file},{line,8},{col,35}],\n \"int\"}}},\n {set,\n {typed,\n [{file,no_file},{line,11},{col,25}],\n {int,\n [{file,no_file},{line,11},{col,25}],\n 42},\n {id,\n [{file,no_file},{line,11},{col,25}],\n \"int\"}}}]}\n[{aeso_ast_to_fcode,field_value,2,\n [{file,\"/app/_build/default/lib/aesophia/src/aeso_ast_to_fcode.erl\"},\n {line,1890}]},\n {aeso_ast_to_fcode,'-expr_to_fcode/3-fun-3-',3,\n [{file,\"/app/_build/default/lib/aesophia/src/aeso_ast_to_fcode.erl\"},\n {line,527}]},\n {lists,map,2,[{file,\"lists.erl\"},{line,1239}]},\n {aeso_ast_to_fcode,expr_to_fcode,3,\n [{file,\"/app/_build/default/lib/aesophia/src/aeso_ast_to_fcode.erl\"},\n {line,530}]},\n {aeso_ast_to_fcode,decl_to_fcode,2,\n [{file,\"/app/_build/default/lib/aesophia/src/aeso_ast_to_fcode.erl\"},\n {line,307}]},\n {lists,foldl,3,[{file,\"lists.erl\"},{line,1263}]},\n {aeso_ast_to_fcode,to_fcode,2,\n [{file,\"/app/_build/default/lib/aesophia/src/aeso_ast_to_fcode.erl\"},\n {line,262}]},\n {aeso_ast_to_fcode,ast_to_fcode,2,\n [{file,\"/app/_build/default/lib/aesophia/src/aeso_ast_to_fcode.erl\"},\n {line,161}]}]\n","pos":{"col":0,"line":0},"type":"data_error"}] at processResponse (http.js:40) ```
Sign in to join this conversation.
No Milestone
No project
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: QPQ-AG/sophia#292
No description provided.