File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed
compiler/src/dotty/tools/dotc/transform/init Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,8 @@ object Potentials {
140
140
141
141
def (ps : Potentials ) select (symbol : Symbol , source : Tree )(implicit ctx : Context ): Summary =
142
142
ps.foldLeft(Summary .empty) { case ((pots, effs), pot) =>
143
+ // max potential length
144
+ // TODO: it can be specified on a project basis via compiler options
143
145
if (pot.size > 2 )
144
146
(pots, effs + Leak (pot)(source))
145
147
else if (symbol.isConstructor)
Original file line number Diff line number Diff line change @@ -100,7 +100,8 @@ object Summarization {
100
100
}
101
101
102
102
case Typed (expr, tpt) =>
103
- analyze(expr)
103
+ if (tpt.tpe.hasAnnotation(defn.UncheckedAnnot )) Summary .empty
104
+ else analyze(expr)
104
105
105
106
case NamedArg (name, arg) =>
106
107
analyze(arg)
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ trait LazyList[+A] {
7
7
}
8
8
9
9
object LazyList {
10
- inline implicit def toHelper [A ](l : => LazyList [A ]): Helper [A ] = new Helper (l)
10
+ implicit def toHelper [A ](l : => LazyList [A ]): Helper [A ] = new Helper (l)
11
11
final class Helper [A ](l : => LazyList [A ]) {
12
12
def #:: [B >: A ](elem : => B ): LazyList [B ] = new LazyList [B ] {
13
13
override def isEmpty : Boolean = false
@@ -21,7 +21,7 @@ import LazyList._
21
21
22
22
final class Test1 {
23
23
lazy val a : LazyList [Int ] = 5 #:: b
24
- val b : LazyList [Int ] = 10 #:: a
24
+ lazy val b : LazyList [Int ] = 10 #:: a
25
25
26
26
a.head // ok
27
27
b.head // ok
@@ -33,11 +33,11 @@ final class Test1 {
33
33
final class Test2 {
34
34
lazy val a : LazyList [Int ] = 5 #:: b
35
35
lazy val b : LazyList [Int ] = 10 #:: 30 #:: c
36
- val c : LazyList [Int ] = 20 #:: a
36
+ lazy val c : LazyList [Int ] = 20 #:: a
37
37
}
38
38
39
39
final class Test3 {
40
- val a : LazyList [Int ] = n #:: a
40
+ val a : LazyList [Int ] = n #:: ( a : @ unchecked)
41
41
a.head
42
42
val n : Int = 20 // error
43
43
}
You can’t perform that action at this time.
0 commit comments