pp: also print bounds in paths with no generic params

Since 3b6314c3 the pretty printer seems to only print trait bounds for
`ast::ty_path(...)`s that have a generics arguments list. That seems
wrong, so let's always print them.

Closes #9253, un-xfails test for #7673.
This commit is contained in:
Benjamin Herr 2013-09-17 22:13:47 +02:00
parent aa406c151e
commit 823ebb14ba
3 changed files with 20 additions and 9 deletions

View File

@ -1535,15 +1535,15 @@ fn print_path_(s: @ps,
print_ident(s, segment.identifier);
if segment.lifetime.is_some() || !segment.types.is_empty() {
// If this is the last segment, print the bounds.
if i == path.segments.len() - 1 {
match *opt_bounds {
None => {}
Some(ref bounds) => print_bounds(s, bounds, true),
}
// If this is the last segment, print the bounds.
if i == path.segments.len() - 1 {
match *opt_bounds {
None => {}
Some(ref bounds) => print_bounds(s, bounds, true),
}
}
if segment.lifetime.is_some() || !segment.types.is_empty() {
if colons_before_params {
word(s.s, "::")
}

View File

@ -0,0 +1,13 @@
// pp-exact
trait Tr { }
impl Tr for int;
fn foo(x: ~Tr: Freeze) -> ~Tr: Freeze { x }
fn main() {
let x: ~Tr: Freeze;
~1 as ~Tr: Freeze;
}

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// xfail-pretty #9253 pretty printer doesn't preserve the bounds on trait objects
/*
#7673 Polymorphically creating traits barely works