Mazdak Farrokhzad
23d3fa266c
Rollup merge of #70457 - Centril:non-exhaustive-scrutinee-type, r=estebank
...
non-exhastive diagnostic: add note re. scrutinee type
This fixes https://github.com/rust-lang/rust/issues/67259 by adding a note:
```
= note: the matched value is of type &[i32]
```
to non-exhaustive pattern matching errors.
r? @varkor @estebank
2020-03-27 22:39:39 +01:00
Mazdak Farrokhzad
c858593ed0
non-exhastive diagnostic: add note re. scrutinee type
2020-03-27 06:49:07 +01:00
Amin Arria
ae7fa3042d
Add tests based on issue #70372 comments
2020-03-26 12:34:36 -03:00
Mazdak Farrokhzad
4d16c217b8
Matrix::push: recursively expand or-patterns
2020-03-10 17:46:19 +01:00
Mazdak Farrokhzad
c717721c1b
Rollup merge of #69599 - Centril:typeck-tweak-wording, r=davidtwco
...
check_binding_alt_eq_ty: improve precision wrt. `if let`
Follow up to https://github.com/rust-lang/rust/pull/69452 -- this tweaks the `check_binding_alt_eq_ty` logic wrt. wording so that `if let` doesn't include "in this arm" (because there can only ever be one arm).
r? @estebank
2020-03-08 11:51:14 +01:00
Mazdak Farrokhzad
289c3a5f6e
Rollup merge of #69687 - Centril:bm-inconsistent-wording, r=estebank
...
resolve, inconsistent binding mode: tweak wording
Now that we can have e.g. `let Ok(x) | Err(x) = res;`, it's no longer appropriate to refer to "the same *match arm*", so let's tweak the wording.
r? @estebank
2020-03-07 17:27:27 +01:00
Matthew Kuo
ea7b3c3c7b
fix tidy error
2020-03-04 02:05:23 -06:00
Matthew Kuo
b4788a739b
test(pattern): harden tests for or-patterns with slice-patterns
...
Some of the nested OR paths were being missed
2020-03-04 01:33:32 -06:00
Matthew Kuo
5456114858
test(pattern): add tests for combinations of pattern features
...
Reference issue #67311
Tests combinations of the following pattern features:
- bindings_after_at
- or_patterns
- slice_patterns
- box_patterns
2020-03-04 01:17:41 -06:00
Mazdak Farrokhzad
cc9aad452a
resolve, inconsistent binding mode: tweak wording.
2020-03-04 03:58:52 +01:00
Mazdak Farrokhzad
2746e12948
check_binding_alt_eq_ty: improve precision wrt. if let.
2020-03-01 03:52:45 +01:00
Mazdak Farrokhzad
1d33717583
improve or-pattern type consistency diagnostics
2020-02-25 05:30:43 +01:00
Yuki Okushi
829a3635e4
Rollup merge of #68856 - Centril:or-pat-ref-pat, r=matthewjasper
...
typeck: clarify def_bm adjustments & add tests for or-patterns
Clarify the adjustment algorithm for the expected type / default binding-modes when type checking patterns with more documentation and tweaks that make the algorithm more independent of the pattern forms.
Also resolve the FIXME noted for or-patterns by deciding that the current implementation is correct, noting the rationale and adding tests for the current implementation.
cc https://github.com/rust-lang/rust/issues/54883
r? @oli-obk @varkor
2020-02-15 07:17:47 +09:00
Matthias Prechtl
7b555178ae
--bless --compare-mode=nll
2020-02-09 20:43:49 +01:00
Mazdak Farrokhzad
17e632d382
or_patterns: test default binding modes
2020-02-05 10:33:15 +01:00
Mazdak Farrokhzad
29437e55a5
or_patterns: rename previous test
2020-02-05 06:55:41 +01:00
Mazdak Farrokhzad
6509db8443
or_patterns: harden bindings test
2020-02-05 06:55:41 +01:00
Mazdak Farrokhzad
ce6cd6709f
or_patterns: add regression test for 68785
2020-02-05 03:58:41 +01:00
matthewjasper
1d90ed6370
Apply suggestions from code review
...
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2020-02-03 19:42:15 +00:00
Matthew Jasper
c7e6f88926
Add more tests for or-patterns
2020-02-03 19:42:15 +00:00
Dan Robertson
0b1ff27cd8
Basic run-pass tests for or-patterns
...
Add some basic run-pass ui tests for or-patterns.
2020-02-01 22:10:58 +00:00
Matthew Jasper
30058df867
Update existing tests for or-patterns
2020-02-01 22:10:58 +00:00
Matthew Jasper
425e494fce
Remove or_patterns from INCOMPLETE_FEATURES
2020-02-01 22:07:11 +00:00
varkor
24a2929ed1
Normalise notes with the/is
2020-01-24 16:24:50 +00:00
Mazdak Farrokhzad
a1eadca88f
slice_patterns: remove gates in tests
2020-01-18 19:33:47 +01:00
Mazdak Farrokhzad
f8d2cce0ce
Blame user type in pat type error.
2019-12-30 14:28:40 +01:00
Mazdak Farrokhzad
d7e2f3aee5
refactor and fix this-expression-has-type note
2019-12-30 14:05:17 +01:00
Matthew Jasper
f1758a043f
Feature gate or patterns in const contexts
2019-12-25 09:13:15 +00:00
LeSeulArtichaut
eac6fac10b
Update tests
2019-12-12 20:56:14 +01:00
LeSeulArtichaut
3bd46f1aec
Update UI test expectations
2019-12-12 20:56:14 +01:00
Nadrieril
ef087d96f0
Move recently changed tests to the correct file
2019-12-02 16:03:03 +00:00
Nadrieril
5c7bd52a78
Lint for redundant branches in or-patterns
2019-12-02 16:03:00 +00:00
Nadrieril
00ccadf43f
Add some tests
2019-12-02 16:00:24 +00:00
Mazdak Farrokhzad
3af14f994d
Rollup merge of #66612 - Nadrieril:or-patterns-initial, r=varkor
...
Initial implementation of or-pattern usefulness checking
The title says it all.
I'd like to request a perf run on that, hopefully this doesn't kill performance too much.
cc https://github.com/rust-lang/rust/issues/54883
2019-11-30 16:56:45 +01:00
Nadrieril Feneanar
0f4c5fb20c
Apply suggestions from code review
...
Co-Authored-By: varkor <github@varkor.com>
2019-11-30 13:35:46 +00:00
Nadrieril
0881750173
Move tests to ui, split them and add some
2019-11-26 14:53:54 +00:00
Esteban Küber
34f03c01f6
Point at type in let assignment on type errors
2019-11-21 19:24:31 -08:00
Esteban Küber
6f8f70624b
Surround types with backticks in type errors
2019-11-18 11:03:04 -08:00
Esteban Küber
94c6425464
Remove E0308 note when primary label has all info
2019-11-18 11:03:03 -08:00
Esteban Küber
b2e6aef073
review comments: tweak prefix strings
2019-11-18 11:02:44 -08:00
Esteban Küber
83ffda5216
Specific labels when referring to "expected" and "found" types
2019-11-18 11:02:22 -08:00
Tomasz Miąsko
427952e808
Make error and warning annotations mandatory in UI tests
...
This change makes error and warning annotations mandatory in UI tests.
The only exception are tests that use error patterns to match compiler
output and don't have any annotations.
2019-11-10 21:01:02 +01:00
Eduard-Mihai Burtescu
680089c2d9
Revert "pre-expansion gate box_patterns"
...
This reverts commit 2aff6b36d7 .
2019-10-31 19:08:11 +02:00
Mazdak Farrokhzad
2aff6b36d7
pre-expansion gate box_patterns
2019-10-24 00:32:03 +02:00
Mazdak Farrokhzad
3eba6c18d4
syntax: recover trailing | in or-patterns.
2019-09-29 07:11:26 +02:00
Mazdak Farrokhzad
dbe6873387
resolve: test consistent or-patterns being allowed.
2019-09-05 08:33:09 +02:00
Mazdak Farrokhzad
aa7a02b029
resolve: test binding mode consistency for or-patterns.
2019-09-05 08:33:09 +02:00
Mazdak Farrokhzad
33317c7baa
resolve: add test for missing bindings in or-patterns.
2019-09-05 08:33:09 +02:00
Mazdak Farrokhzad
896a1c7fcd
resolve: account for general or-patterns in consistency checking.
2019-09-05 08:33:09 +02:00
Mazdak Farrokhzad
498ec59520
resolve: add tests for already-bound check.
2019-09-05 08:33:09 +02:00