Skip to content

Wrong compiler error when no given was found for intersection type #22846

Open
@road21

Description

@road21

Compiler version

3.3.5, 3.6.3

Minimized code

trait TCl[A]
trait TCl2[A]

type Ctx

given [R]: TCl[R & Ctx] = null
//given [R]: TCl2[R & Ctx] = null // compiles ok when this line is uncommented

def lol[A: TCl: TCl2](foo: Unit = ()): Any = () // default argument is important (without it it doesn't reproduce)

lol[Int & Ctx]()

Output

Compiler error:

Found:    Playground.TCl[R & Ctx]
Required: Playground.TCl[Int & Ctx]

Expectation

Compiler error:

No given instance of type TCl2[Int & Ctx] was found

Scastie:
https://scastie.scala-lang.org/road21/dFsqemp3TWSVfNYn8JDk3A/1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions