Skip to content

Commit 23460cb

Browse files
committed
Fix ambiguities in compiler
Now that extension names are the same as normal names, we got several ambiguos imports
1 parent c42d777 commit 23460cb

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class JSCodeGen()(using genCtx: Context) {
206206
withScopedVars(
207207
currentClassSym := sym
208208
) {
209-
val tree = if (isJSType(sym)) {
209+
val tree = if (sym.isJSType) {
210210
if (!sym.is(Trait) && sym.isNonNativeJSClass)
211211
genNonNativeJSClass(td)
212212
else
@@ -702,7 +702,7 @@ class JSCodeGen()(using genCtx: Context) {
702702
Nil
703703
} else {
704704
val moduleClass = module.moduleClass
705-
if (!isJSType(moduleClass))
705+
if (!moduleClass.isJSType)
706706
genStaticForwardersFromModuleClass(existingMembers, moduleClass)
707707
else
708708
Nil
@@ -1678,7 +1678,7 @@ class JSCodeGen()(using genCtx: Context) {
16781678
}
16791679

16801680
fun match {
1681-
case _ if isJSDefaultParam(sym) =>
1681+
case _ if sym.isJSDefaultParam =>
16821682
js.Transient(UndefinedParam)(toIRType(sym.info.finalResultType))
16831683

16841684
case Select(Super(_, _), _) =>
@@ -1771,7 +1771,7 @@ class JSCodeGen()(using genCtx: Context) {
17711771
} else /*if (translatedAnonFunctions contains tpe.typeSymbol) {
17721772
val functionMaker = translatedAnonFunctions(tpe.typeSymbol)
17731773
functionMaker(args map genExpr)
1774-
} else*/ if (isJSType(clsSym)) {
1774+
} else*/ if (clsSym.isJSType) {
17751775
genNewJSClass(tree)
17761776
} else {
17771777
toTypeRef(tpe) match {
@@ -2406,7 +2406,7 @@ class JSCodeGen()(using genCtx: Context) {
24062406
* and `-0.0`, see Javadoc (scala-dev#329, scala-js#2799).
24072407
*/
24082408
val mustUseAnyComparator: Boolean = {
2409-
isJSType(lsym) || isJSType(rsym) || {
2409+
lsym.isJSType || rsym.isJSType || {
24102410
val p = ctx.platform
24112411
p.isMaybeBoxed(lsym) && p.isMaybeBoxed(rsym) && {
24122412
val areSameFinals = lsym.is(Final) && rsym.is(Final) && (ltpe =:= rtpe)
@@ -2603,7 +2603,7 @@ class JSCodeGen()(using genCtx: Context) {
26032603

26042604
if (isMethodStaticInIR(sym)) {
26052605
genApplyStatic(sym, genActualArgs(sym, args))
2606-
} else if (isJSType(sym.owner)) {
2606+
} else if (sym.owner.isJSType) {
26072607
if (!sym.owner.isNonNativeJSClass || sym.isJSExposed)
26082608
genApplyJSMethodGeneric(sym, genExprOrGlobalScope(receiver), genActualJSArgs(sym, args), isStat)(tree.sourcePos)
26092609
else
@@ -2689,13 +2689,13 @@ class JSCodeGen()(using genCtx: Context) {
26892689
}
26902690
}
26912691

2692-
if (isJSGetter(sym)) {
2692+
if (sym.isJSGetter) {
26932693
assert(noSpread && argc == 0)
26942694
genSelectGet(jsFunName)
2695-
} else if (isJSSetter(sym)) {
2695+
} else if (sym.isJSSetter) {
26962696
assert(noSpread && argc == 1)
26972697
genSelectSet(jsFunName, requireNotSpread(args.head))
2698-
} else if (isJSBracketAccess(sym)) {
2698+
} else if (sym.isJSBracketAccess) {
26992699
assert(noSpread && (argc == 1 || argc == 2),
27002700
s"@JSBracketAccess methods should have 1 or 2 non-varargs arguments")
27012701
(args: @unchecked) match {
@@ -2704,7 +2704,7 @@ class JSCodeGen()(using genCtx: Context) {
27042704
case List(keyArg, valueArg) =>
27052705
genSelectSet(requireNotSpread(keyArg), requireNotSpread(valueArg))
27062706
}
2707-
} else if (isJSBracketCall(sym)) {
2707+
} else if (sym.isJSBracketCall) {
27082708
val (methodName, actualArgs) = extractFirstArg(args)
27092709
genCall(methodName, actualArgs)
27102710
} else {
@@ -3187,7 +3187,7 @@ class JSCodeGen()(using genCtx: Context) {
31873187

31883188
val sym = to.typeSymbol
31893189

3190-
if (sym == defn.ObjectClass || isJSType(sym)) {
3190+
if (sym == defn.ObjectClass || sym.isJSType) {
31913191
/* asInstanceOf[Object] always succeeds, and
31923192
* asInstanceOf to a raw JS type is completely erased.
31933193
*/
@@ -3217,7 +3217,7 @@ class JSCodeGen()(using genCtx: Context) {
32173217

32183218
if (sym == defn.ObjectClass) {
32193219
js.BinaryOp(js.BinaryOp.!==, value, js.Null())
3220-
} else if (isJSType(sym)) {
3220+
} else if (sym.isJSType) {
32213221
if (sym.is(Trait)) {
32223222
report.error(
32233223
s"isInstanceOf[${sym.fullName}] not supported because it is a JS trait",
@@ -3347,7 +3347,7 @@ class JSCodeGen()(using genCtx: Context) {
33473347
arg match {
33483348
case Literal(value) if value.tag == Constants.ClazzTag =>
33493349
val classSym = value.typeValue.typeSymbol
3350-
if (isJSType(classSym) && !classSym.is(Trait) && !classSym.is(ModuleClass))
3350+
if (classSym.isJSType && !classSym.is(Trait) && !classSym.is(ModuleClass))
33513351
classSym
33523352
else
33533353
fail()
@@ -3999,7 +3999,7 @@ class JSCodeGen()(using genCtx: Context) {
39993999
} else {
40004000
val cls = encodeClassName(sym)
40014001
val tree =
4002-
if (isJSType(sym)) js.LoadJSModule(cls)
4002+
if (sym.isJSType) js.LoadJSModule(cls)
40034003
else js.LoadModule(cls)
40044004
MaybeGlobalScope.NotGlobalScope(tree)
40054005
}

compiler/src/dotty/tools/dotc/core/NameOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ object NameOps {
212212
/** Same as `funArity`, except that it returns -1 if the prefix
213213
* is not one of "", "Context", "Erased", "ErasedContext"
214214
*/
215-
private def checkedFunArity(suffixStart: Int) =
215+
private def checkedFunArity(suffixStart: Int): Int =
216216
if suffixStart == 0
217217
|| isPreceded("Context", suffixStart)
218218
|| isPreceded("Erased", suffixStart)

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ trait Applications extends Compatibility {
11871187
typedType(untpd.rename(tree, tree.name.toTypeName))(using nestedCtx)
11881188
ttree.tpe match {
11891189
case alias: TypeRef if alias.info.isTypeAlias && !nestedCtx.reporter.hasErrors =>
1190-
companionRef(alias) match {
1190+
Inferencing.companionRef(alias) match {
11911191
case companion: TermRef => return untpd.ref(companion).withSpan(tree.span)
11921192
case _ =>
11931193
}

0 commit comments

Comments
 (0)