Skip to content

Slack LUBs fail to capture constraints between type parameters and blow up in RefChecks if used in a TypeTree #7694

Closed
@scabug

Description

@scabug
trait A
trait B

trait L[A2, B2 <: A2]

object Lub {
  def lub = if (true) (null: L[A, A]) else (null: L[B, B])
  def foo(a: Any, b: Any) = (a, b)
  foo(b = lub, a = lub) // use named args transforms to include TypeTree(<lub.tpe>
}
<console>:13: error: type arguments [_1,_2] do not conform to trait L's type parameter bounds [A2,B2 <: A2]
         foo(b = lub, a = lub) // use named args transforms to include TypeTree(<lub.tpe>
                 ^

I suspect calculating the correct LUB will be to difficult, and we should instead disable the check for synthetic TypeTrees.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions