noir-lang / noir

Noir is a domain specific language for zero knowledge proofs
https://noir-lang.org
Apache License 2.0
887 stars 196 forks source link

Support specifying generics on a type when calling an associated function #6000

Closed TomAFrench closed 1 week ago

TomAFrench commented 2 months ago

We currently do not allow applying a turbofish to a struct type, attempting to do so will result in a UnsupportedTurbofishUsage error

struct Foo<T> {
    x: T
}

impl <T> Foo<T> {
    fn new(x: T) -> Self {
        Foo { x }
    }
}

fn main() {
    let _ = Foo::<i32>::new(1);
}

We should implement support for the turbofish syntax in this situation.

asterite commented 1 month ago

I think this is a duplicate of #5584

I added support for parsing the turbofishes in the middle of paths but implementing this particular case is kind of tricky.