@@ -56,16 +56,12 @@ class TreeChecker extends Phase with SymTransformer {
56
56
57
57
def isValidJVMMethodName (name : Name ) = name.toString.forall(isValidJVMMethodChar)
58
58
59
- def printError (str : String )(implicit ctx : Context ) = {
60
- ctx.echo(Console .RED + " [error] " + Console .WHITE + str)
61
- }
62
-
63
59
val NoSuperClass = Trait | Package
64
60
65
61
def testDuplicate (sym : Symbol , registry : mutable.Map [String , Symbol ], typ : String )(implicit ctx : Context ) = {
66
62
val name = sym.fullName.mangledString
67
- if ( this .flatClasses && registry.contains(name) )
68
- assert(false , s " $typ defined twice $sym ${sym.id} ${registry(name).id}" )
63
+ val isDuplicate = this .flatClasses && registry.contains(name)
64
+ assert(! isDuplicate , s " $typ defined twice $sym ${sym.id} ${registry(name).id}" )
69
65
registry(name) = sym
70
66
}
71
67
@@ -85,14 +81,13 @@ class TreeChecker extends Phase with SymTransformer {
85
81
if (sym.isClass && ! sym.isAbsent) {
86
82
val validSuperclass = sym.isPrimitiveValueClass || defn.syntheticCoreClasses.contains(sym) ||
87
83
(sym eq defn.ObjectClass ) || (sym is NoSuperClass ) || (sym.asClass.superClass.exists)
88
- if (! validSuperclass)
89
- printError(s " $sym has no superclass set " )
90
84
85
+ assert(validSuperclass, i " $sym has no superclass set " )
91
86
testDuplicate(sym, seenClasses, " class" )
92
87
}
93
88
94
- if ( sym.is(Method ) && sym.is(Deferred ) && sym.is(Private ) )
95
- assert(false , s " $sym is both Deferred and Private " )
89
+ val isDeferredAndPrivate = sym.is(Method ) && sym.is(Deferred ) && sym.is(Private )
90
+ assert(! isDeferredAndPrivate, i " $sym is both Deferred and Private " )
96
91
97
92
checkCompanion(symd)
98
93
0 commit comments