Skip to content

regression in type inference of match-defined partial function  #6925

@scabug

Description

@scabug

As of scala/scala@28483739c3 this infers different types with and without -Xoldpatmat:

% scala210
Welcome to Scala version 2.10.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_10).
Type in expressions to have them evaluated.
Type :help for more information.

scala> def f[T](xs: Set[T]) = xs collect { case x => x }
f: [T](xs: Set[T])scala.collection.immutable.Set[_ <: T]
% scala210 -Xoldpatmat
Welcome to Scala version 2.10.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_10).
Type in expressions to have them evaluated.
Type :help for more information.

scala> def f[T](xs: Set[T]) = xs collect { case x => x }
f: [T](xs: Set[T])scala.collection.immutable.Set[T]

It's a large change not to be mentioned in the commit message - is it unintentional? I assume it's not intentional that it's in one pattern matcher and not the other.

commit 28483739c3
Author: Adriaan Moors adriaan.moors@epfl.ch
Date: 9 months ago

restore typedMatchAnonFun in all its glory

detect partialfunction in cpsannotationchecker
emit apply/isDefinedAt if PF has @cps targs (applyOrElse can't be typed)
further hacky improvements to selective anf
better try/catch support in selective cps using freshly minted anonfun match
make virtpatmat resilient to scaladoc (after uncurry, don't translate matches
 TODO: factor out translation all together so presentation compiler/scaladoc can skip it)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions