File tree 2 files changed +43
-43
lines changed
2 files changed +43
-43
lines changed Original file line number Diff line number Diff line change 1
1
Testing Symbol.isAbstract...
2
2
=======class C=======
3
- class C => true
4
- constructor C => false
5
- value x1 => true
6
- value x2 => false
7
- value x2 => false
8
- method y1 => true
9
- method y2 => false
10
- type T1 => true
11
- type T2 => false
3
+ class C => abstract
4
+ constructor C => concrete
5
+ value xAbs => abstract
6
+ value x => concrete
7
+ value x => concrete
8
+ method yAbs => abstract
9
+ method y => concrete
10
+ type TAbs => abstract
11
+ type T => concrete
12
12
=======trait T=======
13
- trait T => true
14
- method $init$ => false
15
- value z1 => true
16
- value z2 => true
17
- method w1 => true
18
- method w2 => false
19
- type U1 => true
20
- type U2 => false
21
- method T$_setter_$z2_ = => true
22
- =======class D =======
23
- class D => false
24
- constructor D => false
25
- value x1 => false
26
- value x1 => false
27
- method y1 => false
13
+ trait T => abstract
14
+ method $init$ => concrete
15
+ value zAbs => abstract
16
+ value z => concrete
17
+ method wAbs => abstract
18
+ method w => concrete
19
+ type UAbs => abstract
20
+ type U => concrete
21
+ method T$_setter_$z_ = => abstract
22
+ =======class AllConcrete =======
23
+ class AllConcrete => concrete
24
+ constructor AllConcrete => concrete
25
+ value xAbs => concrete
26
+ value xAbs => concrete
27
+ method yAbs => concrete
28
28
=======object M=======
29
- object M => false
30
- constructor M => false
29
+ object M => concrete
30
+ constructor M => concrete
Original file line number Diff line number Diff line change 1
1
import scala .reflect .runtime .universe ._
2
2
3
3
abstract class C {
4
- val x1 : Int
5
- val x2 : Int = 2
6
- def y1 : Int
7
- def y2 : Int = 2
8
- type T1 <: Int
9
- type T2 = Int
4
+ val xAbs : Int
5
+ val x : Int = 2
6
+ def yAbs : Int
7
+ def y : Int = 2
8
+ type TAbs <: Int
9
+ type T = Int
10
10
}
11
11
trait T {
12
- val z1 : Int
13
- val z2 : Int = 2
14
- def w1 : Int
15
- def w2 : Int = 2
16
- type U1 <: Int
17
- type U2 = Int
12
+ val zAbs : Int
13
+ val z : Int = 2
14
+ def wAbs : Int
15
+ def w : Int = 2
16
+ type UAbs <: Int
17
+ type U = Int
18
18
}
19
- class D extends C {
20
- val x1 = 3
21
- def y1 = 3
19
+ class AllConcrete extends C {
20
+ val xAbs = 3
21
+ def yAbs = 3
22
22
}
23
23
object M
24
24
@@ -27,12 +27,12 @@ object Test extends App {
27
27
def test [T : TypeTag ] = {
28
28
val sym = typeOf[T ].typeSymbol
29
29
println(s " ======= $sym======= " )
30
- def printAbstract (sym : Symbol ) = println(s " $sym => ${sym.isAbstract}" )
30
+ def printAbstract (sym : Symbol ) = println(s " $sym => ${if ( sym.isAbstract) " abstract " else " concrete " }" )
31
31
printAbstract(sym)
32
32
sym.info.decls.sorted.foreach(printAbstract)
33
33
}
34
34
test[C ]
35
35
test[T ]
36
- test[D ]
36
+ test[AllConcrete ]
37
37
test[M .type ]
38
38
}
You can’t perform that action at this time.
0 commit comments