Skip to content

Type inference failure for type variable in intersection type #12077

Closed
@heaven-born

Description

@heaven-born

Compiler version

2.13.5 and 3.0.0-RC2

Minimized code

This code compiles in 2.13.5 but not in 3.0.0-RC2.

    trait Wrapper[K]
    trait Has0[T]
    
    def test[R](v: Wrapper[Has0[String] with R]):R = ???

    val zz:Wrapper[Has0[String] with Has0[Int]] = ???
    test(zz)

Output

Error in 3.0.0-RC2

Found:    (zz : Wrapper[Has0[String] & Has0[Int]])
Required: Wrapper[Has0[String] & R]

where:    R is a type variable

      test(zz)

Expectation

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogNo work planned on this by the core team for the time being.compat:scala2itype:bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions