Skip to content

Commit 9fcf8f1

Browse files
committed
Strenghten eval-java-protected-members test
1 parent 5c1a68e commit 9fcf8f1

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

Diff for: compiler/src/dotty/tools/debug/ExtractExpression.scala

+5-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,11 @@ private class ExtractExpression(config: ExpressionCompilerConfig, expressionStor
283283
private def isLocalVariable(symbol: Symbol)(using Context): Boolean =
284284
!symbol.is(Method) && symbol.isLocalToBlock
285285

286-
// Check if a term is accessible from the expression class
286+
/** Check if a term is accessible from the expression class.
287+
* At this phase, there is no need test privateWithin, as it will no longer be checked.
288+
* This eliminates the need to use reflection to evaluate privateWithin members,
289+
* which would otherwise degrade performances.
290+
*/
287291
private def isAccessibleMember(tree: Tree)(using Context): Boolean =
288292
val symbol = tree.symbol
289293
symbol.owner.isType &&

Diff for: tests/debug/eval-java-protected-members.check

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
break Test$ 3
2-
eval A.x1
2+
eval example.A.x1
33
result x1
4-
eval A.x1 = "y1"; A.x1
4+
eval example.A.x1 = "y1"; example.A.x1
55
result y1
6-
eval A.m1()
6+
eval example.A.m1()
77
result m1
88
eval x2
99
result x2

Diff for: tests/debug/eval-java-protected-members/A.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
class A {
1+
package example;
2+
3+
public class A {
24
protected static String x1 = "x1";
35
protected static String m1() {
46
return "m1";

Diff for: tests/debug/eval-java-protected-members/Test.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
object Test extends A:
1+
object Test extends example.A:
22
def main(args: Array[String]): Unit =
33
println("Hello, World!")

0 commit comments

Comments
 (0)