Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow parenthesised address types #937

Merged
merged 1 commit into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions src/base/ParserFaults.messages
Original file line number Diff line number Diff line change
Expand Up @@ -282,25 +282,6 @@ type_term: MAP CID UNDERSCORE

This map type likely has an invalid map value type.

type_term: MAP LPAREN CID UNDERSCORE
##
## Ends in an error in state: 28.
##
## t_map_key -> LPAREN scid . RPAREN [ MAP LPAREN HEXLIT CID ]
##
## The known suffix of the stack is as follows:
## LPAREN scid
##
## WARNING: This example involves spurious reductions.
## This implies that, although the LR(1) items shown above provide an
## accurate view of the past (what has been recognized so far), they
## may provide an INCOMPLETE view of the future (what was expected next).
## In state 25, spurious reduction of production scid -> CID
##
# see tests/checker/bad/bad_map_key_1.scilla

This map type has an invalid key type. A closing bracket or proper separated capital identifier is expected.

type_term: MAP LPAREN WITH
##
## Ends in an error in state: 21.
Expand Down
1 change: 1 addition & 0 deletions src/base/ScillaParser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ id_with_typ :
t_map_key :
| kt = scid { to_map_key_type_exn kt (toLoc $startpos) }
| LPAREN; kt = scid; RPAREN; { to_map_key_type_exn kt (toLoc $startpos(kt)) }
| LPAREN; kt = address_typ; RPAREN; { kt }
| kt = address_typ; { kt }

(* TODO: This is a temporary fix of issue #261 *)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"errors": [
{
"error_message": "Syntax error, state number 311",
"error_message": "Syntax error, state number 313",
"start_location": {
"file":
"base/parser/bad/cmodule-field-id-colon-cid-eq-hexlit-with.scilla",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"errors": [
{
"error_message": "Syntax error, state number 222",
"error_message": "Syntax error, state number 224",
"start_location": {
"file": "base/parser/bad/cmodule-field-id-colon-tid-eq-with.scilla",
"line": 7,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"errors": [
{
"error_message": "Syntax error, state number 196",
"error_message": "Syntax error, state number 198",
"start_location": {
"file":
"base/parser/bad/exps/exp_t-match-spid-with-bar-underscore-arrow-hexlit-with.scilexp",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"errors": [
{
"error_message": "Syntax error, state number 204",
"error_message": "Syntax error, state number 206",
"start_location": {
"file":
"base/parser/bad/lib/lmodule-library-cid-let-id-eq-hexlit-with.scillib",
Expand Down
3 changes: 1 addition & 2 deletions tests/checker/bad/gold/bad_map_key_1.scilla.gold
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"gas_remaining": "8000",
"errors": [
{
"error_message":
"This map type has an invalid key type. A closing bracket or proper separated capital identifier is expected.\n",
"error_message": "Syntax error, state number 86",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit weird we have syntactic errors in the typechecker tests. Perhaps this could be refactored and moved into tests/base/parser/bad directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, but both this and the list_to_map case originate from master, so the problem should be fixed there rather than here on the remote_state_reads branch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I'm always missing the destination branch :)

"start_location": {
"file": "checker/bad/bad_map_key_1.scilla",
"line": 7,
Expand Down
2 changes: 1 addition & 1 deletion tests/eval/bad/gold/list_to_map.scilexp.gold
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"errors": [
{
"error_message": "Syntax error, state number 36",
"error_message": "Syntax error, state number 31",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same suggestions as for the typechecker test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as for the typechecker test. :-)

"start_location": {
"file": "eval/bad/list_to_map.scilexp",
"line": 7,
Expand Down