diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-10-27 17:14:09 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-10-30 15:05:32 -0700 |
| commit | 62f98c8ff8179c9754718e62285b82b50dfcfe26 (patch) | |
| tree | c3db0a950f995408ea390f1b1952a24d2b982940 /src/test | |
| parent | 17a5d0f3a0a76e172777456cc0f5ed8318149e33 (diff) | |
| download | rust-62f98c8ff8179c9754718e62285b82b50dfcfe26.tar.gz rust-62f98c8ff8179c9754718e62285b82b50dfcfe26.zip | |
Preserve parenthesization in the AST
Maintain explicit "paren" nodes in the AST so we can pretty-print without having to guess where parens should go. We may revisit this in the future. r=graydon
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/trait-cast.rs | 3 | ||||
| -rw-r--r-- | src/test/run-fail/zip-different-lengths.rs | 8 | ||||
| -rw-r--r-- | src/test/run-pass/syntax-extension-source-utils.rs | 6 |
3 files changed, 10 insertions, 7 deletions
diff --git a/src/test/compile-fail/trait-cast.rs b/src/test/compile-fail/trait-cast.rs index 9e15a31d95a..43c16984bb6 100644 --- a/src/test/compile-fail/trait-cast.rs +++ b/src/test/compile-fail/trait-cast.rs @@ -3,6 +3,9 @@ trait foo<T> { } fn bar(x: foo<uint>) -> foo<int> { return (x as foo::<int>); //~^ ERROR mismatched types: expected `@foo<int>` but found `@foo<uint>` + //~^^ ERROR mismatched types: expected `@foo<int>` but found `@foo<uint>` + // This is unfortunate -- new handling of parens means the error message + // gets printed twice } fn main() {} diff --git a/src/test/run-fail/zip-different-lengths.rs b/src/test/run-fail/zip-different-lengths.rs index c6239c1f657..fa91049e3ae 100644 --- a/src/test/run-fail/zip-different-lengths.rs +++ b/src/test/run-fail/zip-different-lengths.rs @@ -8,7 +8,7 @@ fn enum_chars(start: u8, end: u8) -> ~[char] { assert start < end; let mut i = start; let mut r = ~[]; - while i <= end { r.push(i as char); i += 1u as u8; } + while i <= end { r.push(i as char); i += 1 as u8; } return r; } @@ -16,16 +16,16 @@ fn enum_uints(start: uint, end: uint) -> ~[uint] { assert start < end; let mut i = start; let mut r = ~[]; - while i <= end { r.push(i); i += 1u; } + while i <= end { r.push(i); i += 1; } return r; } fn main() { - let a = 'a' as u8, j = 'j' as u8, k = 1u, l = 9u; + let a = 'a' as u8, j = 'j' as u8, k = 1, l = 9; let chars = enum_chars(a, j); let ints = enum_uints(k, l); - assert (same_length(chars, ints)); + assert same_length(chars, ints); let ps = zip(chars, ints); fail ~"the impossible happened"; } diff --git a/src/test/run-pass/syntax-extension-source-utils.rs b/src/test/run-pass/syntax-extension-source-utils.rs index 1704047a48f..7afb74fa121 100644 --- a/src/test/run-pass/syntax-extension-source-utils.rs +++ b/src/test/run-pass/syntax-extension-source-utils.rs @@ -11,10 +11,10 @@ mod m1 { } fn main() { - assert(line!() == 14u); - assert(col!() == 11u); + assert(line!() == 14); + assert(col!() == 11); assert(file!().ends_with(~"syntax-extension-source-utils.rs")); - assert(stringify!((2*3) + 5) == ~"2 * 3 + 5"); + assert(stringify!((2*3) + 5) == ~"(2 * 3) + 5"); assert(include!("syntax-extension-source-utils-files/includeme.fragment") == ~"victory robot 6"); |
