Skip to content

Commit cf2ae5e

Browse files
committed
Merge pull request #1270 from dotty-staging/fix-bootstrap
Fix bootstrap
2 parents 079192e + c996e42 commit cf2ae5e

File tree

15 files changed

+281
-112
lines changed

15 files changed

+281
-112
lines changed

src/dotty/annotation/internal/Child.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import scala.annotation.Annotation
99
* case class B() extends A
1010
* case class C() extends A
1111
*
12-
* Then `A` would carry the annotations `@Child[B] @Child[C]` where
13-
* `B`, `C` are TypeRefs.
12+
* Then the class symbol `A` would carry the annotations
13+
* `@Child[Bref] @Child[Cref]` where `Bref`, `Cref` are TypeRefs
14+
* referring to the class symbols of `B` and `C`
1415
*/
1516
class Child[T] extends Annotation

src/dotty/tools/dotc/core/Contexts.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ object Contexts {
248248
withPhase(phase.id)
249249

250250
final def withPhaseNoLater(phase: Phase) =
251-
if (ctx.phase.id > phase.id) withPhase(phase) else ctx
251+
if (phase.exists && ctx.phase.id > phase.id) withPhase(phase) else ctx
252252

253253
/** If -Ydebug is on, the top of the stack trace where this context
254254
* was created, otherwise `null`.

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,13 @@ object Denotations {
658658
var startPid = nextTransformerId + 1
659659
val transformer = ctx.denotTransformers(nextTransformerId)
660660
//println(s"transforming $this with $transformer")
661-
next = transformer.transform(cur)(ctx.withPhase(transformer)).syncWithParents
661+
try {
662+
next = transformer.transform(cur)(ctx.withPhase(transformer)).syncWithParents
663+
} catch {
664+
case ex: CyclicReference =>
665+
println(s"error while transforming $this") // DEBUG
666+
throw ex
667+
}
662668
if (next eq cur)
663669
startPid = cur.validFor.firstPhaseId
664670
else {

src/dotty/tools/dotc/core/Flags.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,9 @@ object Flags {
525525
/** Either method or lazy */
526526
final val MethodOrLazy = Method | Lazy
527527

528+
/** Either method or lazy or deferred */
529+
final val MethodOrLazyOrDeferred = Method | Lazy | Deferred
530+
528531
/** Labeled `private` or `final` */
529532
final val PrivateOrFinal = Private | Final
530533

src/dotty/tools/dotc/core/Symbols.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,10 @@ object Symbols {
400400

401401
/** Subclass tests and casts */
402402
final def isTerm(implicit ctx: Context): Boolean =
403-
(if(isDefinedInCurrentRun) lastDenot else denot).isTerm
403+
(if (defRunId == ctx.runId) lastDenot else denot).isTerm
404404

405405
final def isType(implicit ctx: Context): Boolean =
406-
(if(isDefinedInCurrentRun) lastDenot else denot).isType
406+
(if (defRunId == ctx.runId) lastDenot else denot).isType
407407

408408
final def isClass: Boolean = isInstanceOf[ClassSymbol]
409409

src/dotty/tools/dotc/core/TypeErasure.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
374374
tr1 :: trs1.filterNot(_ isRef defn.ObjectClass)
375375
case nil => nil
376376
}
377-
val erasedDecls = decls.filteredScope(d => !d.isType || d.isClass)
377+
val erasedDecls = decls.filteredScope(sym => !sym.isType || sym.isClass)
378378
tp.derivedClassInfo(NoPrefix, parents, erasedDecls, erasedRef(tp.selfType))
379379
// can't replace selftype by NoType because this would lose the sourceModule link
380380
}

src/dotty/tools/dotc/core/tasty/TastyFormat.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,4 +485,15 @@ object TastyFormat {
485485
case PRIVATEqualified => "PRIVATEqualified"
486486
case PROTECTEDqualified => "PROTECTEDqualified"
487487
}
488+
489+
/** @return If non-negative, the number of leading references of a length/trees entry.
490+
* If negative, minus the number of leading non-reference trees.
491+
*/
492+
def numRefs(tag: Int) = tag match {
493+
case VALDEF | DEFDEF | TYPEDEF | TYPEPARAM | PARAM | NAMEDARG | RETURN | BIND |
494+
SELFDEF | REFINEDtype => 1
495+
case RENAMED | PARAMtype => 2
496+
case POLYtype | METHODtype => -1
497+
case _ => 0
498+
}
488499
}

src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ class TreePickler(pickler: TastyPickler) {
217217
case tpe: RefinedType =>
218218
writeByte(REFINEDtype)
219219
withLength {
220-
pickleType(tpe.parent)
221220
pickleName(tpe.refinedName)
221+
pickleType(tpe.parent)
222222
pickleType(tpe.refinedInfo, richTypes = true)
223223
}
224224
case tpe: TypeAlias =>

0 commit comments

Comments
 (0)