Skip to content

Regression in match types combined with type lambda #19710

Closed
@WojciechMazur

Description

@WojciechMazur

Based on forum post: https://users.scala-lang.org/t/scala-3-how-do-we-make-a-lambda-type-conform-to-a-subtype/9805

Compiler version

3.3.1
Last good release: 3.3.1-RC1-bin-20230514-b0ccf40-NIGHTLY
First bad release: 3.3.1-RC1-bin-20230515-22b2259-NIGHTLY
Bisect points to d1d6c2e

Minimized code

import scala.util.NotGiven

type HasName1 = [n] =>> [x] =>> x match {
    case n => true
    case _ => false
  }
@main def Test = {
  summon[HasName1["foo"]["foo"] =:= true]
  summon[NotGiven[HasName1["foo"]["bar"] =:= true]]
  summon[Tuple.Filter[(1, "foo", 2, "bar"), HasName1["foo"]] =:= Tuple1["foo"]] // error
}

Output

-- [E057] Type Mismatch Error: /Users/wmazur/projects/dotty/bisect/main.scala:10:44 
10 |  summon[Tuple.Filter[(1, "foo", 2, "bar"), HasName1["foo"]] =:= Tuple1["foo"]]
   |                                            ^
   |Type argument HasName1[("foo" : String)] does not conform to upper bound [_] =>> Boolean
   |
   |Note: a match type could not be fully reduced:
   |
   |  trying to reduce  HasName1[("foo" : String)]
   |
   | longer explanation available when compiling with `-explain`
1 error found

Expectation

Should comile (probably)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions