File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
src/reflect/scala/reflect/internal Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -788,6 +788,7 @@ abstract class TreeInfo {
788
788
case Apply (f, _) => hasExplicitUnit(f)
789
789
case TypeApply (f, _) => hasExplicitUnit(f)
790
790
case AppliedTypeTree (f, _) => hasExplicitUnit(f)
791
+ case Block (_, expr) => hasExplicitUnit(expr)
791
792
case _ => false
792
793
}
793
794
}
Original file line number Diff line number Diff line change @@ -25,3 +25,38 @@ final class UnusedTest {
25
25
26
26
def u : Unit = f : Unit // nowarn
27
27
}
28
+
29
+ class UnitAscription {
30
+ import scala .concurrent ._ , ExecutionContext .Implicits ._
31
+
32
+ case class C (c : Int ) {
33
+ def f (i : Int , j : Int = c) = i + j
34
+ }
35
+
36
+ def f (i : Int , j : Int = 27 ) = i + j
37
+
38
+ def g [A ]: List [A ] = Nil
39
+
40
+ def i : Int = 42
41
+
42
+ def `default arg is inline` : Unit =
43
+ f(i = 42 ): Unit // nowarn
44
+
45
+ def `default arg requires block` : Unit =
46
+ C (27 ).f(i = 42 ): Unit // nowarn
47
+
48
+ def `application requires implicit arg` : Unit =
49
+ Future (42 ): Unit // nowarn
50
+
51
+ def `application requires inferred type arg` : Unit =
52
+ g : Unit // nowarn
53
+
54
+ def `implicit selection from this` : Unit =
55
+ i : Unit // nowarn
56
+ }
57
+
58
+ object UnitAscription {
59
+ def g [A ]: List [A ] = Nil
60
+ def `application requires inferred type arg` : Unit =
61
+ g : Unit // nowarn UnitAscription.g
62
+ }
You can’t perform that action at this time.
0 commit comments