Skip to content

Commit 4f675c3

Browse files
authored
Merge pull request #1659 from dotty-staging/fix-#1640
Fix #1640: Avoid applications with untyped function parts
2 parents 913f76a + ed3f586 commit 4f675c3

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
591591
}
592592

593593
fun1.tpe match {
594-
case ErrorType => tree.withType(ErrorType)
594+
case ErrorType => untpd.cpy.Apply(tree)(fun1, tree.args).withType(ErrorType)
595595
case TryDynamicCallType => typedDynamicApply(tree, pt)
596596
case _ =>
597597
tryEither {

tests/neg/i1640.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
object Test extends App {
2+
List(1, 2, 3) map (_ match { case x => x + 1 })
3+
List((1, 2)) x (_ match { case (x, z) => x + z }) // error
4+
}

tests/neg/i1641.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package bar { object bippy extends (Double => String) { def apply(x: Double): String = "Double" } }
2+
package object println { def bippy(x: Int, y: Int, z: Int) = "(Int, Int, Int)" }
3+
object Test {
4+
def main(args: Array[String]): Unit = {
5+
println(bar.bippy(5.5))
6+
println(bar.bippy(1, 2, 3)) // error
7+
}
8+
}

0 commit comments

Comments
 (0)