-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: schema index signature type unsoundness (#1007)
* fix: schema index signature type unsoundess Signed-off-by: peefy <[email protected]> * fix: test cases Signed-off-by: peefy <[email protected]> --------- Signed-off-by: peefy <[email protected]>
- Loading branch information
Showing
33 changed files
with
286 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
kclvm/sema/src/resolver/test_fail_data/unmatched_index_sign_default_value.k
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
schema WithComponent: | ||
name: str | ||
|
||
schema WithComponents: | ||
[name: str]: WithComponent = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
schema Schema: | ||
a.b = 1 | ||
|
||
s = Schema {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import sys | ||
import os | ||
|
||
import kclvm.kcl.error as kcl_error | ||
|
||
cwd = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
kcl_error.print_kcl_error_message( | ||
kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, | ||
file_msgs=[ | ||
kcl_error.ErrFileMsg( | ||
filename=cwd + "/main.k", | ||
line_no=2, | ||
), | ||
], | ||
arg_msg="failed to update the dict. An iterable of key-value pairs was expected, but got UndefinedType. Check if the syntax for updating the dictionary with the attribute 'b' is correct") | ||
, file=sys.stdout | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
schema WithComponent: | ||
name: str | ||
$type: str | ||
|
||
schema WithComponents: | ||
[name: str]: WithComponent = WithComponent {name: name} | ||
|
||
components: WithComponents { | ||
ws: {} | ||
} |
18 changes: 18 additions & 0 deletions
18
test/grammar/schema/index_signature/fail_10/stderr.golden.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import sys | ||
import os | ||
|
||
import kclvm.kcl.error as kcl_error | ||
|
||
cwd = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
kcl_error.print_kcl_error_message( | ||
kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, | ||
file_msgs=[ | ||
kcl_error.ErrFileMsg( | ||
filename=cwd + "/main.k", | ||
line_no=9, | ||
), | ||
], | ||
arg_msg="attribute 'type' of WithComponent is required and can't be None or Undefined") | ||
, file=sys.stdout | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
schema WithComponent: | ||
name: str | ||
$type: str | ||
|
||
schema WithComponents: | ||
[name: str]: WithComponent = WithComponent {name: name} | ||
|
||
components: WithComponents { | ||
ws = {} | ||
} |
18 changes: 18 additions & 0 deletions
18
test/grammar/schema/index_signature/fail_11/stderr.golden.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import sys | ||
import os | ||
|
||
import kclvm.kcl.error as kcl_error | ||
|
||
cwd = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
kcl_error.print_kcl_error_message( | ||
kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, | ||
file_msgs=[ | ||
kcl_error.ErrFileMsg( | ||
filename=cwd + "/main.k", | ||
line_no=9, | ||
), | ||
], | ||
arg_msg="attribute 'name' of WithComponent is required and can't be None or Undefined") | ||
, file=sys.stdout | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
schema WithComponent: | ||
name: str | ||
$type: str | ||
|
||
schema WithComponents: | ||
[name: str]: WithComponent = {name: name} | ||
|
||
components: WithComponents { | ||
ws: {} | ||
} |
18 changes: 18 additions & 0 deletions
18
test/grammar/schema/index_signature/fail_7/stderr.golden.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import sys | ||
import os | ||
|
||
import kclvm.kcl.error as kcl_error | ||
|
||
cwd = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
kcl_error.print_kcl_error_message( | ||
kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, | ||
file_msgs=[ | ||
kcl_error.ErrFileMsg( | ||
filename=cwd + "/main.k", | ||
line_no=9, | ||
), | ||
], | ||
arg_msg="attribute 'type' of WithComponent is required and can't be None or Undefined") | ||
, file=sys.stdout | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
schema WithComponent: | ||
name: str | ||
$type: str | ||
|
||
schema WithComponents: | ||
[name: str]: WithComponent = {name: name} | ||
|
||
components: WithComponents { | ||
ws: WithComponent {} | ||
} |
18 changes: 18 additions & 0 deletions
18
test/grammar/schema/index_signature/fail_8/stderr.golden.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import sys | ||
import os | ||
|
||
import kclvm.kcl.error as kcl_error | ||
|
||
cwd = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
kcl_error.print_kcl_error_message( | ||
kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, | ||
file_msgs=[ | ||
kcl_error.ErrFileMsg( | ||
filename=cwd + "/main.k", | ||
line_no=9, | ||
), | ||
], | ||
arg_msg="attribute 'type' of WithComponent is required and can't be None or Undefined") | ||
, file=sys.stdout | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
schema WithComponent: | ||
name: str | ||
$type: str | ||
|
||
schema WithComponents: | ||
[name: str]: WithComponent = WithComponent {name: name} | ||
|
||
components: WithComponents { | ||
ws: WithComponent {} | ||
} |
18 changes: 18 additions & 0 deletions
18
test/grammar/schema/index_signature/fail_9/stderr.golden.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import sys | ||
import os | ||
|
||
import kclvm.kcl.error as kcl_error | ||
|
||
cwd = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
kcl_error.print_kcl_error_message( | ||
kcl_error.get_exception(err_type=kcl_error.ErrType.EvaluationError_TYPE, | ||
file_msgs=[ | ||
kcl_error.ErrFileMsg( | ||
filename=cwd + "/main.k", | ||
line_no=9, | ||
), | ||
], | ||
arg_msg="attribute 'type' of WithComponent is required and can't be None or Undefined") | ||
, file=sys.stdout | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
schema TeamSpec: | ||
fullName: str | ||
name = id | ||
name: str = id | ||
shortName: str = name | ||
|
||
schema TeamMap: | ||
|
Oops, something went wrong.