File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed
compiler/src/dotty/tools/dotc/ast Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -1039,8 +1039,10 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
1039
1039
protected def skipLocal (sym : Symbol ): Boolean = true
1040
1040
1041
1041
/** Is this a symbol that of a local val or parameterless def for which we could get the rhs */
1042
- private def isBinding (sym : Symbol )(implicit ctx : Context ): Boolean =
1043
- sym.exists && ! sym.is(Param ) && ! sym.owner.isClass && ! sym.isAnonymousFunction
1042
+ private def isBinding (sym : Symbol )(implicit ctx : Context ): Boolean = {
1043
+ sym.exists && ! sym.is(Param ) && ! sym.owner.isClass &&
1044
+ ! (sym.is(Method ) && sym.info.isInstanceOf [MethodOrPoly ]) // if is a method it is parameterless
1045
+ }
1044
1046
}
1045
1047
1046
1048
implicit class ListOfTreeDecorator (val xs : List [tpd.Tree ]) extends AnyVal {
Original file line number Diff line number Diff line change @@ -17,6 +17,15 @@ tree deref. vals: Term.Ident("a")
17
17
tree: Term.Inlined(None, Nil, Term.Ident("x"))
18
18
tree deref. vals: Term.Ident("b")
19
19
20
+ tree: Term.Inlined(None, Nil, Term.Ident("x"))
21
+ tree deref. vals: Term.Apply(Term.Ident("d2"), Nil)
22
+
23
+ tree: Term.Inlined(None, Nil, Term.Ident("x"))
24
+ tree deref. vals: Term.Apply(Term.Ident("d3"), List(Term.Literal(Constant.Int(3))))
25
+
26
+ tree: Term.Inlined(None, Nil, Term.Ident("x"))
27
+ tree deref. vals: Term.TypeApply(Term.Ident("d4"), List(TypeTree.Ident("Int")))
28
+
20
29
tree: Term.Inlined(None, Nil, Term.Ident("vv"))
21
30
tree deref. vals: Term.Literal(Constant.Int(1))
22
31
Original file line number Diff line number Diff line change @@ -9,12 +9,18 @@ object Test {
9
9
val v : Int = 1
10
10
def d : Int = 2
11
11
lazy val l : Int = 3
12
+ def d2 (): Int = 2
13
+ def d3 (a : Int ): Int = a
14
+ def d4 [T ]: Int = 2
12
15
inspect(3 )
13
16
inspect(v)
14
17
inspect(d)
15
18
inspect(l)
16
19
inspect(a)
17
20
inspect(b)
21
+ inspect(d2())
22
+ inspect(d3(3 ))
23
+ inspect(d4[Int ])
18
24
19
25
val vv = v
20
26
def dv = v
You can’t perform that action at this time.
0 commit comments