- Notifications
You must be signed in to change notification settings - Fork 473
Fix type error for variant constructor args as optional field record #5827
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
17 commits Select commit Hold shift + click to select a range
b11d67e add test
mununki 906201a fix error variant cstr arg of optional field
mununki ca23dfd add test
mununki cf5cd55 change optional field in cstr arg to option type
mununki 26df372 fix tests
mununki 29630b7 not dump the undefined value of optional field
mununki 809b596 update changelog
mununki b18d82a add tests
mununki f47cea9 clean up
mununki 9d450cb clean up
mununki fee0eda add tests for inlined record of pattern matching
mununki b1d9795 add tests
mununki 9405b6f clean up
mununki 9f82fc2 fix inlined optional record pattern matching
mununki 651ba2b clean up tests
mununki 95f47f9 remove change log from master
mununki dedc12f clean up change log
mununki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add tests for inlined record of pattern matching
- Loading branch information
commit fee0edac7e77dc363bbd6b6f441be7e9755d0fff
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| | @@ -109,3 +109,30 @@ let foo2 = Foo({name: "foo", age: 3}) | |
| // should be type error | ||
| ||
| // let foo3 = Foo({name: "foo", age: 3, nickname: "hasNoNickname"}) | ||
| // let foo4 = Foo({name: "foo", age: "3"}) | ||
| | ||
| type inlinedRecord = V0({x0: string, x1?: string, x2?: int, x3: int}) | V1({y0: string, y1: int}) | ||
| | ||
| let ir0 = V0({x0: "v0", x3: 3}) | ||
| let ir1 = V0({x0: "v0", x1: "v1", x3: 3}) | ||
| let ir2 = V0({x0: "v0", x1: "v1", x2: 2, x3: 3}) | ||
| | ||
| let pm0 = switch ir0 { | ||
| | V0({x0, x3}) => (x0, x3) | ||
| | V1({y0, y1}) => (y0, y1) | ||
| } | ||
| let pm1 = switch ir1 { | ||
| | V0({x0, x1, x3}) => (x0, x1, x3) | ||
cristianoc marked this conversation as resolved. Show resolved Hide resolved | ||
| | V1({y0, y1}) => (y0, None, y1) | ||
| } | ||
| let pm2 = switch ir2 { | ||
| | V0({x0, x1, x2, x3}) => (x0, x1, x2, x3) | ||
| | V1({y0, y1}) => (y0, None, None, y1) | ||
| } | ||
| let pm3 = switch ir2 { | ||
| | V0({x0, x1, x2, x3}) if x1 == Some("x1") => (x0, "x1!", x2, x3) | ||
| | V0({x0, x1, x2, x3}) => switch x1 { | ||
| | Some(x1) => (x0, x1, x2, x3) | ||
| | None => (x0, "not existed", x2, x3) | ||
| } | ||
| | V1({y0, y1}) => (y0, "not existed", None, y1) | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.