ethereum / fe

Emerging smart contract language for the Ethereum blockchain.
https://fe-lang.org
Other
1.6k stars 178 forks source link

Add support for specifying generic arg in path segment #988

Open Y-Nak opened 6 months ago

Y-Nak commented 6 months ago

Currently, it's not allowed to specify type args for each path segment. This problem makes it impossible to call methods in some cases. e.g.,

struct Foo<T> {
    t: T
}

impl<T> Foo<T> {
    fn method() -> i32 {
        1
    }
}

fn foo() {
    // Deciding the `Foo` type is not possible without a type argument for `Foo`.
    let x = Foo::method()

    // We need this! 
    let x = Foo<i32>::method()
}