Update tests for `()` notation to use traits not structs

This commit is contained in:
Niko Matsakis 2014-11-15 19:10:08 -05:00
parent 5a28d178af
commit 7a846b86a8
6 changed files with 23 additions and 21 deletions

View File

@ -14,13 +14,13 @@
#![feature(default_type_params, unboxed_closures)]
#![allow(dead_code)]
struct Foo<T,U,V=T> {
t: T, u: U
trait Foo<T,U,V=T> {
fn dummy(&self, t: T, u: U, v: V);
}
trait Eq<X> { }
impl<X> Eq<X> for X { }
fn eq<A,B:Eq<A>>() { }
trait Eq<Sized? X> for Sized? { }
impl<Sized? X> Eq<X> for X { }
fn eq<Sized? A,Sized? B>() where A : Eq<B> { }
fn test<'a,'b>() {
// Parens are equivalent to omitting default in angle.

View File

@ -17,15 +17,14 @@
use std::kinds::marker;
struct Foo<'a,T,U> {
t: T,
u: U,
m: marker::InvariantLifetime<'a>
trait Foo<'a,T,U> {
fn dummy(&'a self) -> &'a (T,U);
}
trait Eq<X> { }
impl<X> Eq<X> for X { }
fn eq<A,B:Eq<A>>() { }
trait Eq<Sized? X> for Sized? { }
impl<Sized? X> Eq<X> for X { }
fn eq<Sized? A,Sized? B:Eq<A>>() { }
fn same_type<A,B:Eq<A>>(a: A, b: B) { }
fn test<'a,'b>() {
@ -34,10 +33,10 @@ fn test<'a,'b>() {
// Here we specify 'static explicitly in angle-bracket version.
// Parenthesized winds up getting inferred.
eq::< Foo<'static, (int,),()>, Foo(int) >();
eq::< Foo<'static, (int,),()>, Foo(int) >();
}
fn test2(x: Foo<(int,),()>, y: Foo(int)) {
fn test2(x: &Foo<(int,),()>, y: &Foo(int)) {
// Here, the omitted lifetimes are expanded to distinct things.
same_type(x, y) //~ ERROR cannot infer
}

View File

@ -8,10 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
struct One<A>;
#![feature(unboxed_closures)]
fn foo(_: One()) //~ ERROR wrong number of type arguments
trait One<A> { fn foo(&self) -> A; }
fn foo(_: &One()) //~ ERROR wrong number of type arguments
{}
fn main() { }

View File

@ -8,10 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
struct Three<A,B,C>;
#![feature(unboxed_closures)]
fn foo(_: Three()) //~ ERROR wrong number of type arguments
trait Three<A,B,C> { fn dummy(&self) -> (A,B,C); }
fn foo(_: &Three()) //~ ERROR wrong number of type arguments
{}
fn main() { }

View File

@ -8,9 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
struct Zero;
#![feature(unboxed_closures)]
trait Zero { fn dummy(&self); }
fn foo(_: Zero()) //~ ERROR wrong number of type arguments
{}

View File

@ -15,8 +15,8 @@
#![allow(dead_code)]
struct Foo<T,U> {
t: T, u: U
trait Foo<T,U> {
fn dummy(&self) -> (T,U);
}
trait Eq<X> { }