about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2017-06-16 10:34:17 -0700
committerEsteban Küber <esteban@kuber.com.ar>2017-06-16 12:15:06 -0700
commitda78b4d88e1ba4598428a92a6c8d5f9c399fede0 (patch)
tree4a0013d4424c574e22157ced62126d2762beeb9e /src/test
parent028b5f94e3aef435c626131e5b571272f2d3d52c (diff)
downloadrust-da78b4d88e1ba4598428a92a6c8d5f9c399fede0.tar.gz
rust-da78b4d88e1ba4598428a92a6c8d5f9c399fede0.zip
Review comments
- exhaustive match
- rename method to `check_expr_meets_expectation_or_error`
- formatting
- add `delay_span_bug`
- add test
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/type-check/assignment-in-if.rs (renamed from src/test/ui/type-check/issue-17283.rs)4
-rw-r--r--src/test/ui/type-check/assignment-in-if.stderr (renamed from src/test/ui/type-check/issue-17283.stderr)17
2 files changed, 17 insertions, 4 deletions
diff --git a/src/test/ui/type-check/issue-17283.rs b/src/test/ui/type-check/assignment-in-if.rs
index f06888b8ec4..98dc55c6663 100644
--- a/src/test/ui/type-check/issue-17283.rs
+++ b/src/test/ui/type-check/assignment-in-if.rs
@@ -45,4 +45,8 @@ fn main() {
         //~| HELP did you mean to compare equality?
         println!("{}", x);
     }
+    if (if true { x = 4 } else { x = 5 }) {
+        //~^ ERROR mismatched types
+        println!("{}", x);
+    }
 }
diff --git a/src/test/ui/type-check/issue-17283.stderr b/src/test/ui/type-check/assignment-in-if.stderr
index f258caecd30..29439999273 100644
--- a/src/test/ui/type-check/issue-17283.stderr
+++ b/src/test/ui/type-check/assignment-in-if.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/issue-17283.rs:25:8
+  --> $DIR/assignment-in-if.rs:25:8
    |
 25 |     if x = x {
    |        ^^^^^
@@ -11,7 +11,7 @@ error[E0308]: mismatched types
               found type `()`
 
 error[E0308]: mismatched types
-  --> $DIR/issue-17283.rs:31:8
+  --> $DIR/assignment-in-if.rs:31:8
    |
 31 |     if (x = x) {
    |        ^^^^^^^
@@ -23,7 +23,7 @@ error[E0308]: mismatched types
               found type `()`
 
 error[E0308]: mismatched types
-  --> $DIR/issue-17283.rs:37:8
+  --> $DIR/assignment-in-if.rs:37:8
    |
 37 |     if y = (Foo { foo: x }) {
    |        ^^^^^^^^^^^^^^^^^^^^
@@ -35,7 +35,7 @@ error[E0308]: mismatched types
               found type `()`
 
 error[E0308]: mismatched types
-  --> $DIR/issue-17283.rs:43:8
+  --> $DIR/assignment-in-if.rs:43:8
    |
 43 |     if 3 = x {
    |        ^^^^^
@@ -46,5 +46,14 @@ error[E0308]: mismatched types
    = note: expected type `bool`
               found type `()`
 
+error[E0308]: mismatched types
+  --> $DIR/assignment-in-if.rs:48:8
+   |
+48 |     if (if true { x = 4 } else { x = 5 }) {
+   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bool, found ()
+   |
+   = note: expected type `bool`
+              found type `()`
+
 error: aborting due to previous error(s)