Skip to content

Commit 9e53b78

Browse files
committed
Restore the build
1 parent 57eb768 commit 9e53b78

File tree

16 files changed

+71
-58
lines changed

16 files changed

+71
-58
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ object Denotations {
504504
val r = mergeDenot(this, that)
505505
if (r.exists) r else MultiDenotation(this, that)
506506
case that @ MultiDenotation(denot1, denot2) =>
507-
this.meet(denot1, pre).meet(denot2, pre)
507+
this.meet(denot1, pre, safeIntersection = false).meet(denot2, pre, safeIntersection = false)
508508
}
509509
}
510510

@@ -1339,7 +1339,7 @@ object Denotations {
13391339
case ModuleClassName(underlying) =>
13401340
recur(underlying, n => wrap(ModuleClassName(n)))
13411341
case QualifiedName(prefix, selector) =>
1342-
select(recur(prefix), wrap(selector))
1342+
select(recur(prefix, identity), wrap(selector))
13431343
case qn @ AnyQualifiedName(prefix, _) =>
13441344
recur(prefix, n => wrap(qn.info.mkString(n).toTermName))
13451345
case path: SimpleName =>

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ trait PatternTypeConstrainer { self: TypeComparer =>
7575
*/
7676
def constrainPatternType(pat: Type, scrut: Type, forceInvariantRefinement: Boolean = false): Boolean = trace(i"constrainPatternType($scrut, $pat)", gadts) {
7777

78+
inline def recur(pat: Type, scrut: Type): Boolean =
79+
constrainPatternType(pat, scrut, forceInvariantRefinement = false)
80+
7881
def classesMayBeCompatible: Boolean = {
7982
import Flags.*
8083
val patCls = pat.classSymbol
@@ -114,7 +117,7 @@ trait PatternTypeConstrainer { self: TypeComparer =>
114117
// consider all parents
115118
val parents = scrut.parents
116119
val andType = buildAndType(parents)
117-
!andType.exists || constrainPatternType(pat, andType)
120+
!andType.exists || recur(pat, andType)
118121
case scrut @ AppliedType(tycon: TypeRef, _) if tycon.symbol.isClass =>
119122
val patCls = pat.classSymbol
120123
// find all shared parents in the inheritance hierarchy between pat and scrut
@@ -131,14 +134,14 @@ trait PatternTypeConstrainer { self: TypeComparer =>
131134
val allSyms = allParentsSharedWithPat(tycon, tycon.symbol.asClass)
132135
val baseClasses = allSyms map scrut.baseType
133136
val andType = buildAndType(baseClasses)
134-
!andType.exists || constrainPatternType(pat, andType)
137+
!andType.exists || recur(pat, andType)
135138
case _ =>
136139
def tryGadtBounds = scrut match {
137140
case scrut: TypeRef =>
138141
ctx.gadt.bounds(scrut.symbol) match {
139142
case tb: TypeBounds =>
140143
val hi = tb.hi
141-
constrainPatternType(pat, hi)
144+
recur(pat, hi)
142145
case null => true
143146
}
144147
case _ => true
@@ -173,18 +176,18 @@ trait PatternTypeConstrainer { self: TypeComparer =>
173176

174177
dealiasDropNonmoduleRefs(scrut) match {
175178
case OrType(scrut1, scrut2) =>
176-
either(constrainPatternType(pat, scrut1), constrainPatternType(pat, scrut2))
179+
either(recur(pat, scrut1), recur(pat, scrut2))
177180
case AndType(scrut1, scrut2) =>
178-
constrainPatternType(pat, scrut1) && constrainPatternType(pat, scrut2)
181+
recur(pat, scrut1) && recur(pat, scrut2)
179182
case scrut: RefinedOrRecType =>
180-
constrainPatternType(pat, scrut.stripRefinement)
183+
recur(pat, scrut.stripRefinement)
181184
case scrut => dealiasDropNonmoduleRefs(pat) match {
182185
case OrType(pat1, pat2) =>
183-
either(constrainPatternType(pat1, scrut), constrainPatternType(pat2, scrut))
186+
either(recur(pat1, scrut), recur(pat2, scrut))
184187
case AndType(pat1, pat2) =>
185-
constrainPatternType(pat1, scrut) && constrainPatternType(pat2, scrut)
188+
recur(pat1, scrut) && recur(pat2, scrut)
186189
case pat: RefinedOrRecType =>
187-
constrainPatternType(pat.stripRefinement, scrut)
190+
recur(pat.stripRefinement, scrut)
188191
case pat =>
189192
tryConstrainSimplePatternType(pat, scrut)
190193
|| classesMayBeCompatible && constrainUpcasted(scrut)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2109,7 +2109,7 @@ object SymDenotations {
21092109
enterNoReplace(sym, mscope)
21102110
val nxt = this.nextInRun
21112111
if (nxt.validFor.code > this.validFor.code)
2112-
this.nextInRun.asSymDenotation.asClass.enter(sym)
2112+
this.nextInRun.asSymDenotation.asClass.enter(sym, EmptyScope)
21132113
}
21142114
}
21152115

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ class TypeApplications(val self: Type) extends AnyVal {
472472
*/
473473
def translateParameterized(from: ClassSymbol, to: ClassSymbol, wildcardArg: Boolean = false)(using Context): Type = self match {
474474
case self @ ExprType(tp) =>
475-
self.derivedExprType(tp.translateParameterized(from, to))
475+
self.derivedExprType(tp.translateParameterized(from, to, wildcardArg = false))
476476
case _ =>
477477
if (self.derivesFrom(from)) {
478478
def elemType(tp: Type): Type = tp.widenDealias match

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2747,8 +2747,8 @@ object Types extends TypeUtils {
27472747
}
27482748
NoType
27492749
case base: AndOrType =>
2750-
var tp1 = argForParam(base.tp1)
2751-
var tp2 = argForParam(base.tp2)
2750+
var tp1 = argForParam(base.tp1, widenAbstract = false)
2751+
var tp2 = argForParam(base.tp2, widenAbstract = false)
27522752
val variance = tparam.paramVarianceSign
27532753
if (isBounds(tp1) || isBounds(tp2) || variance == 0) {
27542754
// compute argument as a type bounds instead of a point type
@@ -2757,7 +2757,7 @@ object Types extends TypeUtils {
27572757
}
27582758
if (base.isAnd == variance >= 0) tp1 & tp2 else tp1 | tp2
27592759
case _ =>
2760-
if (pre.termSymbol.is(Package)) argForParam(pre.select(nme.PACKAGE))
2760+
if (pre.termSymbol.is(Package)) argForParam(pre.select(nme.PACKAGE), widenAbstract = false)
27612761
else if (pre.isExactlyNothing) pre
27622762
else NoType
27632763
}
@@ -6284,12 +6284,12 @@ object Types extends TypeUtils {
62846284
mapCapability(c1, deep = true)
62856285
case ReadOnly(c1) =>
62866286
assert(!deep)
6287-
mapCapability(c1) match
6287+
mapCapability(c1, deep = false) match
62886288
case c2: Capability => c2.readOnly
62896289
case (cs: CaptureSet, exact) => (cs.readOnly, exact)
62906290
case Maybe(c1) =>
62916291
assert(!deep)
6292-
mapCapability(c1) match
6292+
mapCapability(c1, deep = false) match
62936293
case c2: Capability => c2.maybe
62946294
case (cs: CaptureSet, exact) => (cs.maybe, exact)
62956295
case ref: CoreCapability =>

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ class TreeUnpickler(reader: TastyReader,
239239
scanTrees(buf, end)
240240
}
241241
}
242-
else if (tag >= firstNatASTTreeTag) { readNat(); scanTree(buf) }
243-
else if (tag >= firstASTTreeTag) scanTree(buf)
242+
else if (tag >= firstNatASTTreeTag) { readNat(); scanTree(buf, mode = AllDefs) }
243+
else if (tag >= firstASTTreeTag) scanTree(buf, mode = AllDefs)
244244
else if (tag >= firstNatTreeTag) readNat()
245245
}
246246
}

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,9 +1767,9 @@ object Parsers {
17671767
makePolyFunction(tparams, body, "type", Ident(nme.ERROR.toTypeName), start, arrowOffset)
17681768
else
17691769
accept(TLARROW)
1770-
typ()
1770+
typ(inContextBound = false)
17711771
else if in.token == INDENT then
1772-
enclosed(INDENT, typ())
1772+
enclosed(INDENT, typ(inContextBound = false))
17731773
else
17741774
typeRest(infixType(inContextBound))
17751775
end typ

compiler/src/dotty/tools/dotc/parsing/Scanners.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ object Scanners {
11401140
val opening = token
11411141
nextToken()
11421142
while token != EOF && token != opening + 1 do
1143-
if token == opening && multiple then skipParens() else nextToken()
1143+
if token == opening && multiple then skipParens(multiple = true) else nextToken()
11441144
nextToken()
11451145

11461146
/** Is the current token in a position where a modifier is allowed? */

compiler/src/dotty/tools/dotc/reporting/messages.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2999,11 +2999,13 @@ class MissingImplicitArgument(
29992999
formatAnnotationMessage(rawMsg, sym.owner, methodTypeParams, methodTypeArgs, _.asSeenFrom(methodOwnerType, methodOwner))
30003000

30013001
def userDefinedImplicitNotFoundTypeMessage(using Context): Option[String] =
3002-
def recur(tp: Type, params: List[ParamInfo] = Nil, args: List[Type] = Nil): Option[String] = tp match
3002+
def recur3(tp: Type, params: List[ParamInfo], args: List[Type]): Option[String] =
3003+
inline def recur(tp: Type): Option[String] = recur3(tp, Nil, Nil)
3004+
tp match
30033005
case tp: AppliedType =>
30043006
val tycon = tp.typeConstructor
30053007
val typeParams = if tycon.isLambdaSub then tycon.hkTypeParams else tycon.typeParams
3006-
recur(tycon, typeParams ::: params, tp.args ::: args)
3008+
recur3(tycon, typeParams ::: params, tp.args ::: args)
30073009
case tp: TypeRef =>
30083010
userDefinedImplicitNotFoundTypeMessageFor(tp.symbol, params, args)
30093011
.orElse(recur(tp.info))
@@ -3017,7 +3019,7 @@ class MissingImplicitArgument(
30173019
recur(tp.tp1).orElse(recur(tp.tp2))
30183020
case _ =>
30193021
None
3020-
recur(pt)
3022+
recur3(pt, Nil, Nil)
30213023

30223024
/** The implicitNotFound annotation on the parameter, or else on the type.
30233025
* implicitNotFound message strings starting with `explain=` are intended for

compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ object GenericSignatures {
234234

235235
@noinline
236236
def jsig(tp0: Type, toplevel: Boolean = false, unboxedVCs: Boolean = true): Unit = {
237+
inline def jsig1(tp0: Type): Unit = jsig(tp0, toplevel = false, unboxedVCs = true)
237238

238239
val tp = tp0.dealias
239240
tp match {
@@ -242,41 +243,41 @@ object GenericSignatures {
242243
val erasedUnderlying = fullErasure(ref.underlying.bounds.hi)
243244
// don't emit type param name if the param is upper-bounded by a primitive type (including via a value class)
244245
if erasedUnderlying.isPrimitiveValueType then
245-
jsig(erasedUnderlying, toplevel, unboxedVCs)
246+
jsig(erasedUnderlying, toplevel = toplevel, unboxedVCs = unboxedVCs)
246247
else typeParamSig(ref.paramName.lastPart)
247248

248249
case defn.ArrayOf(elemtp) =>
249250
if (isGenericArrayElement(elemtp, isScala2 = false))
250-
jsig(defn.ObjectType)
251+
jsig1(defn.ObjectType)
251252
else
252253
builder.append(ClassfileConstants.ARRAY_TAG)
253254
elemtp match
254-
case TypeBounds(lo, hi) => jsig(hi.widenDealias)
255-
case _ => jsig(elemtp)
255+
case TypeBounds(lo, hi) => jsig1(hi.widenDealias)
256+
case _ => jsig1(elemtp)
256257

257258
case RefOrAppliedType(sym, pre, args) =>
258259
if (sym == defn.PairClass && tupleArity(tp) > Definitions.MaxTupleArity)
259-
jsig(defn.TupleXXLClass.typeRef)
260+
jsig1(defn.TupleXXLClass.typeRef)
260261
else if (isTypeParameterInSig(sym, sym0)) {
261262
assert(!sym.isAliasType || sym.info.isLambdaSub, "Unexpected alias type: " + sym)
262263
typeParamSig(sym.name.lastPart)
263264
}
264265
else if (defn.specialErasure.contains(sym))
265-
jsig(defn.specialErasure(sym).typeRef)
266+
jsig1(defn.specialErasure(sym).typeRef)
266267
else if (sym == defn.UnitClass || sym == defn.BoxedUnitModule)
267-
jsig(defn.BoxedUnitClass.typeRef)
268+
jsig1(defn.BoxedUnitClass.typeRef)
268269
else if (sym == defn.NothingClass)
269270
builder.append("Lscala/runtime/Nothing$;")
270271
else if (sym == defn.NullClass)
271272
builder.append("Lscala/runtime/Null$;")
272273
else if (sym.isPrimitiveValueClass)
273-
if (!unboxedVCs) jsig(defn.ObjectType)
274-
else if (sym == defn.UnitClass) jsig(defn.BoxedUnitClass.typeRef)
274+
if (!unboxedVCs) jsig1(defn.ObjectType)
275+
else if (sym == defn.UnitClass) jsig1(defn.BoxedUnitClass.typeRef)
275276
else builder.append(defn.typeTag(sym.info))
276277
else if (sym.isDerivedValueClass) {
277278
if (unboxedVCs) {
278279
val erasedUnderlying = fullErasure(tp)
279-
jsig(erasedUnderlying, toplevel)
280+
jsig(erasedUnderlying, toplevel = toplevel, unboxedVCs = true)
280281
} else classSig(sym, pre, args)
281282
}
282283
else if (defn.isSyntheticFunctionClass(sym)) {
@@ -286,20 +287,20 @@ object GenericSignatures {
286287
else if sym.isClass then
287288
classSig(sym, pre, args)
288289
else
289-
jsig(erasure(tp), toplevel, unboxedVCs)
290+
jsig(erasure(tp), toplevel = toplevel, unboxedVCs = unboxedVCs)
290291

291292
case ExprType(restpe) if toplevel =>
292293
builder.append("()")
293294
methodResultSig(restpe)
294295

295296
case ExprType(restpe) =>
296-
jsig(defn.FunctionType(0).appliedTo(restpe))
297+
jsig1(defn.FunctionType(0).appliedTo(restpe))
297298

298299
case mtd: MethodOrPoly =>
299300
val (tparams, vparams, rte) = collectMethodParams(mtd)
300301
if (toplevel && !sym0.isConstructor) polyParamSig(tparams)
301302
builder.append('(')
302-
for vparam <- vparams do jsig(vparam)
303+
for vparam <- vparams do jsig1(vparam)
303304
builder.append(')')
304305
methodResultSig(rte)
305306

@@ -316,7 +317,7 @@ object GenericSignatures {
316317
val (reprParents, _) = splitIntersection(parents)
317318
val repr =
318319
reprParents.find(_.typeSymbol.is(TypeParam)).getOrElse(reprParents.head)
319-
jsig(repr, unboxedVCs = unboxedVCs)
320+
jsig(repr, toplevel = false, unboxedVCs = unboxedVCs)
320321

321322
case ci: ClassInfo =>
322323
val tParams = tp.typeParams

0 commit comments

Comments
 (0)