2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2015-01-08 10:25:52 -06:00
|
|
|
// Check that coercions unify the expected return type of a polymorphic
|
|
|
|
// function call, instead of leaving the type variables as they were.
|
|
|
|
|
2015-03-22 15:13:15 -05:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2015-01-08 10:25:52 -06:00
|
|
|
struct Foo;
|
|
|
|
impl Foo {
|
|
|
|
fn foo<T>(self, x: T) -> Option<T> { Some(x) }
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
let _: Option<fn()> = Some(main);
|
|
|
|
let _: Option<fn()> = Foo.foo(main);
|
|
|
|
|
|
|
|
// The same two cases, with implicit type variables made explicit.
|
|
|
|
let _: Option<fn()> = Some::<_>(main);
|
|
|
|
let _: Option<fn()> = Foo.foo::<_>(main);
|
|
|
|
}
|