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

Give warning when two type parameters cannot be inequal #279

Open
6 tasks
MeAmAnUsername opened this issue Mar 29, 2022 · 0 comments
Open
6 tasks

Give warning when two type parameters cannot be inequal #279

MeAmAnUsername opened this issue Mar 29, 2022 · 0 comments
Labels
Component: editor Priority: low Status: proposal Enhancement in the proposal stage Type: enhancement New feature or request

Comments

@MeAmAnUsername
Copy link
Owner

Summary
Give warning when two type parameters cannot be inequal

Todo

  • Figure out general rules when constraints do not have multiple solutions
    • Find more examples of places where there is only one solution
    • Minimize examples
    • Figure out general rules when constraints do not have multiple solutions
  • Write tests (use minimized examples)
  • Implement

Reason
Having multiple type parameters is useless if the only possible instantiations give them both the same type, so it should give a warning when detected.

Examples
From data_def_generics.spt. Don't know for sure if these can only be instantiated when T=R, but seems so to me.

data Foo0[ T <: Foo0[ R, R ], R <: Foo0[ T, R ] ] = foreign java Foo {}

data Foo1[T <: Foo1[R, T], R <: Foo1[T, R]] = foreign java Foo {}
data Foo2[T <: Foo2[R, T], R <: Foo2[R, T]] = foreign java Foo {}
data Foo3[T <: Foo3[T, R], R <: Foo3[R, R]] = foreign java Foo {}
data Foo4[R <: Foo4[T, R], T <: Foo4[R, R]] = foreign java Foo {}
data Foo5[T <: Foo5[R, R], R <: Foo5[T, R]] = foreign java Foo {}
data Foo6[T <: Foo6[T, T], R <: Foo6[T, R]] = foreign java Foo {}
data Foo7[T <: Foo7[T, T], R <: Foo7[R, R]] = foreign java Foo {}
data Foo8[T <: Foo8[R, R], R <: Foo8[R, T]] = foreign java Foo {}
data Foo9[T <: Foo9[T, R], R <: Foo9[T, R]] = foreign java Foo {}
@MeAmAnUsername MeAmAnUsername added Type: enhancement New feature or request Status: proposal Enhancement in the proposal stage Priority: low Component: editor labels Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: editor Priority: low Status: proposal Enhancement in the proposal stage Type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant