Skip to content

Commit 4d03ef9

Browse files
committed
Don't disable pickling tests for #4192
1 parent 49b6274 commit 4d03ef9

File tree

3 files changed

+120
-108
lines changed

3 files changed

+120
-108
lines changed

compiler/test/dotc/run-test-pickling.blacklist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
derive-generic.scala
22
eff-dependent.scala
33
enum-java
4-
i4192
54
i5257.scala
65
i7212
76
i7868.scala

tests/run/i4192/Checks.scala

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,7 @@ package checks
22

33
import reflect.ClassTag
44

5-
/* This test checks whether InnerClasses and EnclosingMethod sections in generated class files are correct
6-
* for different possibilities of nesting of classes in other classes, objects and methods (the attributes are accessed via java reflection).
7-
* Names of nested definitions are derived from the name of their enclosing definition by appending a letter following the scheme below:
8-
* A - a class without a companion object
9-
* B - an object without a companion class
10-
* C - a class with its companion object
11-
* D - a method
12-
* Additionally a number may be added to avoid clashes between definitions from classes and their companion objects
13-
* (1 - defined in the companion class; 2 - defined in the companion object),
14-
* e.g. ACD2 - a method inside the companion object of a class inside a top level class
15-
*/
5+
166
trait Checks:
177
val expectedTopLevelChecksCount: Int
188
val expectedMemberChecksCount: Int
@@ -30,22 +20,25 @@ trait Checks:
3020
assert(localChecksCount == expectedLocalChecksCount,
3121
s"local checks: expected $expectedLocalChecksCount but was $localChecksCount")
3222

23+
// The methods below rely on the naming convention described in TestCases.scala
24+
3325
/** Check JVM class properties of a top level class */
34-
def checkTopLevel[ThisClass](using thisTag: ClassTag[ThisClass]) =
35-
val cls = thisTag.runtimeClass
26+
def checkTopLevel(self: AnyRef) =
27+
val cls = self.getClass
3628
assert(cls.getEnclosingClass == null, s"Top level class $cls should have no enclosing class")
3729
assert(cls.getDeclaringClass == null, s"Top level class $cls should have no declaring class")
3830
assert(cls.getEnclosingMethod == null, s"Top level class $cls should have no enclosing method")
3931
topLevelChecksCount += 1
4032

4133
/** Check JVM class properties of a member class (defined directly inside another class) */
42-
def checkMember[ThisClass, EnclosingClass](using thisTag: ClassTag[ThisClass], enclosingTag: ClassTag[EnclosingClass]) =
43-
val cls = thisTag.runtimeClass
34+
def checkMember(self: AnyRef, outer: AnyRef) =
35+
val cls = self.getClass
4436
def className = cls.simpleName
4537
def enclosingClassName = cls.getEnclosingClass.simpleName
4638
def declaringClassName = cls.getDeclaringClass.simpleName
47-
val expectedEnclosingClassName = enclosingTag.runtimeClass.simpleName match
48-
case "B$" => "B" // classes defined directly in top level objects should be moved to their companion/mirror classes
39+
// Classes defined directly in top level objects should be moved to their companion/mirror classes
40+
val expectedEnclosingClassName = outer.getClass.simpleName match
41+
case "B$" => "B"
4942
case "C$" => "C"
5043
case name => name
5144
assert(cls.getEnclosingClass != null,
@@ -59,12 +52,12 @@ trait Checks:
5952
memberChecksCount += 1
6053

6154
/** Check JVM class properties of a local class (defined directly inside a method) */
62-
def checkLocal[ThisClass, EnclosingClass](using thisTag: ClassTag[ThisClass], enclosingTag: ClassTag[EnclosingClass]) =
63-
val cls = thisTag.runtimeClass
55+
def checkLocal(self: AnyRef, outer: AnyRef) =
56+
val cls = self.getClass
6457
def className = cls.simpleName
6558
def enclosingClassName = cls.getEnclosingClass.simpleName
66-
def meth = cls.getEnclosingMethod
67-
val expectedEnclosingClassName = enclosingTag.runtimeClass.simpleName
59+
def method = cls.getEnclosingMethod
60+
val expectedEnclosingClassName = outer.getClass.simpleName
6861
// extracting method name basing on the described naming convention
6962
// $1 gets added during lambdaLift in case of a method defined inside another method
7063
val expectedEnclosingMethodName =
@@ -77,10 +70,10 @@ trait Checks:
7770
s"The enclosing class of class $className should be $expectedEnclosingClassName but was $enclosingClassName")
7871
assert(cls.getDeclaringClass == null,
7972
s"Local class $className should have no declaring class")
80-
assert(meth != null,
73+
assert(method != null,
8174
s"Local class $className should have an enclosing method")
82-
assert(meth.getName == expectedEnclosingMethodName,
83-
s"The enclosing method of class $className should be $expectedEnclosingMethodName but was ${meth.getName}")
75+
assert(method.getName == expectedEnclosingMethodName,
76+
s"The enclosing method of class $className should be $expectedEnclosingMethodName but was ${method.getName}")
8477
localChecksCount += 1
8578

8679
extension (cls: Class[?])

0 commit comments

Comments
 (0)