-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix unnecessary check inside of the match exhaustivity algorithm (#2009)
* Allow for nested patterns. * Remove the comment in code.
- Loading branch information
1 parent
458724e
commit 9791173
Showing
7 changed files
with
75 additions
and
25 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
14 changes: 14 additions & 0 deletions
14
...src/e2e_vm_tests/test_programs/should_pass/language/match_expressions_with_self/Forc.lock
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,14 @@ | ||
[[package]] | ||
name = 'abort_control_flow_good' | ||
source = 'root' | ||
dependencies = ['std'] | ||
|
||
[[package]] | ||
name = 'core' | ||
source = 'path+from-root-CB060A17C0778A7E' | ||
dependencies = [] | ||
|
||
[[package]] | ||
name = 'std' | ||
source = 'path+from-root-CB060A17C0778A7E' | ||
dependencies = ['core'] |
8 changes: 8 additions & 0 deletions
8
...src/e2e_vm_tests/test_programs/should_pass/language/match_expressions_with_self/Forc.toml
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,8 @@ | ||
[project] | ||
authors = ["Fuel Labs <contact@fuel.sh>"] | ||
entry = "main.sw" | ||
license = "Apache-2.0" | ||
name = "abort_control_flow_good" | ||
|
||
[dependencies] | ||
std = { path = "../../../../../../../sway-lib-std" } |
14 changes: 14 additions & 0 deletions
14
...tests/test_programs/should_pass/language/match_expressions_with_self/json_abi_oracle.json
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,14 @@ | ||
[ | ||
{ | ||
"inputs": [], | ||
"name": "main", | ||
"outputs": [ | ||
{ | ||
"components": null, | ||
"name": "", | ||
"type": "u64" | ||
} | ||
], | ||
"type": "function" | ||
} | ||
] |
28 changes: 28 additions & 0 deletions
28
...c/e2e_vm_tests/test_programs/should_pass/language/match_expressions_with_self/src/main.sw
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,28 @@ | ||
script; | ||
|
||
use core::ops::Eq; | ||
use std::assert::*; | ||
|
||
enum Initialized { | ||
True: (), | ||
False: (), | ||
} | ||
|
||
impl Eq for Initialized { | ||
fn eq(self, other: Self) -> bool { | ||
match (self, other) { | ||
(Initialized::True, Initialized::True) => true, | ||
(Initialized::False, Initialized::False) => true, | ||
_ => false, | ||
} | ||
} | ||
} | ||
|
||
fn main() -> u64 { | ||
let a = Initialized::True; | ||
let b = Initialized::False; | ||
let c = a == b; | ||
assert(c == false); | ||
|
||
1 | ||
} |