-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In resolve, check that an or-pattern has the same number of bindings …
…in each disjunct resolve3 wasn't checking this. Added test cases. Also added a helpful informational message in the case where you have a variable binding that you probably think refers to a variant that you forgot to import. This is easier to do in resolve than in typeck because there's code in typeck that assumes that each of the patterns binds the same number of variables.
- Loading branch information
1 parent
019d429
commit f39477d
Showing
4 changed files
with
64 additions
and
5 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,15 @@ | ||
mod bar { | ||
enum foo { | ||
alpha, | ||
beta, | ||
charlie | ||
} | ||
} | ||
|
||
fn main() { | ||
import bar::{alpha, charlie}; | ||
alt alpha { | ||
alpha | beta {} //~ ERROR: inconsistent number of bindings | ||
charlie {} | ||
} | ||
} |
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 @@ | ||
enum foo { alpha, beta(int) } | ||
|
||
fn main() { | ||
alt alpha { | ||
alpha | beta(i) {} //~ ERROR inconsistent number of bindings | ||
} | ||
} |