File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
src/dotty/tools/dotc/transform/init Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,13 @@ package init
4
4
5
5
import core ._
6
6
import Contexts .Context
7
- import ast .tpd ._
8
7
import Decorators ._
8
+ import StdNames ._
9
9
import Symbols ._
10
10
import Constants .Constant
11
11
import Types ._
12
+
13
+ import ast .tpd ._
12
14
import config .Printers .init
13
15
import reporting .trace
14
16
@@ -26,6 +28,10 @@ object Summarization {
26
28
def analyze (expr : Tree )(implicit env : Env ): Summary =
27
29
trace(" summarizing " + expr.show, init, s => Summary .show(s.asInstanceOf [Summary ])) {
28
30
val summary : Summary = expr match {
31
+ case Ident (nme.WILDCARD ) =>
32
+ // TODO: disallow `var x: T = _`
33
+ Summary .empty
34
+
29
35
case Ident (name) =>
30
36
assert(name.isTermName, " type trees should not reach here" )
31
37
analyze(expr.tpe, expr)
@@ -229,7 +235,10 @@ object Summarization {
229
235
val thisRef = ThisRef (thisTp.classSymbol.asClass)(source)
230
236
val pot = SuperRef (thisRef, superTp.classSymbol.asClass)(source)
231
237
Summary .empty + pot
232
- }
238
+
239
+ case _ =>
240
+ throw new Exception (" unexpected type: " + tp.show)
241
+ }
233
242
234
243
if (env.isAlwaysInitialized(tp)) (Potentials .empty, summary._2)
235
244
else summary
Original file line number Diff line number Diff line change @@ -299,10 +299,7 @@ class CompilationTests extends ParallelTesting {
299
299
@ Test def checkInitNeg : Unit = {
300
300
implicit val testGroup : TestGroup = TestGroup (" checkInit" )
301
301
val options = defaultOptions.and(" -Ycheck-init" , " -Xfatal-warnings" )
302
- aggregateTests(
303
- compileFilesInDir(" tests/init/neg/" , options),
304
- compileFilesInDir(" tests/init/crash" , options),
305
- )
302
+ compileFilesInDir(" tests/init/neg/" , options)
306
303
}.checkExpectedErrors()
307
304
308
305
@ Test def checkInitCrash : Unit = {
You can’t perform that action at this time.
0 commit comments