Skip to content

Unsound elimination of function calls in paths #21795

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

Closed
EugeneFlesselle opened this issue Oct 16, 2024 · 1 comment
Closed

Unsound elimination of function calls in paths #21795

EugeneFlesselle opened this issue Oct 16, 2024 · 1 comment
Labels
itype:bug itype:soundness Soundness bug (it lets us compile code that crashes at runtime with a ClassCastException)

Comments

@EugeneFlesselle
Copy link
Contributor

Compiler version

3.6.1-RC1

Minimized code

@main def Test =

  trait A:
    type B >: Int <: Boolean

  def f(using a: A): a.type = a
  given a[X]: A = a

  val _: Boolean = 1 : f.B // ClassCastException

Note the dummy parameter X is necessary for a to be a def.

Expectation

Function calls used in paths should be evaluated, along with their arguments, even if they have singleton return types. We get the usual bad bounds problem otherwise.

@EugeneFlesselle EugeneFlesselle added itype:bug itype:soundness Soundness bug (it lets us compile code that crashes at runtime with a ClassCastException) labels Oct 16, 2024
@EugeneFlesselle
Copy link
Contributor Author

Ah I just saw #21788, moving this minimization there.

@EugeneFlesselle EugeneFlesselle closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
itype:bug itype:soundness Soundness bug (it lets us compile code that crashes at runtime with a ClassCastException)
Projects
None yet
Development

No branches or pull requests

1 participant