-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed as not planned
Labels
area:match-typesarea:typeritype:bugstat:fixed in nextThe issue was fixed in Next and only still applies to LTS.The issue was fixed in Next and only still applies to LTS.
Description
Compiler version
3.3.4
Minimized code
doesn't work:
trait Foo {
type T <: Tuple
type Mapped = Tuple.Map[T, Option]
def map[A](f: Mapped => A): Unit = ???
}
class Bar extends Foo {
override type T = (Int, String)
// doesn't compile
map { (int, string) =>
()
}
}
works:
trait Foo {
type T <: Tuple
def map[A](f: Tuple.Map[T, Option] => A): Unit = ???
}
class Bar extends Foo {
override type T = (Int, String)
// compiles fine
map { (int, string) =>
()
}
}
Output
-- [E086] Syntax Error: .../Test.scala:39:22
39 | map { (int, string) =>
| ^
| Wrong number of parameters, expected: 1
40 | ()
|----------------------------------------------------------------------------
| Explanation (enabled by `-explain`)
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| The function literal
|
| (int, string) =>
| {
| ()
| }
|
| has 2 parameters. But the expected type
|
| Bar.this.Map => Unit
|
| requires a function with 1 parameters.
----------------------------------------------------------------------------
one error found
Expectation
I expect parameter untupling to occur regardless of type indirection, as long as the type can be fully resolved where the parameter untupling should occur. Instead, parameter untupling does not always occur. I think the alias and the match
type are both playing a role here: simply having two aliases that refer to a concrete tuple type (type T = (Int, String)
, type X = T
) does not prevent parameter untupling
Metadata
Metadata
Assignees
Labels
area:match-typesarea:typeritype:bugstat:fixed in nextThe issue was fixed in Next and only still applies to LTS.The issue was fixed in Next and only still applies to LTS.