-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: resolver ty mismatch in the assign statement with the schema typ…
…e annotation (#384) * refactor: enhance the sematic type parse using the AST type in the resolver. * fix: assign stmt with schema type annotation type mismatch.
- Loading branch information
Showing
8 changed files
with
94 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
schema Foo: | ||
foo: int | ||
|
||
schema Bar: | ||
bar: int | ||
|
||
foo: Foo = Bar { | ||
bar: 1 | ||
} |
21 changes: 21 additions & 0 deletions
21
test/grammar/types/var_type_annotation/type_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,21 @@ | ||
import sys | ||
import kclvm.kcl.error as kcl_error | ||
import os | ||
|
||
cwd = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
kcl_error.print_kcl_error_message( | ||
kcl_error.get_exception( | ||
err_type=kcl_error.ErrType.TypeError_Compile_TYPE, | ||
file_msgs=[ | ||
kcl_error.ErrFileMsg( | ||
filename=cwd + "/main.k", | ||
line_no=7, | ||
col_no=1, | ||
arg_msg='got Bar', | ||
) | ||
], | ||
arg_msg='expect Foo, got Bar', | ||
), | ||
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,7 @@ | ||
schema Foo: | ||
foo: int | ||
|
||
schema Bar: | ||
bar: int | ||
|
||
foo: Foo = 1 |
21 changes: 21 additions & 0 deletions
21
test/grammar/types/var_type_annotation/type_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,21 @@ | ||
import sys | ||
import kclvm.kcl.error as kcl_error | ||
import os | ||
|
||
cwd = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
kcl_error.print_kcl_error_message( | ||
kcl_error.get_exception( | ||
err_type=kcl_error.ErrType.TypeError_Compile_TYPE, | ||
file_msgs=[ | ||
kcl_error.ErrFileMsg( | ||
filename=cwd + "/main.k", | ||
line_no=7, | ||
col_no=1, | ||
arg_msg='got int(1)', | ||
) | ||
], | ||
arg_msg='expect Foo, got int(1)', | ||
), | ||
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,9 @@ | ||
schema Foo: | ||
foo: int | ||
|
||
schema Bar: | ||
bar: int | ||
|
||
foo: int = Foo { | ||
foo = 1 | ||
} |
18 changes: 18 additions & 0 deletions
18
test/grammar/types/var_type_annotation/type_fail_12/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 kclvm.kcl.error as kcl_error | ||
import os | ||
|
||
cwd = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
kcl_error.print_kcl_error_message( | ||
kcl_error.get_exception( | ||
err_type=kcl_error.ErrType.TypeError_Compile_TYPE, | ||
file_msgs=[ | ||
kcl_error.ErrFileMsg( | ||
filename=cwd + "/main.k", line_no=7, col_no=1, arg_msg="got Foo" | ||
) | ||
], | ||
arg_msg="expect int, got Foo", | ||
), | ||
file=sys.stdout, | ||
) |