Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type parameter types cannot be used in associated type selection #38

Open
osa1 opened this issue Jan 4, 2025 · 0 comments
Open

Type parameter types cannot be used in associated type selection #38

osa1 opened this issue Jan 4, 2025 · 0 comments

Comments

@osa1
Copy link
Member

osa1 commented Jan 4, 2025

trait Default[T]:
    fn def(): T

type A:
    A1
    A2

impl Default for A:
    fn def(): A = A.A1

fn f1[X: Default](): X = X.def()

fn main() =
    let x = f1()
    match x:
        A.A1: printStr("A.A1")
        A.A2: printStr("A.A2")

Output:

tests/TcMatch1.fir:11:26: Unknown type X
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant