File tree Expand file tree Collapse file tree 4 files changed +38
-2
lines changed
src/compiler/scala/tools/nsc/typechecker Expand file tree Collapse file tree 4 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -426,6 +426,7 @@ trait MethodSynthesis {
426
426
// spot that brand of them. In other words it's an artifact of the implementation.
427
427
val tpt = derivedSym.tpe.finalResultType match {
428
428
case ExistentialType (_, _) => TypeTree ()
429
+ case _ if mods.isDeferred => TypeTree ()
429
430
case tp => TypeTree (tp)
430
431
}
431
432
tpt setPos derivedSym.pos.focus
Original file line number Diff line number Diff line change @@ -5368,8 +5368,14 @@ trait Typers extends Modes with Adaptations with Tags {
5368
5368
}
5369
5369
5370
5370
def typedTypeTree (tree : TypeTree ) = {
5371
- if (tree.original != null )
5372
- tree setType typedType(tree.original, mode).tpe
5371
+ if (tree.original != null ) {
5372
+ val newTpt = typedType(tree.original, mode)
5373
+ tree setType newTpt.tpe
5374
+ newTpt match {
5375
+ case tt @ TypeTree () => tree setOriginal tt.original
5376
+ case _ => tree
5377
+ }
5378
+ }
5373
5379
else
5374
5380
// we should get here only when something before failed
5375
5381
// and we try again (@see tryTypedApply). In that case we can assign
Original file line number Diff line number Diff line change
1
+ {
2
+ abstract trait Foo extends AnyRef {
3
+ <stable> <accessor> def a: Int
4
+ };
5
+ ()
6
+ }
7
+ {
8
+ abstract trait Foo extends AnyRef {
9
+ <stable> <accessor> def a: Int
10
+ };
11
+ ()
12
+ }
Original file line number Diff line number Diff line change
1
+ import scala .reflect .runtime .universe ._
2
+ import scala .reflect .runtime .{currentMirror => cm }
3
+ import scala .tools .reflect .ToolBox
4
+
5
+ object Test extends App {
6
+ // test 1: reify
7
+ val tree = reify{ trait Foo { val a : Int } }.tree
8
+ println(tree.toString)
9
+
10
+ // test 2: import and typecheck
11
+ val toolbox = cm.mkToolBox()
12
+ val ttree = toolbox.typeCheck(tree)
13
+ println(ttree.toString)
14
+
15
+ // test 3: import and compile
16
+ toolbox.eval(tree)
17
+ }
You can’t perform that action at this time.
0 commit comments