Skip to content

Calling default methods on type parameters that are type parameterized traits does not work #4102

Closed
@brson

Description

@brson

Up-to-date (forward-ported) test case

trait A<T> {
    fn g(x: T) -> T { x }
}

impl A<int> for int { }

fn f<T, V: A<T>>(i: V, j: T) -> T {
    i.g(j)
}

fn main () {
    fail_unless!(f(0, 2) == 2);
}

Original Report

This assumes #4101 is merged. Fails in trans because substs for the parameterized trait A are not handled correctly.

trait A<T> {
    fn g(x: T) -> T { move x }
}

impl int: A<int> { }

fn f<T, V: A<T>>(i: V, j: T) -> T {
    i.g(move j)
}

fn main () {
    assert f(0, 2) == 2;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions