Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash (regression): dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol #17152

Closed
soronpo opened this issue Mar 26, 2023 · 0 comments · Fixed by #18077
Closed

Crash (regression): dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol #17152

soronpo opened this issue Mar 26, 2023 · 0 comments · Fixed by #18077
Labels
area:typer itype:bug itype:crash regression This worked in a previous version but doesn't anymore
Milestone

Comments

@soronpo
Copy link
Contributor

soronpo commented Mar 26, 2023

Regression introduced in #17088 causes a crash

Compiler version

From this version onward
v3.3.1-RC1-bin-20230312-89a744f-NIGHTLY

Minimized code

DFVal.scala

package crash

trait TCConv[T <: DFTypeAny, V, O]:
  type Out <: O
  def conv(dfType: T, value: V): Out

class DFVal[+T <: DFTypeAny]
type DFValAny = DFVal[DFTypeAny]
type DFValOf[+T <: DFTypeAny] = DFVal[T]

object DFVal:
  trait TC[T <: DFTypeAny, R] extends TCConv[T, R, DFValAny]:
    type Out = DFValOf[T]
    final def apply(dfType: T, value: R): Out = ???

  object TC:
    export CompanionsDFBits.Val.TC.given
  end TC

  object Ops:
    extension [T <: DFTypeAny, A, C, I](dfVal: DFVal[T])
      def bits(using w: Width[T]): DFValOf[DFBits[w.Out]] = ???
    end extension
  end Ops
end DFVal

DFBits.scala

package crash

import scala.quoted.*

class IRDFType
class IRDFBoolOrBit extends IRDFType
class IRDFDecimal extends IRDFType
class IRDFBits extends IRDFType

final class DFType[+T <: IRDFType, +A]
type DFTypeAny = DFType[IRDFType, Any]

trait Baz

trait Width[T]:
  type Out <: Int
object Width:
  given fromDFBoolOrBit[T <: DFBoolOrBit]: Width[T] with
    type Out = 1
  transparent inline given [T]: Width[T] = ${ getWidthMacro[T] }
  def getWidthMacro[T](using Quotes, Type[T]): Expr[Width[T]] =
    '{
      new Width[T]:
        type Out = 1
    }
end Width

extension [T](t: T)(using baz: Baz) def width: 1 = ???

trait Check[T1 <: Int, T2 <: Int]

type DFBits[W <: Int] = DFType[IRDFBits, Tuple1[W]]

private object CompanionsDFBits:
  object Val:
    trait Candidate[R]:
      type OutW <: Int
      def apply(value: R): DFValOf[DFBits[OutW]]
    object Candidate:
      given fromDFUInt[W <: Int, R <: DFValOf[DFDecimal]]: Candidate[R] with
        type OutW = W
        def apply(value: R): DFValOf[DFBits[W]] =
          import DFVal.Ops.bits
          value.bits
          ???
    end Candidate

    object TC:
      import DFVal.TC
      given DFBitsFromCandidate[
          LW <: Int,
          V
      ](using candidate: Candidate[V])(using
          check: Check[LW, candidate.OutW]
      ): TC[DFBits[LW], V] with
        def conv(dfType: DFBits[LW], value: V): DFValOf[DFBits[LW]] =
          val dfVal = candidate(value)
          ???
    end TC
  end Val

end CompanionsDFBits

type DFBoolOrBit = DFType[IRDFBoolOrBit, Any]
type DFDecimal = DFType[IRDFDecimal, Any]
object DFDecimal:
  def foo(arg1: Int, arg2: Int): Unit = ???

  object Val:
    object TC:
      import DFVal.TC
      given [R]: TC[DFDecimal, R] = ???
      def apply(
          dfType: DFDecimal,
          dfVal: DFValOf[DFDecimal]
      ): DFValOf[DFDecimal] =
        foo(dfType.width, dfVal.width)
        dfVal
    end TC
  end Val
end DFDecimal

Output (click arrow to expand)

[error] ## Exception when compiling 2 sources to C:\example\target\scala-3.3.1-RC1-bin-20230325-dcf5f9d-NIGHTLY\classes
[error] dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; type Out#6462 in trait Width, defined in Period(1..62, run = 2), is referred to in run Period(2..2, run = 3)
[error] dotty.tools.dotc.core.Denotations$SingleDenotation.staleSymbolError(Denotations.scala:948)
[error] dotty.tools.dotc.core.Denotations$SingleDenotation.bringForward(Denotations.scala:752)
[error] dotty.tools.dotc.core.Denotations$SingleDenotation.toNewRun$1(Denotations.scala:799)
[error] dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:870)
[error] dotty.tools.dotc.core.Symbols$Symbol.recomputeDenot(Symbols.scala:120)
[error] dotty.tools.dotc.core.Symbols$Symbol.computeDenot(Symbols.scala:114)
[error] dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:107)
[error] dotty.tools.dotc.core.Symbols$.toDenot(Symbols.scala:494)
[error] dotty.tools.dotc.core.Types$NamedType.derivedSelect(Types.scala:2657)
[error] dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:18)
[error] dotty.tools.dotc.core.Substituters$.mapArgs$1(Substituters.scala:22)
[error] dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:22)
[error] dotty.tools.dotc.core.Substituters$.mapArgs$1(Substituters.scala:22)
[error] dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:22)
[error] dotty.tools.dotc.core.Types$Type.subst(Types.scala:1798)
[error] dotty.tools.dotc.core.Types$LambdaType.newLikeThis$$anonfun$2(Types.scala:3679)
[error] dotty.tools.dotc.core.Types$MethodType.<init>(Types.scala:3934)
[error] dotty.tools.dotc.core.Types$CachedMethodType.<init>(Types.scala:3953)
[error] dotty.tools.dotc.core.Types$MethodTypeCompanion.apply(Types.scala:4045)
[error] dotty.tools.dotc.core.Types$MethodTypeCompanion.apply(Types.scala:4044)
[error] dotty.tools.dotc.core.Types$LambdaType.newLikeThis(Types.scala:3679)
[error] dotty.tools.dotc.core.Types$LambdaType.newLikeThis$(Types.scala:3606)
[error] dotty.tools.dotc.core.Types$MethodOrPoly.newLikeThis(Types.scala:3692)
[error] dotty.tools.dotc.core.Types$LambdaType.derivedLambdaType(Types.scala:3669)
[error] dotty.tools.dotc.core.Types$LambdaType.derivedLambdaType$(Types.scala:3606)
[error] dotty.tools.dotc.core.Types$MethodOrPoly.derivedLambdaType(Types.scala:3692)
[error] dotty.tools.dotc.core.Types$TypeMap.derivedLambdaType(Types.scala:5655)
[error] dotty.tools.dotc.core.Types$TypeMap.mapOverLambda(Types.scala:5674)
[error] dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5701)
[error] dotty.tools.dotc.core.Substituters$.substParams(Substituters.scala:163)
[error] dotty.tools.dotc.core.Substituters$SubstParamsMap.apply(Substituters.scala:201)
[error] dotty.tools.dotc.core.Types$TypeMap.mapOverLambda(Types.scala:5674)
[error] dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5701)
[error] dotty.tools.dotc.core.Substituters$.substParams(Substituters.scala:163)
[error] dotty.tools.dotc.core.Types$Type.substParams(Types.scala:1818)
[error] dotty.tools.dotc.core.Types$LambdaType.instantiate(Types.scala:3645)
[error] dotty.tools.dotc.core.Types$LambdaType.instantiate$(Types.scala:3606)
[error] dotty.tools.dotc.core.Types$MethodOrPoly.instantiate(Types.scala:3692)
[error] dotty.tools.dotc.typer.TypeAssigner.assignType(TypeAssigner.scala:360)
[error] dotty.tools.dotc.typer.TypeAssigner.assignType$(TypeAssigner.scala:16)
[error] dotty.tools.dotc.typer.Typer.assignType(Typer.scala:116)
[error] dotty.tools.dotc.ast.tpd$.TypeApply(tpd.scala:58)
[error] dotty.tools.dotc.ast.tpd$TreeOps$.appliedToTypeTrees$extension(tpd.scala:979)
[error] dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4153)
[error] dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3485)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3108)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3112)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3224)
[error] dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:941)
[error] dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1101)
[error] dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:352)
[error] dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:116)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2973)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3036)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3108)
[error] dotty.tools.dotc.typer.Applications.extMethodApply(Applications.scala:2368)
[error] dotty.tools.dotc.typer.Applications.extMethodApply$(Applications.scala:352)
[error] dotty.tools.dotc.typer.Typer.extMethodApply(Typer.scala:116)
[error] dotty.tools.dotc.typer.Typer.tryExtension$1(Typer.scala:3396)
[error] dotty.tools.dotc.typer.Typer.tryExtensionOrConversion(Typer.scala:3409)
[error] dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:644)
[error] dotty.tools.dotc.typer.Typer.typeSelectOnTerm$1(Typer.scala:694)
[error] dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:731)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2942)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3035)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3108)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3112)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3161)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3180)
[error] dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1100)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1104)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2981)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3036)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3108)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3112)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3224)
[error] dotty.tools.dotc.typer.Typer.$anonfun$57(Typer.scala:2411)
[error] dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:250)
[error] dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2411)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2949)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3035)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3108)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3112)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3134)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3180)
[error] dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2594)
[error] dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:2961)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2965)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3035)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3108)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3112)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3134)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3180)
[error] dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2594)
[error] dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:2961)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2965)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3035)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3108)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3112)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3134)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3180)
[error] dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2594)
[error] dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:2961)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2965)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3035)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3108)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3112)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3134)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3180)
[error] dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2594)
[error] dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:2961)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2965)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3035)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3108)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3112)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3134)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3180)
[error] dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2737)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3006)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3036)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3108)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3112)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3224)
[error] dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:44)
[error] dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$adapted$1(TyperPhase.scala:54)
[error] scala.Function0.apply$mcV$sp(Function0.scala:42)
[error] dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:437)
[error] dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:54)
[error] dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$3(TyperPhase.scala:88)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:333)
[error] dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:88)
[error] dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
[error] dotty.tools.dotc.Run.runPhases$1(Run.scala:262)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:279)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:200)
[error] dotty.tools.dotc.Driver.finish(Driver.scala:58)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
[error] dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
[error] dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:193)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:248)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:183)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
[error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:211)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:179)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:177)
[error] sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:463)
[error] sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
[error] sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:418)
[error] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:506)
[error] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:405)
[error] sbt.internal.inc.Incremental$.apply(Incremental.scala:171)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:488)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:425)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2363)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2313)
[error] sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:30)
[error] sbt.internal.io.Retry$.apply(Retry.scala:46)
[error] sbt.internal.io.Retry$.apply(Retry.scala:28)
[error] sbt.internal.io.Retry$.apply(Retry.scala:23)
[error] sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:30)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2311)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] sbt.Execute.work(Execute.scala:291)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[error] java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[error] java.base/java.lang.Thread.run(Thread.java:831)
[error]
[error] stack trace is suppressed; run last core / Compile / compileIncremental for the full output
[error] (core / Compile / compileIncremental) dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; type Out#6462 in trait Width, defined in Period(1..62, run = 2), is referred to in run Period(2..2, run = 3)
@soronpo soronpo added itype:bug itype:crash stat:needs minimization Needs a self contained minimization regression This worked in a previous version but doesn't anymore stat:needs triage Every issue needs to have an "area" and "itype" label area:typer and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 26, 2023
@soronpo soronpo changed the title Crash regression from #17088 Crash (regression): dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol Mar 29, 2023
@soronpo soronpo removed the stat:needs minimization Needs a self contained minimization label Mar 29, 2023
odersky added a commit that referenced this issue Jun 30, 2023
#18077)

Closes #17152
Closes #17294

In general the issues stemmed from the fact that after suspending runs
due to the found macros, when typing Ident of the called method, symbols
from the previous run are found there. Some of them either are able to
have their validity updated while returning the denotation (which those
path dependent types are unable to do, since their owners now have
updated decls, which do not include the stale symbol), or do not need
denotation as part of a code path they rely on.

The fixes simply check if the to-be-used symbol has a valid runID, and
if not then recomputes it.

The first commit fixes the minimizations from above GitHub issues. Both
minimizations by design have to result in cyclic macro errors (which
they now do), so they were placed in `neg-macros` tests.

By some experimentation, I ended up with another, slightly different
stale symbol crash, with the stale symbol trying to create a denotation
in different place (in `withPrefix`), requiring an additional fix there,
included in the second commit. This minimization, unlike the previous
ones, does compile successfully, without cyclic macro errors, which
shows the issue was not exclusive to those.
@Kordyjan Kordyjan added this to the 3.4.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:typer itype:bug itype:crash regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants