Skip to content

Commit 68b8f50

Browse files
committed
Harden hasInnerErrors and fix tests
1 parent ea8d8b6 commit 68b8f50

File tree

7 files changed

+15
-29
lines changed

7 files changed

+15
-29
lines changed

compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,8 @@ object ProtoTypes {
361361
case closureDef(mdef) => hasInnerErrors(mdef.rhs)
362362
case _ =>
363363
t.existsSubTree { t1 =>
364-
if t1.tpe.isError && t1.span.toSynthetic != t.span.toSynthetic then
365-
typr.println(i"error subtree $t1 of $t with ${t1.tpe}, spans = ${t1.span}, ${t.span}")
364+
if t1.typeOpt.isError && t1.span.toSynthetic != t.span.toSynthetic then
365+
typr.println(i"error subtree $t1 of $t with ${t1.typeOpt}, spans = ${t1.span}, ${t.span}")
366366
true
367367
else
368368
false

tests/neg/i903.check

-7
This file was deleted.

tests/neg/i903.scala

-4
This file was deleted.

tests/neg/zipped.check

-11
This file was deleted.

tests/neg/zipped.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
object Test {
22
val xs: List[Int] = ???
33

4-
// Does not work anynore since auto(un)tupling does not work after conversions
54
xs.lazyZip(xs).lazyZip(xs)
6-
.map( (x: (Int, Int, Int)) => x match { case (x, y, z) => x + y + z }) // error
5+
.map( (x: (Int, Int, Int)) => x match { case (x, y, z) => x + y + z }) // ok
76

87
xs.lazyZip(xs).lazyZip(xs)
98
.map( x => x match { case (x, y, z) => x + y + z }) // error

tests/pos/i903.scala

+8
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,12 @@ object Test {
1515
// f.apply(0)
1616
// ^
1717
}
18+
19+
def test2 = {
20+
val f = "".contains("", (_: Int)) // dotc:
21+
f.apply(0)
22+
// sandbox/eta.scala:18: error: apply is not a member of Boolean(f)
23+
// f.apply(0)
24+
// ^
25+
}
1826
}

tests/pos/zipped.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ object Test {
2323
.map( (x: Int, y: Int, z: Int) => x + y + z ) // OK
2424

2525
// 4. The single parameter map works through an inserted conversion
26-
//xs.lazyZip(xs).lazyZip(xs)
27-
// .map( (x: (Int, Int, Int)) => x match { case (x, y, z) => x + y + z }) // now also OK
26+
xs.lazyZip(xs).lazyZip(xs)
27+
.map( (x: (Int, Int, Int)) => x match { case (x, y, z) => x + y + z }) // now also OK
2828

29-
// 5. If we leave out the parameter type, it now works as well.
29+
// 5. But if that pone is deeper nested, it does not work since we don't retypecheck
30+
// arguments deeply.
3031
//xs.lazyZip(xs).lazyZip(xs)
3132
// .map( x => x match { case (x, y, z) => x + y + z }) // now also OK
3233

0 commit comments

Comments
 (0)