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

Incremental compilation leads to Cyclic Reference Error #20245

Closed
b-studios opened this issue Apr 22, 2024 · 13 comments · Fixed by #20251
Closed

Incremental compilation leads to Cyclic Reference Error #20245

b-studios opened this issue Apr 22, 2024 · 13 comments · Fixed by #20251

Comments

@b-studios
Copy link
Contributor

b-studios commented Apr 22, 2024

Incrementally recompiling leads to "Cyclic reference" while fresh compilation succeeds.

We consistently hit this issue when touching our own Typer.scala forcing us to always clean; compile which of course takes longer than incrementally compiling.

Compiler version

3.3.1, 3.4.1

Minimized code

I minimized our compiler to only a few lines of code in:

effekt-lang/effekt#446

the full minimized example (not the diff or PR) can be found here

https://github.com/effekt-lang/effekt/tree/34b9e79126db91604df4785aaabace15d154f8cb

Output

[error] -- [E046] Cyclic Error: /private/tmp/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:15:57
[error] 15 |  private[typer] val unification = new Unification(using this)
[error]    |                                                         ^
[error]    |                                Cyclic reference involving class Context
[error]    |
[error]    | longer explanation available when compiling with `-explain`
[error] one error found
[error] (root / Compile / compileIncremental) Compilation failed

Expectation

It should consistently compile or always report the error, if this is indeed a problem.

@b-studios b-studios added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 22, 2024
@Gedochao Gedochao added area:implicits related to implicits area:incremental-compilation and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 23, 2024
@odersky
Copy link
Contributor

odersky commented Apr 23, 2024

Thanks for the minimization! Here's a standalone reproducer as a pos test:

  1. Take the scala files in the project and put them in one directory, append _1 to every name in front of the .scala extension.
  2. Copy Typer_1.scala to Typer_2. scala

Run as pos test.

@odersky odersky self-assigned this Apr 23, 2024
@odersky
Copy link
Contributor

odersky commented Apr 23, 2024

It works without cyclic errors if unification has an explicit type:

private[typer] val unification: Unification = new Unification(using this)

@b-studios
Copy link
Contributor Author

b-studios commented Apr 23, 2024

Hey thanks for looking into it. Maybe I reduced it too much :(

In the original compiler adding the type annotation to unification does not help and I still get long errors:

[error] -- [E046] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:10:7
[error] 10 |import effekt.source.{AnyPattern, Def, Effectful, IgnorePattern, MatchGuard, MatchPattern, ModuleDecl, Stmt, TagPattern, Term, Tree, resolve, symbol}
[error]    |       ^
[error]    |       Cyclic reference involving class Context
[error]    |
[error]    | longer explanation available when compiling with `-explain`
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:111:23
[error] 111 |        Result(Context.join(thnTpe, elsTpe), guardEffs ++ thnEffs ++ elsEffs)
[error]     |               ^^^^^^^^^^^^
[error]     |value join is not a member of effekt.context.Context - did you mean x$3.bind?
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:121:23
[error] 121 |        Result(Context.join(bodyTpe, defaultTpe), defaultEffs ++ bodyEffs)
[error]     |               ^^^^^^^^^^^^
[error]     |value join is not a member of effekt.context.Context - did you mean x$3.bind?
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:148:61
[error] 148 |        val inferredCap: Captures = annotatedCapture.map { _.resolve }.getOrElse {
[error]     |                                                           ^^^^^^^^^
[error]     |value resolve is not a member of effekt.source.CaptureSet, but could be made available as an extension method.
[error]     |
[error]     |One of the following imports might fix the problem:
[error]     |
[error]     |  import effekt.source.Resolvable.resolve
[error]     |  import effekt.source.resolve
[error]     |
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:149:18
[error] 149 |          Context.freshCaptVar(CaptUnificationVar.InferredBox(l))
[error]     |          ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:167:81
[error] 167 |        val Result(tpe, effs) = checkOverloadedFunctionCall(c, op, targs map { _.resolve }, vargs, bargs, expected)
[error]     |                                                                               ^^^^^^^^^
[error]     |value resolve is not a member of effekt.source.ValueType, but could be made available as an extension method.
[error]     |
[error]     |One of the following imports might fix the problem:
[error]     |
[error]     |  import effekt.source.Resolvable.resolve
[error]     |  import effekt.source.resolve
[error]     |
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:185:59
[error] 185 |        checkOverloadedFunctionCall(c, t.id, targs map { _.resolve }, vargs, bargs, expected)
[error]     |                                                         ^^^^^^^^^
[error]     |value resolve is not a member of effekt.source.ValueType, but could be made available as an extension method.
[error]     |
[error]     |One of the following imports might fix the problem:
[error]     |
[error]     |  import effekt.source.Resolvable.resolve
[error]     |  import effekt.source.resolve
[error]     |
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:193:75
[error] 193 |        val Result(t, eff) = checkCallTo(c, "function", tpe, targs map { _.resolve }, vargs, bargs, expected)
[error]     |                                                                         ^^^^^^^^^
[error]     |value resolve is not a member of effekt.source.ValueType, but could be made available as an extension method.
[error]     |
[error]     |One of the following imports might fix the problem:
[error]     |
[error]     |  import effekt.source.Resolvable.resolve
[error]     |  import effekt.source.resolve
[error]     |
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:199:65
[error] 199 |        checkOverloadedMethodCall(c, receiver, id, targs map { _.resolve }, vargs, bargs, expected)
[error]     |                                                               ^^^^^^^^^
[error]     |value resolve is not a member of effekt.source.ValueType, but could be made available as an extension method.
[error]     |
[error]     |One of the following imports might fix the problem:
[error]     |
[error]     |  import effekt.source.Resolvable.resolve
[error]     |  import effekt.source.resolve
[error]     |
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:205:38
[error] 205 |        val inferredCapture = Context.freshCaptVar(CaptUnificationVar.RegionRegion(tree))
[error]     |                              ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:208:28
[error] 208 |        flowingInto(Context.without(inferredCapture, List(reg.capture))) {
[error]     |                    ^^^^^^^^^^^^^^^
[error]     |value without is not a member of effekt.context.Context - did you mean x$3.withFocus?
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:216:47
[error] 216 |          val effect: InterfaceType = h.effect.resolve
[error]     |                                      ^^^^^^^^^^^^^^^^
[error]     |value resolve is not a member of effekt.source.BlockType.BlockTypeRef, but could be made available as an extension method.
[error]     |
[error]     |One of the following imports might fix the problem:
[error]     |
[error]     |  import effekt.source.Resolvable.resolve
[error]     |  import effekt.source.resolve
[error]     |
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:223:39
[error] 223 |        val continuationCapt = Context.freshCaptVar(CaptUnificationVar.HandlerRegion(tree))
[error]     |                               ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:226:46
[error] 226 |        val continuationCaptHandled = Context.without(continuationCapt, providedCapabilities.map(_.capture))
[error]     |                                      ^^^^^^^^^^^^^^^
[error]     |value without is not a member of effekt.context.Context - did you mean x$3.withFocus?
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:315:23
[error] 315 |        Result(Context.join(tpes: _*), resEff)
[error]     |               ^^^^^^^^^^^^
[error]     |value join is not a member of effekt.context.Context - did you mean x$3.bind?
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:345:56
[error] 345 |      val tpe @ InterfaceType(constructor, targs) = sig.resolve
[error]     |                                                    ^^^^^^^^^^^
[error]     |value resolve is not a member of effekt.source.BlockType.BlockTypeRef, but could be made available as an extension method.
[error]     |
[error]     |One of the following imports might fix the problem:
[error]     |
[error]     |  import effekt.source.Resolvable.resolve
[error]     |  import effekt.source.resolve
[error]     |
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:345:30
[error] 345 |      val tpe @ InterfaceType(constructor, targs) = sig.resolve
[error]     |                              ^
[error]     |                              Recursive value $17$ needs type
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:345:43
[error] 345 |      val tpe @ InterfaceType(constructor, targs) = sig.resolve
[error]     |                                           ^
[error]     |                                       Recursive value $17$ needs type
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E006] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:364:17
[error] 364 |            case Effectful(otherTpe, otherEffs2) =>
[error]     |                 ^^^^^^^^^
[error]     |                 Not found: Effectful
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:406:24
[error] 406 |                Context.instantiate(declaredType, targs ++ existentials, cparams.map(cap => CaptureSet(cap))) : @unchecked
[error]     |                ^^^^^^^^^^^^^^^^^^^
[error]     |           value instantiate is not a member of effekt.context.Context
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:405:41
[error] 405 |              val FunctionType(Nil, Nil, vps, bps, tpe, effs) =
[error]     |                                         ^
[error]     |                                       Recursive value $18$ needs type
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:405:46
[error] 405 |              val FunctionType(Nil, Nil, vps, bps, tpe, effs) =
[error]     |                                              ^
[error]     |                                       Recursive value $18$ needs type
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:405:51
[error] 405 |              val FunctionType(Nil, Nil, vps, bps, tpe, effs) =
[error]     |                                                   ^
[error]     |                                       Recursive value $18$ needs type
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:405:56
[error] 405 |              val FunctionType(Nil, Nil, vps, bps, tpe, effs) =
[error]     |                                                        ^
[error]     |                                       Recursive value $18$ needs type
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E134] Type Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:412:40
[error] 412 |                  annotatedType.foreach(matchDeclared(_, declaredType, param))
[error]     |                                        ^^^^^^^^^^^^^
[error]     |None of the overloaded alternatives of method matchDeclared in object Typer with types
[error]     | (got: effekt.symbols.ValueType, declared: effekt.symbols.ValueType, param:
[error]     |  effekt.source.Param)(using x$4: effekt.context.Context): Unit
[error]     | (got: effekt.symbols.BlockType, declared: effekt.symbols.BlockType, param:
[error]     |  effekt.source.Param)(using x$4: effekt.context.Context): Unit
[error]     |match arguments ((_$16 : effekt.symbols.ValueType), (declaredType : Any), (param : effekt.source.Param.ValueParam))
[error] -- [E134] Type Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:413:26
[error] 413 |                  Context.bind(sym, annotatedType.getOrElse(declaredType))
[error]     |                  ^^^^^^^^^^^^
[error]     |None of the overloaded alternatives of method bind in trait TyperOps with types
[error]     | (p: effekt.symbols.TrackedParam): Unit
[error]     | (p: effekt.symbols.ValueParam): Unit
[error]     | (bs: Map[effekt.symbols.Symbol, effekt.symbols.ValueType]): Unit
[error]     | (s: effekt.symbols.BlockSymbol, capt: effekt.symbols.Captures): Unit
[error]     | (s: effekt.symbols.BlockSymbol, tpe: effekt.symbols.BlockType): Unit
[error]     | (s: effekt.symbols.BlockSymbol, tpe: effekt.symbols.BlockType, capt:
[error]     |  effekt.symbols.Captures): Unit
[error]     | (s: effekt.symbols.ValueSymbol, tpe: effekt.symbols.ValueType): Unit
[error]     |match arguments ((sym : effekt.symbols.ValueParam), B)
[error]     |
[error]     |where:    B is a type variable with constraint >: effekt.symbols.ValueType | (declaredType : Any
[error] -- [E134] Type Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:420:18
[error] 420 |                  matchDeclared(annotatedType, declaredType, param)
[error]     |                  ^^^^^^^^^^^^^
[error]     |None of the overloaded alternatives of method matchDeclared in object Typer with types
[error]     | (got: effekt.symbols.ValueType, declared: effekt.symbols.ValueType, param:
[error]     |  effekt.source.Param)(using x$4: effekt.context.Context): Unit
[error]     | (got: effekt.symbols.BlockType, declared: effekt.symbols.BlockType, param:
[error]     |  effekt.source.Param)(using x$4: effekt.context.Context): Unit
[error]     |match arguments ((annotatedType : effekt.symbols.BlockType), (declaredType : Any), (param : effekt.source.Param.BlockParam))
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:447:24
[error] 447 |                Context.instantiate(declaredType, targs ++ existentials, cparams.map(cap => CaptureSet(cap))) : @unchecked
[error]     |                ^^^^^^^^^^^^^^^^^^^
[error]     |           value instantiate is not a member of effekt.context.Context
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:446:41
[error] 446 |              val FunctionType(Nil, Nil, vps, bps, tpe, effs) =
[error]     |                                         ^
[error]     |                                       Recursive value $20$ needs type
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:446:46
[error] 446 |              val FunctionType(Nil, Nil, vps, bps, tpe, effs) =
[error]     |                                              ^
[error]     |                                       Recursive value $20$ needs type
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:446:51
[error] 446 |              val FunctionType(Nil, Nil, vps, bps, tpe, effs) =
[error]     |                                                   ^
[error]     |                                       Recursive value $20$ needs type
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:446:56
[error] 446 |              val FunctionType(Nil, Nil, vps, bps, tpe, effs) =
[error]     |                                                        ^
[error]     |                                       Recursive value $20$ needs type
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E134] Type Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:453:40
[error] 453 |                  annotatedType.foreach(matchDeclared(_, declaredType, param))
[error]     |                                        ^^^^^^^^^^^^^
[error]     |None of the overloaded alternatives of method matchDeclared in object Typer with types
[error]     | (got: effekt.symbols.ValueType, declared: effekt.symbols.ValueType, param:
[error]     |  effekt.source.Param)(using x$4: effekt.context.Context): Unit
[error]     | (got: effekt.symbols.BlockType, declared: effekt.symbols.BlockType, param:
[error]     |  effekt.source.Param)(using x$4: effekt.context.Context): Unit
[error]     |match arguments ((_$17 : effekt.symbols.ValueType), (declaredType : Any), (param : effekt.source.Param.ValueParam))
[error] -- [E134] Type Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:454:26
[error] 454 |                  Context.bind(sym, annotatedType.getOrElse(declaredType))
[error]     |                  ^^^^^^^^^^^^
[error]     |None of the overloaded alternatives of method bind in trait TyperOps with types
[error]     | (p: effekt.symbols.TrackedParam): Unit
[error]     | (p: effekt.symbols.ValueParam): Unit
[error]     | (bs: Map[effekt.symbols.Symbol, effekt.symbols.ValueType]): Unit
[error]     | (s: effekt.symbols.BlockSymbol, capt: effekt.symbols.Captures): Unit
[error]     | (s: effekt.symbols.BlockSymbol, tpe: effekt.symbols.BlockType): Unit
[error]     | (s: effekt.symbols.BlockSymbol, tpe: effekt.symbols.BlockType, capt:
[error]     |  effekt.symbols.Captures): Unit
[error]     | (s: effekt.symbols.ValueSymbol, tpe: effekt.symbols.ValueType): Unit
[error]     |match arguments ((sym : effekt.symbols.ValueParam), B)
[error]     |
[error]     |where:    B is a type variable with constraint >: effekt.symbols.ValueType | (declaredType : Any
[error] -- [E051] Reference Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:476:14
[error] 476 |      Context.annotateInferredType(impl, tpe)
[error]     |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |Ambiguous overload. The overloaded alternatives of method annotateInferredType in trait TyperOps with types
[error]     | (t: effekt.source.Tree, e: effekt.symbols.BlockType): Unit
[error]     | (t: effekt.source.Tree, e: effekt.symbols.ValueType): Unit
[error]     |both match arguments ((impl : effekt.source.Implementation), (tpe : Nothing))
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:491:34
[error] 491 |            val captVar = Context.freshCaptVar(CaptUnificationVar.InferredUnbox(u))
[error]     |                          ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:543:14
[error] 543 |      Context.requireSubtype(sc, lit.tpe, ErrorContext.PatternMatch(p))
[error]     |      ^^^^^^^^^^^^^^^^^^^^^^
[error]     |      value requireSubtype is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:554:60
[error] 554 |      val freshUniversals   = universals.map { t => Context.freshTypeVar(t, pattern) }
[error]     |                                                    ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshTypeVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:562:55
[error] 562 |      val FunctionType(_, _, vps, _, ret, _) = Context.instantiate(sym.toType, targs, Nil)
[error]     |                                               ^^^^^^^^^^^^^^^^^^^
[error]     |           value instantiate is not a member of effekt.context.Context
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:562:29
[error] 562 |      val FunctionType(_, _, vps, _, ret, _) = Context.instantiate(sym.toType, targs, Nil)
[error]     |                             ^
[error]     |                             Recursive value $23$ needs type
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:562:37
[error] 562 |      val FunctionType(_, _, vps, _, ret, _) = Context.instantiate(sym.toType, targs, Nil)
[error]     |                                     ^
[error]     |                                     Recursive value $23$ needs type
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E006] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:582:9
[error] 582 |    case MatchGuard.BooleanGuard(condition) =>
[error]     |         ^^^^^^^^^^
[error]     |         Not found: MatchGuard
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E007] Type Mismatch Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:583:40
[error] 583 |      val Result(tpe, effs) = checkExpr(condition, Some(TBoolean))
[error]     |                                        ^^^^^^^^^
[error]     |                                        Found:    (condition : Any)
[error]     |                                        Required: effekt.source.Term
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:583:17
[error] 583 |      val Result(tpe, effs) = checkExpr(condition, Some(TBoolean))
[error]     |                 ^
[error]     |                 Recursive value $24$ needs type
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:583:22
[error] 583 |      val Result(tpe, effs) = checkExpr(condition, Some(TBoolean))
[error]     |                      ^
[error]     |                      Recursive value $24$ needs type
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E006] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:585:9
[error] 585 |    case MatchGuard.PatternGuard(scrutinee, pattern) =>
[error]     |         ^^^^^^^^^^
[error]     |         Not found: MatchGuard
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E007] Type Mismatch Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:586:40
[error] 586 |      val Result(tpe, effs) = checkExpr(scrutinee, None)
[error]     |                                        ^^^^^^^^^
[error]     |                                        Found:    (scrutinee : Any)
[error]     |                                        Required: effekt.source.Term
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:586:17
[error] 586 |      val Result(tpe, effs) = checkExpr(scrutinee, None)
[error]     |                 ^
[error]     |                 Recursive value $25$ needs type
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:586:22
[error] 586 |      val Result(tpe, effs) = checkExpr(scrutinee, None)
[error]     |                      ^
[error]     |                      Recursive value $25$ needs type
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E007] Type Mismatch Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:587:31
[error] 587 |      Result(checkPattern(tpe, pattern), effs)
[error]     |                               ^^^^^^^
[error]     |                               Found:    (pattern : Any)
[error]     |                               Required: effekt.source.MatchPattern
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:609:40
[error] 609 |          val inferredCapture = Context.freshCaptVar(CaptUnificationVar.VarRegion(d))
[error]     |                                ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:612:30
[error] 612 |          flowingInto(Context.without(inferredCapture, List(sym.capture))) {
[error]     |                      ^^^^^^^^^^^^^^^
[error]     |value without is not a member of effekt.context.Context - did you mean x$3.withFocus?
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:641:24
[error] 641 |      val cap = Context.freshCaptVar(CaptUnificationVar.FunctionRegion(d))
[error]     |                ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:651:24
[error] 651 |      val cap = Context.freshCaptVar(CaptUnificationVar.BlockRegion(d))
[error]     |                ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:722:40
[error] 722 |          val inferredCapture = Context.freshCaptVar(CaptUnificationVar.FunctionRegion(d))
[error]     |                                ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:824:60
[error] 824 |        given inferredCapture: CaptUnificationVar = Context.freshCaptVar(CaptUnificationVar.BlockRegion(d))
[error]     |                                                    ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:930:31
[error] 930 |      val bodyRegion = Context.freshCaptVar(CaptUnificationVar.AnonymousFunctionRegion(arg))
[error]     |                       ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:963:36
[error] 963 |      val inferredCapture = Context.freshCaptVar(CaptUnificationVar.AnonymousFunctionRegion(arg)
[error]     |                            ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1054:62
[error] 1054 |          case (param :: params, Nil) => ValueTypeRef(Context.freshTypeVar(param, call)) :: fillInTypeArguments(params, Nil)
[error]      |                                                      ^^^^^^^^^^^^^^^^^^^^
[error]      |        value freshTypeVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1188:88
[error] 1188 |    val (typeArgs, captArgs, bt @ FunctionType(_, _, vps, bps, ret, retEffs)) = Context.instantiateFresh(funTpe)
[error]      |                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^
[error]      |    value instantiateFresh is not a member of effekt.context.Context
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1188:9
[error] 1188 |    val (typeArgs, captArgs, bt @ FunctionType(_, _, vps, bps, ret, retEffs)) = Context.instantiateFresh(funTpe)
[error]      |         ^
[error]      |         Recursive value $51$ needs type
[error]      |
[error]      | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1188:19
[error] 1188 |    val (typeArgs, captArgs, bt @ FunctionType(_, _, vps, bps, ret, retEffs)) = Context.instantiateFresh(funTpe)
[error]      |                   ^
[error]      |                   Recursive value $51$ needs type
[error]      |
[error]      | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1188:29
[error] 1188 |    val (typeArgs, captArgs, bt @ FunctionType(_, _, vps, bps, ret, retEffs)) = Context.instantiateFresh(funTpe)
[error]      |                             ^
[error]      |                             Recursive value $51$ needs type
[error]      |
[error]      | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1188:53
[error] 1188 |    val (typeArgs, captArgs, bt @ FunctionType(_, _, vps, bps, ret, retEffs)) = Context.instantiateFresh(funTpe)
[error]      |                                                     ^
[error]      |                                     Recursive value $51$ needs type
[error]      |
[error]      | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1188:58
[error] 1188 |    val (typeArgs, captArgs, bt @ FunctionType(_, _, vps, bps, ret, retEffs)) = Context.instantiateFresh(funTpe)
[error]      |                                                          ^
[error]      |                                     Recursive value $51$ needs type
[error]      |
[error]      | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1188:63
[error] 1188 |    val (typeArgs, captArgs, bt @ FunctionType(_, _, vps, bps, ret, retEffs)) = Context.instantiateFresh(funTpe)
[error]      |                                                               ^
[error]      |                                     Recursive value $51$ needs type
[error]      |
[error]      | longer explanation available when compiling with `-explain`
[error] -- [E045] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1188:68
[error] 1188 |    val (typeArgs, captArgs, bt @ FunctionType(_, _, vps, bps, ret, retEffs)) = Context.instantiateFresh(funTpe)
[error]      |                                                                    ^
[error]      |                                     Recursive value $51$ needs type
[error]      |
[error]      | longer explanation available when compiling with `-explain`
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1317:6
[error] 1317 |    C.requireSubregion(c, current)
[error]      |    ^^^^^^^^^^^^^^^^^^
[error]      |    value requireSubregion is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1329:6
[error] 1329 |    C.requireSubregion(from, to)
[error]      |    ^^^^^^^^^^^^^^^^^^
[error]      |    value requireSubregion is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1335:6
[error] 1335 |    C.requireSubregionWithout(from, to, filter)
[error]      |    ^^^^^^^^^^^^^^^^^^^^^^^^^
[error]      |value requireSubregionWithout is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1342:14
[error] 1342 |      Context.requireSubtype(got, declared,
[error]      |      ^^^^^^^^^^^^^^^^^^^^^^
[error]      |      value requireSubtype is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1347:14
[error] 1347 |      Context.requireSubtype(got, declared,
[error]      |      ^^^^^^^^^^^^^^^^^^^^^^
[error]      |      value requireSubtype is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1352:12
[error] 1352 |    Context.requireSubtype(scrutinee, patternTpe, ErrorContext.PatternMatch(pattern))
[error]      |    ^^^^^^^^^^^^^^^^^^^^^^
[error]      |    value requireSubtype is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1355:12
[error] 1355 |    Context.requireSubtype(got, expected,
[error]      |    ^^^^^^^^^^^^^^^^^^^^^^
[error]      |    value requireSubtype is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1359:12
[error] 1359 |    Context.requireSubtype(got, expected,
[error]      |    ^^^^^^^^^^^^^^^^^^^^^^
[error]      |    value requireSubtype is not a member of effekt.context.Context
[error] -- [E006] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1639:30
[error] 1639 |    var capturesForLSP: List[(Tree, CaptureSet)] = Nil
[error]      |                              ^^^^
[error]      |                              Not found: type Tree
[error]      |
[error]      | longer explanation available when compiling with `-explain`
[error] 76 errors found

The spurious Recursive value $25$ needs type are confusing. They are not really recursive.

odersky added a commit to dotty-staging/dotty that referenced this issue Apr 23, 2024
Also report type-checked right hand sides and export expansions.

Streamline trace-handling code using inline functions.

Fixes scala#20245
odersky added a commit to dotty-staging/dotty that referenced this issue Apr 23, 2024
…ava.

We don't usually need it. I played with it to figure out scala#20245, and found out it
was set up incorrectly.
@odersky
Copy link
Contributor

odersky commented Apr 23, 2024

I added some more diagnostics in #20251. You need to compile with -explain-cyclic then that gives hopefully more info.

It's unfortunately not feasible to ensure that cyclic errors appear independent of compilation order.

Also, messages after the first "Cyclic Reference" should usually be ignored. Once a cyclic reference happens all bets are off and follow-on errors are expected.

@odersky
Copy link
Contributor

odersky commented Apr 24, 2024

@b-studios Did you compile the project with -explain-cyclic? Any new insights what might be the cause? If not I could take a look at the error trace. Ideally, with -explain-cyclic and -Ydebug-cyclic both set.

@b-studios
Copy link
Contributor Author

b-studios commented Apr 26, 2024

@odersky Here is the trace generated by the latest nightly 3.5.0-RC1-bin-20240425-912d886-NIGHTLY with the two options you mentioned

[error] -- [E046] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1449:57
[error] 1449 |  private[typer] val unification = new Unification(using this)
[error]      |                                                         ^
[error]      |Cyclic reference involving class Context
[error]      |
[error]      |The error occurred while trying to compute the base classes of class Context
[error]      |  which required to compute the base classes of trait TyperOps
[error]      |  which required to compute the signature of trait TyperOps
[error]      |  which required to compute the signature of value unification
[error]      |  which required to compute the base classes of class Context
[error]      |
[error]      |Stacktrace:
[error]      |    dotty.tools.dotc.core.CyclicReference$.apply(TypeErrors.scala:193)
[error]      |    dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:3001)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1979)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClassSet(SymDenotations.scala:1995
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.derivesFrom(SymDenotations.scala:2021)
[error]      |    dotty.tools.dotc.core.Types$Type.loop$1(Types.scala:279)
[error]      |    dotty.tools.dotc.core.Types$Type.loop$1(Types.scala:287)
[error]      |    dotty.tools.dotc.core.Types$Type.derivesFrom(Types.scala:303)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeAndOrType$1(SymDenotations.scala:2313)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.recur$4(SymDenotations.scala:2327)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeTypeProxy$1(SymDenotations.scala:2295)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.recur$4(SymDenotations.scala:2303)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseTypeOf(SymDenotations.scala:2347)
[error]      |    dotty.tools.dotc.core.Types$Type.baseType(Types.scala:1203)
[error]      |    dotty.tools.dotc.core.TypeComparer.nonExprBaseType(TypeComparer.scala:1575)
[error]      |    dotty.tools.dotc.core.TypeComparer.tryBaseType$1(TypeComparer.scala:898)
[error]      |    dotty.tools.dotc.core.TypeComparer.thirdTryNamed$1(TypeComparer.scala:589)
[error]      |    dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:627)
[error]      |    dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:458)
[error]      |    dotty.tools.dotc.core.TypeComparer.compareNamed$1(TypeComparer.scala:337)
[error]      |    dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:343)
[error]      |    dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1557)
[error]      |    dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:214)
[error]      |    dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:224)
[error]      |    dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:132)
[error]      |    dotty.tools.dotc.core.TypeComparer.testSubType(TypeComparer.scala:149)
[error]      |    dotty.tools.dotc.core.TypeComparer$.testSubType(TypeComparer.scala:3206)
[error]      |    dotty.tools.dotc.typer.Typer.adaptNoArgsOther$1(Typer.scala:4098)
[error]      |    dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:4185)
[error]      |    dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4413)
[error]      |    dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3701)
[error]      |    dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:498)
[error]      |    dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:929)
[error]      |    dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:929)
[error]      |    dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:621)
[error]      |    dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:685)
[error]      |    dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:507)
[error]      |    dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:811)
[error]      |    dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:928)
[error]      |    dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1159)
[error]      |    dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:367)
[error]      |    dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:120)
[error]      |    dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:1001)
[error]      |    dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$2(Applications.scala:1084)
[error]      |    dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3437)
[error]      |    dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1095)
[error]      |    dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1133)
[error]      |    dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:367)
[error]      |    dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:120)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3137)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
[error]      |    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
[error]      |    dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1702)
[error]      |    dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1692)
[error]      |    dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1702)
[error]      |    dotty.tools.dotc.typer.Namer.typedAheadRhs$1$$anonfun$1(Namer.scala:1958)
[error]      |    dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:256)
[error]      |    dotty.tools.dotc.typer.Namer.typedAheadRhs$1(Namer.scala:1958)
[error]      |    dotty.tools.dotc.typer.Namer.rhsType$1(Namer.scala:1966)
[error]      |    dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1985)
[error]      |    dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1986)
[error]      |    dotty.tools.dotc.typer.Namer.inferredResultType(Namer.scala:1997)
[error]      |    dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1740)
[error]      |    dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1746)
[error]      |    dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:804)
[error]      |    dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:955)
[error]      |    dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:831)
[error]      |    dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:178)
[error]      |    dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
[error]      |    dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
[error]      |    dotty.tools.dotc.core.Denotations$SingleDenotation.computeAsSeenFrom(Denotations.scala:1130
[error]      |    dotty.tools.dotc.core.Denotations$SingleDenotation.computeAsSeenFrom(Denotations.scala:1083
[error]      |    dotty.tools.dotc.core.Denotations$PreDenotation.asSeenFrom(Denotations.scala:137)
[error]      |    dotty.tools.dotc.core.Denotations$SingleDenotation.mapInherited(Denotations.scala:1065)
[error]      |    dotty.tools.dotc.core.Denotations$SingleDenotation.mapInherited(Denotations.scala:1062)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.collect$1(SymDenotations.scala:2175)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.collect$1(SymDenotations.scala:2171)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.collect$1(SymDenotations.scala:2171)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.addInherited(SymDenotations.scala:2180
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMembersNamed(SymDenotations.scala:2165)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.membersNamed(SymDenotations.scala:2132
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.findMember(SymDenotations.scala:2183)
[error]      |    dotty.tools.dotc.core.Types$Type.go$1(Types.scala:764)
[error]      |    dotty.tools.dotc.core.Types$Type.goAnd$1(Types.scala:921)
[error]      |    dotty.tools.dotc.core.Types$Type.go$1(Types.scala:798)
[error]      |    dotty.tools.dotc.core.Types$Type.goThis$1(Types.scala:872)
[error]      |    dotty.tools.dotc.core.Types$Type.go$1(Types.scala:781)
[error]      |    dotty.tools.dotc.core.Types$Type.findMember(Types.scala:945)
[error]      |    dotty.tools.dotc.core.ContextOps$.denotNamed(ContextOps.scala:41)
[error]      |    dotty.tools.dotc.typer.Typer.loop$1(Typer.scala:458)
[error]      |    dotty.tools.dotc.typer.Typer.findRefRecur$1(Typer.scala:525)
[error]      |    dotty.tools.dotc.typer.Typer.findRef(Typer.scala:528)
[error]      |    dotty.tools.dotc.typer.Typer.typedIdent(Typer.scala:589)
[error]      |    dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3111)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3220)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
[error]      |    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
[error]      |    dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1702)
[error]      |    dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1692)
[error]      |    dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1702)
[error]      |    dotty.tools.dotc.typer.Namer$ClassCompleter.exportForwarders(Namer.scala:1124)
[error]      |    dotty.tools.dotc.typer.Namer$ClassCompleter.processExport$1(Namer.scala:1424)
[error]      |    dotty.tools.dotc.typer.Namer$ClassCompleter.process$1(Namer.scala:1445)
[error]      |    dotty.tools.dotc.typer.Namer$ClassCompleter.processExports(Namer.scala:1466)
[error]      |    dotty.tools.dotc.typer.Namer$ClassCompleter.completeInCreationContext(Namer.scala:1667)
[error]      |    dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:831)
[error]      |    dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:178)
[error]      |    dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
[error]      |    dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.parentTypes(SymDenotations.scala:1925)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:2000)
[error]      |    dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:3005)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1979)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClasses(SymDenotations.scala:1986)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.traverse$1(SymDenotations.scala:2007)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:2013)
[error]      |    dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:3005)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1979)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClassSet(SymDenotations.scala:1995
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.derivesFrom(SymDenotations.scala:2021)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.isValueClass(SymDenotations.scala:2061
[error]      |    dotty.tools.dotc.core.SymUtils.isDerivedValueClass(SymUtils.scala:85)
[error]      |    dotty.tools.dotc.core.TypeErasure.dotty$tools$dotc$core$TypeErasure$$sigName(TypeErasure.scala:905)
[error]      |    dotty.tools.dotc.core.TypeErasure$.sigName(TypeErasure.scala:234)
[error]      |    dotty.tools.dotc.core.Signature.$anonfun$2(Signature.scala:111)
[error]      |    scala.collection.immutable.List.map(List.scala:246)
[error]      |    dotty.tools.dotc.core.Signature.prependTermParams(Signature.scala:111)
[error]      |    dotty.tools.dotc.core.Types$MethodOrPoly.computeSignature$2(Types.scala:3954)
[error]      |    dotty.tools.dotc.core.Types$MethodOrPoly.signature(Types.scala:3971)
[error]      |    dotty.tools.dotc.core.Types$MethodOrPoly.computeSignature$2(Types.scala:3942)
[error]      |    dotty.tools.dotc.core.Types$MethodOrPoly.signature(Types.scala:3971)
[error]      |    dotty.tools.dotc.core.Denotations$SingleDenotation.signature(Denotations.scala:623)
[error]      |    dotty.tools.dotc.core.Denotations$SingleDenotation.matchesLoosely(Denotations.scala:1036)
[error]      |    dotty.tools.dotc.core.Denotations$SingleDenotation.matches(Denotations.scala:1020)
[error]      |    dotty.tools.dotc.core.Denotations$Denotation.mergeDenot$1(Denotations.scala:415)
[error]      |    dotty.tools.dotc.core.Denotations$Denotation.meet(Denotations.scala:505)
[error]      |    dotty.tools.dotc.core.Denotations$DenotUnion.toDenot(Denotations.scala:1242)
[error]      |    dotty.tools.dotc.core.Denotations$DenotUnion.toDenot(Denotations.scala:1242)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.findMember(SymDenotations.scala:2187)
[error]      |    dotty.tools.dotc.core.Types$Type.go$1(Types.scala:764)
[error]      |    dotty.tools.dotc.core.Types$Type.findMember(Types.scala:945)
[error]      |    dotty.tools.dotc.core.Types$Type.memberBasedOnFlags(Types.scala:737)
[error]      |    dotty.tools.dotc.core.Types$Type.member(Types.scala:721)
[error]      |    dotty.tools.dotc.typer.Checking.checkIdent$1(Checking.scala:1580)
[error]      |    dotty.tools.dotc.typer.Checking.checkImportSelectors$$anonfun$1(Checking.scala:1595)
[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.Checking.checkImportSelectors(Checking.scala:1594)
[error]      |    dotty.tools.dotc.typer.Checking.checkImportSelectors$(Checking.scala:884)
[error]      |    dotty.tools.dotc.typer.Typer.checkImportSelectors(Typer.scala:120)
[error]      |    dotty.tools.dotc.typer.Typer.typedImport(Typer.scala:2922)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3150)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
[error]      |    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3314)
[error]      |    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
[error]      |    dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2947)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3171)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
[error]      |    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3351)
[error]      |    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
[error]      |    dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2947)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3171)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
[error]      |    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
[error]      |    dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:47)
[error]      |    scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error]      |    scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error]      |    dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:503)
[error]      |    dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:53)
[error]      |    dotty.tools.dotc.typer.TyperPhase.$anonfun$4(TyperPhase.scala:99)
[error]      |    scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:479)
[error]      |    scala.collection.Iterator$$anon$9.hasNext(Iterator.scala:583)
[error]      |    scala.collection.immutable.List.prependedAll(List.scala:152)
[error]      |    scala.collection.immutable.List$.from(List.scala:684)
[error]      |    scala.collection.immutable.List$.from(List.scala:681)
[error]      |    scala.collection.IterableOps$WithFilter.map(Iterable.scala:898)
[error]      |    dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:98)
[error]      |    dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:343)
[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:1323)
[error]      |    dotty.tools.dotc.Run.runPhases$1(Run.scala:336)
[error]      |    dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:384)
[error]      |    dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:396)
[error]      |    dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
[error]      |    dotty.tools.dotc.Run.compileUnits(Run.scala:396)
[error]      |    dotty.tools.dotc.Run.compileSources(Run.scala:282)
[error]      |    dotty.tools.dotc.Run.compile(Run.scala:267)
[error]      |    dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
[error]      |    dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:141)
[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:180)
[error]      |    sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:178)
[error]      |    sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:464)
[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:419)
[error]      |    sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:506)
[error]      |    sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:406)
[error]      |    sbt.internal.inc.Incremental$.apply(Incremental.scala:172)
[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:2371)
[error]      |    sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2321)
[error]      |    sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:31)
[error]      |    sbt.internal.io.Retry$.apply(Retry.scala:47)
[error]      |    sbt.internal.io.Retry$.apply(Retry.scala:29)
[error]      |    sbt.internal.io.Retry$.apply(Retry.scala:24)
[error]      |    sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
[error]      |    sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2319)
[error]      |    scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]      |    sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error]      |    sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error]      |    sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error]      |    sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error]      |    sbt.Execute.work(Execute.scala:292)
[error]      |    sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error]      |    sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]      |    sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error]      |    java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error]      |    java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
[error]      |    java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error]      |    java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[error]      |    java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[error]      |    java.base/java.lang.Thread.run(Thread.java:1583)
[error]      |
[error]      | longer explanation available when compiling with `-explain`
[error] -- [E046] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1449:57
[error] 1449 |  private[typer] val unification = new Unification(using this)
[error]      |                                                         ^
[error]      |Cyclic reference involving class Context
[error]      |
[error]      |The error occurred while trying to compute the base classes of class Context
[error]      |  which required to compute the base classes of trait TyperOps
[error]      |  which required to compute the signature of trait TyperOps
[error]      |  which required to compute the signature of value unification
[error]      |  which required to compute the base classes of class Context
[error]      |
[error]      |Stacktrace:
[error]      |    dotty.tools.dotc.core.CyclicReference$.apply(TypeErrors.scala:193)
[error]      |    dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:3001)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1979)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClassSet(SymDenotations.scala:1995
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.derivesFrom(SymDenotations.scala:2021)
[error]      |    dotty.tools.dotc.core.Types$Type.loop$1(Types.scala:279)
[error]      |    dotty.tools.dotc.core.Types$Type.loop$1(Types.scala:287)
[error]      |    dotty.tools.dotc.core.Types$Type.derivesFrom(Types.scala:303)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeAndOrType$1(SymDenotations.scala:2313)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.recur$4(SymDenotations.scala:2327)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeTypeProxy$1(SymDenotations.scala:2295)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.recur$4(SymDenotations.scala:2303)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseTypeOf(SymDenotations.scala:2347)
[error]      |    dotty.tools.dotc.core.Types$Type.baseType(Types.scala:1203)
[error]      |    dotty.tools.dotc.core.TypeComparer.nonExprBaseType(TypeComparer.scala:1575)
[error]      |    dotty.tools.dotc.core.TypeComparer.tryBaseType$1(TypeComparer.scala:898)
[error]      |    dotty.tools.dotc.core.TypeComparer.thirdTryNamed$1(TypeComparer.scala:589)
[error]      |    dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:627)
[error]      |    dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:458)
[error]      |    dotty.tools.dotc.core.TypeComparer.compareNamed$1(TypeComparer.scala:337)
[error]      |    dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:343)
[error]      |    dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1557)
[error]      |    dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:214)
[error]      |    dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:224)
[error]      |    dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:132)
[error]      |    dotty.tools.dotc.core.TypeComparer.testSubType(TypeComparer.scala:149)
[error]      |    dotty.tools.dotc.core.TypeComparer$.testSubType(TypeComparer.scala:3206)
[error]      |    dotty.tools.dotc.typer.Typer.adaptNoArgsOther$1(Typer.scala:4098)
[error]      |    dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:4185)
[error]      |    dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4413)
[error]      |    dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3701)
[error]      |    dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:498)
[error]      |    dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:929)
[error]      |    dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:929)
[error]      |    dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:621)
[error]      |    dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:685)
[error]      |    dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:507)
[error]      |    dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:811)
[error]      |    dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:928)
[error]      |    dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1159)
[error]      |    dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:367)
[error]      |    dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:120)
[error]      |    dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:1001)
[error]      |    dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$2(Applications.scala:1084)
[error]      |    dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3437)
[error]      |    dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1095)
[error]      |    dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1133)
[error]      |    dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:367)
[error]      |    dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:120)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3137)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
[error]      |    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
[error]      |    dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1702)
[error]      |    dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1692)
[error]      |    dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1702)
[error]      |    dotty.tools.dotc.typer.Namer.typedAheadRhs$1$$anonfun$1(Namer.scala:1958)
[error]      |    dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:256)
[error]      |    dotty.tools.dotc.typer.Namer.typedAheadRhs$1(Namer.scala:1958)
[error]      |    dotty.tools.dotc.typer.Namer.rhsType$1(Namer.scala:1966)
[error]      |    dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1985)
[error]      |    dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1986)
[error]      |    dotty.tools.dotc.typer.Namer.inferredResultType(Namer.scala:1997)
[error]      |    dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1740)
[error]      |    dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1746)
[error]      |    dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:804)
[error]      |    dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:955)
[error]      |    dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:831)
[error]      |    dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:178)
[error]      |    dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
[error]      |    dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
[error]      |    dotty.tools.dotc.core.Denotations$SingleDenotation.computeAsSeenFrom(Denotations.scala:1130
[error]      |    dotty.tools.dotc.core.Denotations$SingleDenotation.computeAsSeenFrom(Denotations.scala:1083
[error]      |    dotty.tools.dotc.core.Denotations$PreDenotation.asSeenFrom(Denotations.scala:137)
[error]      |    dotty.tools.dotc.core.Denotations$SingleDenotation.mapInherited(Denotations.scala:1065)
[error]      |    dotty.tools.dotc.core.Denotations$SingleDenotation.mapInherited(Denotations.scala:1062)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.collect$1(SymDenotations.scala:2175)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.collect$1(SymDenotations.scala:2171)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.collect$1(SymDenotations.scala:2171)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.addInherited(SymDenotations.scala:2180
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMembersNamed(SymDenotations.scala:2165)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.membersNamed(SymDenotations.scala:2132
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.findMember(SymDenotations.scala:2183)
[error]      |    dotty.tools.dotc.core.Types$Type.go$1(Types.scala:764)
[error]      |    dotty.tools.dotc.core.Types$Type.goAnd$1(Types.scala:921)
[error]      |    dotty.tools.dotc.core.Types$Type.go$1(Types.scala:798)
[error]      |    dotty.tools.dotc.core.Types$Type.goThis$1(Types.scala:872)
[error]      |    dotty.tools.dotc.core.Types$Type.go$1(Types.scala:781)
[error]      |    dotty.tools.dotc.core.Types$Type.findMember(Types.scala:945)
[error]      |    dotty.tools.dotc.core.ContextOps$.denotNamed(ContextOps.scala:41)
[error]      |    dotty.tools.dotc.typer.Typer.loop$1(Typer.scala:458)
[error]      |    dotty.tools.dotc.typer.Typer.findRefRecur$1(Typer.scala:525)
[error]      |    dotty.tools.dotc.typer.Typer.findRef(Typer.scala:528)
[error]      |    dotty.tools.dotc.typer.Typer.typedIdent(Typer.scala:589)
[error]      |    dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3111)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3220)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
[error]      |    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
[error]      |    dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1702)
[error]      |    dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1692)
[error]      |    dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1702)
[error]      |    dotty.tools.dotc.typer.Namer$ClassCompleter.exportForwarders(Namer.scala:1124)
[error]      |    dotty.tools.dotc.typer.Namer$ClassCompleter.processExport$1(Namer.scala:1424)
[error]      |    dotty.tools.dotc.typer.Namer$ClassCompleter.process$1(Namer.scala:1445)
[error]      |    dotty.tools.dotc.typer.Namer$ClassCompleter.processExports(Namer.scala:1466)
[error]      |    dotty.tools.dotc.typer.Namer$ClassCompleter.completeInCreationContext(Namer.scala:1667)
[error]      |    dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:831)
[error]      |    dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:178)
[error]      |    dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
[error]      |    dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.parentTypes(SymDenotations.scala:1925)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:2000)
[error]      |    dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:3005)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1979)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClasses(SymDenotations.scala:1986)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.traverse$1(SymDenotations.scala:2007)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:2013)
[error]      |    dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:3005)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1979)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClassSet(SymDenotations.scala:1995
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.derivesFrom(SymDenotations.scala:2021)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.isValueClass(SymDenotations.scala:2061
[error]      |    dotty.tools.dotc.core.SymUtils.isDerivedValueClass(SymUtils.scala:85)
[error]      |    dotty.tools.dotc.core.TypeErasure.dotty$tools$dotc$core$TypeErasure$$sigName(TypeErasure.scala:905)
[error]      |    dotty.tools.dotc.core.TypeErasure$.sigName(TypeErasure.scala:234)
[error]      |    dotty.tools.dotc.core.Signature.$anonfun$2(Signature.scala:111)
[error]      |    scala.collection.immutable.List.map(List.scala:246)
[error]      |    dotty.tools.dotc.core.Signature.prependTermParams(Signature.scala:111)
[error]      |    dotty.tools.dotc.core.Types$MethodOrPoly.computeSignature$2(Types.scala:3954)
[error]      |    dotty.tools.dotc.core.Types$MethodOrPoly.signature(Types.scala:3971)
[error]      |    dotty.tools.dotc.core.Types$MethodOrPoly.computeSignature$2(Types.scala:3942)
[error]      |    dotty.tools.dotc.core.Types$MethodOrPoly.signature(Types.scala:3971)
[error]      |    dotty.tools.dotc.core.Denotations$SingleDenotation.signature(Denotations.scala:623)
[error]      |    dotty.tools.dotc.core.Denotations$SingleDenotation.matchesLoosely(Denotations.scala:1036)
[error]      |    dotty.tools.dotc.core.Denotations$SingleDenotation.matches(Denotations.scala:1020)
[error]      |    dotty.tools.dotc.core.Denotations$Denotation.mergeDenot$1(Denotations.scala:415)
[error]      |    dotty.tools.dotc.core.Denotations$Denotation.meet(Denotations.scala:505)
[error]      |    dotty.tools.dotc.core.Denotations$DenotUnion.toDenot(Denotations.scala:1242)
[error]      |    dotty.tools.dotc.core.Denotations$DenotUnion.toDenot(Denotations.scala:1242)
[error]      |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.findMember(SymDenotations.scala:2187)
[error]      |    dotty.tools.dotc.core.Types$Type.go$1(Types.scala:764)
[error]      |    dotty.tools.dotc.core.Types$Type.findMember(Types.scala:945)
[error]      |    dotty.tools.dotc.core.Types$Type.memberBasedOnFlags(Types.scala:737)
[error]      |    dotty.tools.dotc.core.Types$Type.member(Types.scala:721)
[error]      |    dotty.tools.dotc.typer.Checking.checkIdent$1(Checking.scala:1580)
[error]      |    dotty.tools.dotc.typer.Checking.checkImportSelectors$$anonfun$1(Checking.scala:1595)
[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.Checking.checkImportSelectors(Checking.scala:1594)
[error]      |    dotty.tools.dotc.typer.Checking.checkImportSelectors$(Checking.scala:884)
[error]      |    dotty.tools.dotc.typer.Typer.checkImportSelectors(Typer.scala:120)
[error]      |    dotty.tools.dotc.typer.Typer.typedImport(Typer.scala:2922)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3150)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
[error]      |    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3314)
[error]      |    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
[error]      |    dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2947)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3171)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
[error]      |    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3351)
[error]      |    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
[error]      |    dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2947)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3171)
[error]      |    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
[error]      |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
[error]      |    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
[error]      |    dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:47)
[error]      |    scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error]      |    scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error]      |    dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:503)
[error]      |    dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:53)
[error]      |    dotty.tools.dotc.typer.TyperPhase.$anonfun$4(TyperPhase.scala:99)
[error]      |    scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:479)
[error]      |    scala.collection.Iterator$$anon$9.hasNext(Iterator.scala:583)
[error]      |    scala.collection.immutable.List.prependedAll(List.scala:152)
[error]      |    scala.collection.immutable.List$.from(List.scala:684)
[error]      |    scala.collection.immutable.List$.from(List.scala:681)
[error]      |    scala.collection.IterableOps$WithFilter.map(Iterable.scala:898)
[error]      |    dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:98)
[error]      |    dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:343)
[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:1323)
[error]      |    dotty.tools.dotc.Run.runPhases$1(Run.scala:336)
[error]      |    dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:384)
[error]      |    dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:396)
[error]      |    dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
[error]      |    dotty.tools.dotc.Run.compileUnits(Run.scala:396)
[error]      |    dotty.tools.dotc.Run.compileSources(Run.scala:282)
[error]      |    dotty.tools.dotc.Run.compile(Run.scala:267)
[error]      |    dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
[error]      |    dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:141)
[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:180)
[error]      |    sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:178)
[error]      |    sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:464)
[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:419)
[error]      |    sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:506)
[error]      |    sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:406)
[error]      |    sbt.internal.inc.Incremental$.apply(Incremental.scala:172)
[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:2371)
[error]      |    sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2321)
[error]      |    sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:31)
[error]      |    sbt.internal.io.Retry$.apply(Retry.scala:47)
[error]      |    sbt.internal.io.Retry$.apply(Retry.scala:29)
[error]      |    sbt.internal.io.Retry$.apply(Retry.scala:24)
[error]      |    sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
[error]      |    sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2319)
[error]      |    scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]      |    sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error]      |    sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error]      |    sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error]      |    sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error]      |    sbt.Execute.work(Execute.scala:292)
[error]      |    sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error]      |    sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]      |    sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error]      |    java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error]      |    java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
[error]      |    java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error]      |    java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[error]      |    java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[error]      |    java.base/java.lang.Thread.run(Thread.java:1583)
[error]      |
[error]      | longer explanation available when compiling with `-explain`
[error] -- [E006] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:500:25
[error] 500 |            usingCapture(capt2)
[error]     |                         ^^^^^
[error]     |                         Not found: capt2 - did you mean caps?
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E006] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:500:25
[error] 500 |            usingCapture(capt2)
[error]     |                         ^^^^^
[error]     |                         Not found: capt2 - did you mean caps?
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E006] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:501:19
[error] 501 |            Result(btpe, eff1)
[error]     |                   ^^^^
[error]     |                   Not found: btpe - did you mean vtpe?
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E006] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:501:19
[error] 501 |            Result(btpe, eff1)
[error]     |                   ^^^^
[error]     |                   Not found: btpe - did you mean vtpe?
[error]     |
[error]     | longer explanation available when compiling with `-explain`

Thanks for looking into it

odersky added a commit that referenced this issue Apr 26, 2024
Also report type-checked right hand sides and export expansions.

Streamline trace-handling code using inline functions.

Fixes #20245
@odersky odersky reopened this Apr 26, 2024
@odersky
Copy link
Contributor

odersky commented Apr 26, 2024

#20251 would hopefully give some more information than nightly. I justy merged it, so next nightly should work better. But anyway, let's look at the trace:

Cyclic reference involving class Context
[error] |
[error] |The error occurred while trying to compute the base classes of class Context
[error] | which required to compute the base classes of trait TyperOps

Yes, since TyperOps is a parent of Context, we need to compute its baseclasses.

[error] | which required to compute the signature of trait TyperOps

Which means we have to elaborate its classinfo, (i.e. run Namer on it).

[error] | which required to compute the signature of value unification

That's an interesting bit. Why does it need to know the type of unification? My guess from the minimization is that there's an export on it. That export gets expanded by Namer, so in that case it would need the type.

[error] | which required to compute the base classes of class Context

That's the mysterious bit. Why does it need the base classes of Context. What does the definition of unification look like in TyperOps?

@odersky odersky reopened this Apr 26, 2024
@b-studios
Copy link
Contributor Author

b-studios commented Apr 26, 2024

What does the definition of unification look like in TyperOps?

private[typer] val unification = new Unification(using this)
export unification.{ requireSubtype, requireSubregion, join, instantiate, instantiateFresh, freshTypeVar, freshCaptVar, without, requireSubregionWithout }

https://github.com/effekt-lang/effekt/blob/ad22d5acc921319ef2d16885aca308da85171957/effekt/shared/src/main/scala/effekt/Typer.scala#L1450C18-L1451

@odersky
Copy link
Contributor

odersky commented Apr 26, 2024

Did you try adding an explicit type for unification?

@odersky
Copy link
Contributor

odersky commented Apr 26, 2024

The way it is written it's clearly a cycle. The RHS needs to be type-checked, which requires typing this, which requires typing the self type Context.

I believe #20251 would have clarified that much better.

@b-studios
Copy link
Contributor Author

b-studios commented Apr 26, 2024

Yes, I tried annotating. Here is the trace with the annotation on unification

[error] -- [E046] Cyclic Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:10:7
[error] 10 |import effekt.source.{AnyPattern, Def, Effectful, IgnorePattern, MatchGuard, MatchPattern, ModuleDecl, Stmt, TagPattern, Term, Tree, resolve, symbol}
[error]    |       ^
[error]    |Cyclic reference involving class Context
[error]    |
[error]    |The error occurred while trying to compute the base classes of class Context
[error]    |  which required to compute the base classes of trait TyperOps
[error]    |  which required to compute the signature of trait TyperOps
[error]    |  which required to compute the base classes of class Context
[error]    |
[error]    |Stacktrace:
[error]    |    dotty.tools.dotc.core.CyclicReference$.apply(TypeErrors.scala:193)
[error]    |    dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:3001)
[error]    |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1979)
[error]    |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClassSet(SymDenotations.scala:1995)
[error]    |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.isValueClass(SymDenotations.scala:2057)
[error]    |    dotty.tools.dotc.core.SymUtils.isDerivedValueClass(SymUtils.scala:85)
[error]    |    dotty.tools.dotc.core.TypeErasure.dotty$tools$dotc$core$TypeErasure$$sigName(TypeErasure.scala:905)
[error]    |    dotty.tools.dotc.core.TypeErasure$.sigName(TypeErasure.scala:234)
[error]    |    dotty.tools.dotc.core.Signature.$anonfun$2(Signature.scala:111)
[error]    |    scala.collection.immutable.List.map(List.scala:246)
[error]    |    dotty.tools.dotc.core.Signature.prependTermParams(Signature.scala:111)
[error]    |    dotty.tools.dotc.core.Types$MethodOrPoly.computeSignature$2(Types.scala:3954)
[error]    |    dotty.tools.dotc.core.Types$MethodOrPoly.signature(Types.scala:3971)
[error]    |    dotty.tools.dotc.core.Types$MethodOrPoly.computeSignature$2(Types.scala:3942)
[error]    |    dotty.tools.dotc.core.Types$MethodOrPoly.signature(Types.scala:3971)
[error]    |    dotty.tools.dotc.core.Denotations$SingleDenotation.signature(Denotations.scala:623)
[error]    |    dotty.tools.dotc.core.Denotations$SingleDenotation.matchesLoosely(Denotations.scala:1037)
[error]    |    dotty.tools.dotc.core.Denotations$SingleDenotation.matches(Denotations.scala:1020)
[error]    |    dotty.tools.dotc.core.Denotations$Denotation.mergeDenot$1(Denotations.scala:415)
[error]    |    dotty.tools.dotc.core.Denotations$Denotation.meet(Denotations.scala:505)
[error]    |    dotty.tools.dotc.core.Denotations$DenotUnion.toDenot(Denotations.scala:1242)
[error]    |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.findMember(SymDenotations.scala:2187)
[error]    |    dotty.tools.dotc.core.Types$Type.go$1(Types.scala:764)
[error]    |    dotty.tools.dotc.core.Types$Type.findMember(Types.scala:945)
[error]    |    dotty.tools.dotc.core.Types$Type.memberBasedOnFlags(Types.scala:737)
[error]    |    dotty.tools.dotc.core.Types$Type.member(Types.scala:721)
[error]    |    dotty.tools.dotc.typer.Namer.dotty$tools$dotc$typer$Namer$ClassCompleter$$_$_$$anonfun$21(Namer.scala:1310)
[error]    |    scala.collection.immutable.List.flatMap(List.scala:293)
[error]    |    dotty.tools.dotc.typer.Namer$ClassCompleter.addForwardersNamed$1(Namer.scala:1310)
[error]    |    dotty.tools.dotc.typer.Namer$ClassCompleter.addForwarders$1(Namer.scala:1354)
[error]    |    dotty.tools.dotc.typer.Namer$ClassCompleter.exportForwarders(Namer.scala:1414)
[error]    |    dotty.tools.dotc.typer.Namer$ClassCompleter.processExport$1(Namer.scala:1424)
[error]    |    dotty.tools.dotc.typer.Namer$ClassCompleter.process$1(Namer.scala:1445)
[error]    |    dotty.tools.dotc.typer.Namer$ClassCompleter.processExports(Namer.scala:1466)
[error]    |    dotty.tools.dotc.typer.Namer$ClassCompleter.completeInCreationContext(Namer.scala:1667)
[error]    |    dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:831)
[error]    |    dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:178)
[error]    |    dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
[error]    |    dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
[error]    |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.parentTypes(SymDenotations.scala:1925)
[error]    |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:2000)
[error]    |    dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:3005)
[error]    |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1979)
[error]    |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClasses(SymDenotations.scala:1986)
[error]    |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.traverse$1(SymDenotations.scala:2007)
[error]    |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:2013)
[error]    |    dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:3005)
[error]    |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1979)
[error]    |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClassSet(SymDenotations.scala:1995)
[error]    |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.derivesFrom(SymDenotations.scala:2021)
[error]    |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.isValueClass(SymDenotations.scala:2061)
[error]    |    dotty.tools.dotc.core.SymUtils.isDerivedValueClass(SymUtils.scala:85)
[error]    |    dotty.tools.dotc.core.TypeErasure.dotty$tools$dotc$core$TypeErasure$$sigName(TypeErasure.scala:905)
[error]    |    dotty.tools.dotc.core.TypeErasure$.sigName(TypeErasure.scala:234)
[error]    |    dotty.tools.dotc.core.Signature.$anonfun$2(Signature.scala:111)
[error]    |    scala.collection.immutable.List.map(List.scala:246)
[error]    |    dotty.tools.dotc.core.Signature.prependTermParams(Signature.scala:111)
[error]    |    dotty.tools.dotc.core.Types$MethodOrPoly.computeSignature$2(Types.scala:3954)
[error]    |    dotty.tools.dotc.core.Types$MethodOrPoly.signature(Types.scala:3971)
[error]    |    dotty.tools.dotc.core.Types$MethodOrPoly.computeSignature$2(Types.scala:3942)
[error]    |    dotty.tools.dotc.core.Types$MethodOrPoly.signature(Types.scala:3971)
[error]    |    dotty.tools.dotc.core.Denotations$SingleDenotation.signature(Denotations.scala:623)
[error]    |    dotty.tools.dotc.core.Denotations$SingleDenotation.matchesLoosely(Denotations.scala:1036)
[error]    |    dotty.tools.dotc.core.Denotations$SingleDenotation.matches(Denotations.scala:1020)
[error]    |    dotty.tools.dotc.core.Denotations$Denotation.mergeDenot$1(Denotations.scala:415)
[error]    |    dotty.tools.dotc.core.Denotations$Denotation.meet(Denotations.scala:505)
[error]    |    dotty.tools.dotc.core.Denotations$DenotUnion.toDenot(Denotations.scala:1242)
[error]    |    dotty.tools.dotc.core.Denotations$DenotUnion.toDenot(Denotations.scala:1242)
[error]    |    dotty.tools.dotc.core.SymDenotations$ClassDenotation.findMember(SymDenotations.scala:2187)
[error]    |    dotty.tools.dotc.core.Types$Type.go$1(Types.scala:764)
[error]    |    dotty.tools.dotc.core.Types$Type.findMember(Types.scala:945)
[error]    |    dotty.tools.dotc.core.Types$Type.memberBasedOnFlags(Types.scala:737)
[error]    |    dotty.tools.dotc.core.Types$Type.member(Types.scala:721)
[error]    |    dotty.tools.dotc.typer.Checking.checkIdent$1(Checking.scala:1580)
[error]    |    dotty.tools.dotc.typer.Checking.checkImportSelectors$$anonfun$1(Checking.scala:1595)
[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.Checking.checkImportSelectors(Checking.scala:1594)
[error]    |    dotty.tools.dotc.typer.Checking.checkImportSelectors$(Checking.scala:884)
[error]    |    dotty.tools.dotc.typer.Typer.checkImportSelectors(Typer.scala:120)
[error]    |    dotty.tools.dotc.typer.Typer.typedImport(Typer.scala:2922)
[error]    |    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3150)
[error]    |    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
[error]    |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
[error]    |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
[error]    |    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3314)
[error]    |    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
[error]    |    dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2947)
[error]    |    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3171)
[error]    |    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
[error]    |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
[error]    |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
[error]    |    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3351)
[error]    |    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
[error]    |    dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2947)
[error]    |    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3171)
[error]    |    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
[error]    |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
[error]    |    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
[error]    |    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
[error]    |    dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:47)
[error]    |    scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error]    |    scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error]    |    dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:503)
[error]    |    dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:53)
[error]    |    dotty.tools.dotc.typer.TyperPhase.$anonfun$4(TyperPhase.scala:99)
[error]    |    scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:479)
[error]    |    scala.collection.Iterator$$anon$9.hasNext(Iterator.scala:583)
[error]    |    scala.collection.immutable.List.prependedAll(List.scala:152)
[error]    |    scala.collection.immutable.List$.from(List.scala:684)
[error]    |    scala.collection.immutable.List$.from(List.scala:681)
[error]    |    scala.collection.IterableOps$WithFilter.map(Iterable.scala:898)
[error]    |    dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:98)
[error]    |    dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:343)
[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:1323)
[error]    |    dotty.tools.dotc.Run.runPhases$1(Run.scala:336)
[error]    |    dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:384)
[error]    |    dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:396)
[error]    |    dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
[error]    |    dotty.tools.dotc.Run.compileUnits(Run.scala:396)
[error]    |    dotty.tools.dotc.Run.compileSources(Run.scala:282)
[error]    |    dotty.tools.dotc.Run.compile(Run.scala:267)
[error]    |    dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
[error]    |    dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:141)
[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:180)
[error]    |    sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:178)
[error]    |    sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:464)
[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:419)
[error]    |    sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:506)
[error]    |    sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:406)
[error]    |    sbt.internal.inc.Incremental$.apply(Incremental.scala:172)
[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:2371)
[error]    |    sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2321)
[error]    |    sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:31)
[error]    |    sbt.internal.io.Retry$.apply(Retry.scala:47)
[error]    |    sbt.internal.io.Retry$.apply(Retry.scala:29)
[error]    |    sbt.internal.io.Retry$.apply(Retry.scala:24)
[error]    |    sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
[error]    |    sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2319)
[error]    |    scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]    |    sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error]    |    sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error]    |    sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error]    |    sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error]    |    sbt.Execute.work(Execute.scala:292)
[error]    |    sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error]    |    sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]    |    sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error]    |    java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error]    |    java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
[error]    |    java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error]    |    java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[error]    |    java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[error]    |    java.base/java.lang.Thread.run(Thread.java:1583)
[error]    |
[error]    | longer explanation available when compiling with `-explain`
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:112:23
[error] 112 |        Result(Context.join(thnTpe, elsTpe), guardEffs ++ thnEffs ++ elsEffs)
[error]     |               ^^^^^^^^^^^^
[error]     |               value join is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:122:23
[error] 122 |        Result(Context.join(bodyTpe, defaultTpe), defaultEffs ++ bodyEffs)
[error]     |               ^^^^^^^^^^^^
[error]     |               value join is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:149:61
[error] 149 |        val inferredCap: Captures = annotatedCapture.map { _.resolve }.getOrElse {
[error]     |                                                           ^^^^^^^^^
[error]     |value resolve is not a member of effekt.source.CaptureSet, but could be made available as an extension method.
[error]     |
[error]     |One of the following imports might fix the problem:
[error]     |
[error]     |  import effekt.source.Resolvable.resolve
[error]     |  import effekt.source.resolve
[error]     |
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:150:18
[error] 150 |          Context.freshCaptVar(CaptUnificationVar.InferredBox(l))
[error]     |          ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:168:81
[error] 168 |        val Result(tpe, effs) = checkOverloadedFunctionCall(c, op, targs map { _.resolve }, vargs, bargs, expected)
[error]     |                                                                               ^^^^^^^^^
[error]     |value resolve is not a member of effekt.source.ValueType, but could be made available as an extension method.
[error]     |
[error]     |One of the following imports might fix the problem:
[error]     |
[error]     |  import effekt.source.Resolvable.resolve
[error]     |  import effekt.source.resolve
[error]     |
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:186:59
[error] 186 |        checkOverloadedFunctionCall(c, t.id, targs map { _.resolve }, vargs, bargs, expected)
[error]     |                                                         ^^^^^^^^^
[error]     |value resolve is not a member of effekt.source.ValueType, but could be made available as an extension method.
[error]     |
[error]     |One of the following imports might fix the problem:
[error]     |
[error]     |  import effekt.source.Resolvable.resolve
[error]     |  import effekt.source.resolve
[error]     |
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:194:75
[error] 194 |        val Result(t, eff) = checkCallTo(c, "function", tpe, targs map { _.resolve }, vargs, bargs, expected)
[error]     |                                                                         ^^^^^^^^^
[error]     |value resolve is not a member of effekt.source.ValueType, but could be made available as an extension method.
[error]     |
[error]     |One of the following imports might fix the problem:
[error]     |
[error]     |  import effekt.source.Resolvable.resolve
[error]     |  import effekt.source.resolve
[error]     |
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:200:65
[error] 200 |        checkOverloadedMethodCall(c, receiver, id, targs map { _.resolve }, vargs, bargs, expected)
[error]     |                                                               ^^^^^^^^^
[error]     |value resolve is not a member of effekt.source.ValueType, but could be made available as an extension method.
[error]     |
[error]     |One of the following imports might fix the problem:
[error]     |
[error]     |  import effekt.source.Resolvable.resolve
[error]     |  import effekt.source.resolve
[error]     |
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:206:38
[error] 206 |        val inferredCapture = Context.freshCaptVar(CaptUnificationVar.RegionRegion(tree))
[error]     |                              ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:209:28
[error] 209 |        flowingInto(Context.without(inferredCapture, List(reg.capture))) {
[error]     |                    ^^^^^^^^^^^^^^^
[error]     |value without is not a member of effekt.context.Context - did you mean x$3.withFocus?
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:217:47
[error] 217 |          val effect: InterfaceType = h.effect.resolve
[error]     |                                      ^^^^^^^^^^^^^^^^
[error]     |value resolve is not a member of effekt.source.BlockType.BlockTypeRef, but could be made available as an extension method.
[error]     |
[error]     |One of the following imports might fix the problem:
[error]     |
[error]     |  import effekt.source.Resolvable.resolve
[error]     |  import effekt.source.resolve
[error]     |
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:224:39
[error] 224 |        val continuationCapt = Context.freshCaptVar(CaptUnificationVar.HandlerRegion(tree))
[error]     |                               ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:227:46
[error] 227 |        val continuationCaptHandled = Context.without(continuationCapt, providedCapabilities.map(_.capture))
[error]     |                                      ^^^^^^^^^^^^^^^
[error]     |value without is not a member of effekt.context.Context - did you mean x$3.withFocus?
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:316:23
[error] 316 |        Result(Context.join(tpes*), resEff)
[error]     |               ^^^^^^^^^^^^
[error]     |               value join is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:346:56
[error] 346 |      val tpe @ InterfaceType(constructor, targs) = sig.resolve
[error]     |                                                    ^^^^^^^^^^^
[error]     |value resolve is not a member of effekt.source.BlockType.BlockTypeRef, but could be made available as an extension method.
[error]     |
[error]     |One of the following imports might fix the problem:
[error]     |
[error]     |  import effekt.source.Resolvable.resolve
[error]     |  import effekt.source.resolve
[error]     |
[error] -- [E189] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:365:17
[error] 365 |            case Effectful(otherTpe, otherEffs2) =>
[error]     |                 ^^^^^^^^^
[error]     |                 no pattern match extractor named Effectful was found
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:407:24
[error] 407 |                Context.instantiate(declaredType, targs ++ existentials, cparams.map(cap => CaptureSet(cap))) : @unchecked
[error]     |                ^^^^^^^^^^^^^^^^^^^
[error]     |           value instantiate is not a member of effekt.context.Context
[error] -- [E134] Type Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:413:40
[error] 413 |                  annotatedType.foreach(matchDeclared(_, declaredType, param))
[error]     |                                        ^^^^^^^^^^^^^
[error]     |None of the overloaded alternatives of method matchDeclared in object Typer with types
[error]     | (got: effekt.symbols.ValueType, declared: effekt.symbols.ValueType, param:
[error]     |  effekt.source.Param)(using x$4: effekt.context.Context): Unit
[error]     | (got: effekt.symbols.BlockType, declared: effekt.symbols.BlockType, param:
[error]     |  effekt.source.Param)(using x$4: effekt.context.Context): Unit
[error]     |match arguments ((_$16 : effekt.symbols.ValueType), (declaredType : Any), (param² : effekt.source.Param.ValueParam))
[error]     |
[error]     |where:    param  is a reference to a value parameter
[error]     |          param² is a value in an anonymous function in method checkImplementation
[error] -- [E134] Type Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:414:26
[error] 414 |                  Context.bind(sym, annotatedType.getOrElse(declaredType))
[error]     |                  ^^^^^^^^^^^^
[error]     |None of the overloaded alternatives of method bind in trait TyperOps with types
[error]     | (p: effekt.symbols.TrackedParam): Unit
[error]     | (p: effekt.symbols.ValueParam): Unit
[error]     | (bs: Map[effekt.symbols.Symbol, effekt.symbols.ValueType]): Unit
[error]     | (s: effekt.symbols.BlockSymbol, capt: effekt.symbols.Captures): Unit
[error]     | (s: effekt.symbols.BlockSymbol, tpe: effekt.symbols.BlockType): Unit
[error]     | (s: effekt.symbols.BlockSymbol, tpe: effekt.symbols.BlockType, capt:
[error]     |  effekt.symbols.Captures): Unit
[error]     | (s: effekt.symbols.ValueSymbol, tpe: effekt.symbols.ValueType): Unit
[error]     |match arguments ((sym : effekt.symbols.ValueParam), B)
[error]     |
[error]     |where:    B is a type variable with constraint >: effekt.symbols.ValueType | (declaredType : Any
[error] -- [E134] Type Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:421:18
[error] 421 |                  matchDeclared(annotatedType, declaredType, param)
[error]     |                  ^^^^^^^^^^^^^
[error]     |None of the overloaded alternatives of method matchDeclared in object Typer with types
[error]     | (got: effekt.symbols.ValueType, declared: effekt.symbols.ValueType, param:
[error]     |  effekt.source.Param)(using x$4: effekt.context.Context): Unit
[error]     | (got: effekt.symbols.BlockType, declared: effekt.symbols.BlockType, param:
[error]     |  effekt.source.Param)(using x$4: effekt.context.Context): Unit
[error]     |match arguments ((annotatedType : effekt.symbols.BlockType), (declaredType : Any), (param² : effekt.source.Param.BlockParam))
[error]     |
[error]     |where:    param  is a reference to a value parameter
[error]     |          param² is a value in an anonymous function in method checkImplementation
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:448:24
[error] 448 |                Context.instantiate(declaredType, targs ++ existentials, cparams.map(cap => CaptureSet(cap))) : @unchecked
[error]     |                ^^^^^^^^^^^^^^^^^^^
[error]     |           value instantiate is not a member of effekt.context.Context
[error] -- [E134] Type Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:454:40
[error] 454 |                  annotatedType.foreach(matchDeclared(_, declaredType, param))
[error]     |                                        ^^^^^^^^^^^^^
[error]     |None of the overloaded alternatives of method matchDeclared in object Typer with types
[error]     | (got: effekt.symbols.ValueType, declared: effekt.symbols.ValueType, param:
[error]     |  effekt.source.Param)(using x$4: effekt.context.Context): Unit
[error]     | (got: effekt.symbols.BlockType, declared: effekt.symbols.BlockType, param:
[error]     |  effekt.source.Param)(using x$4: effekt.context.Context): Unit
[error]     |match arguments ((_$17 : effekt.symbols.ValueType), (declaredType : Any), (param² : effekt.source.Param.ValueParam))
[error]     |
[error]     |where:    param  is a reference to a value parameter
[error]     |          param² is a value in an anonymous function in method checkImplementation
[error] -- [E134] Type Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:455:26
[error] 455 |                  Context.bind(sym, annotatedType.getOrElse(declaredType))
[error]     |                  ^^^^^^^^^^^^
[error]     |None of the overloaded alternatives of method bind in trait TyperOps with types
[error]     | (p: effekt.symbols.TrackedParam): Unit
[error]     | (p: effekt.symbols.ValueParam): Unit
[error]     | (bs: Map[effekt.symbols.Symbol, effekt.symbols.ValueType]): Unit
[error]     | (s: effekt.symbols.BlockSymbol, capt: effekt.symbols.Captures): Unit
[error]     | (s: effekt.symbols.BlockSymbol, tpe: effekt.symbols.BlockType): Unit
[error]     | (s: effekt.symbols.BlockSymbol, tpe: effekt.symbols.BlockType, capt:
[error]     |  effekt.symbols.Captures): Unit
[error]     | (s: effekt.symbols.ValueSymbol, tpe: effekt.symbols.ValueType): Unit
[error]     |match arguments ((sym : effekt.symbols.ValueParam), B)
[error]     |
[error]     |where:    B is a type variable with constraint >: effekt.symbols.ValueType | (declaredType : Any
[error] -- [E051] Reference Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:477:14
[error] 477 |      Context.annotateInferredType(impl, tpe)
[error]     |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |Ambiguous overload. The overloaded alternatives of method annotateInferredType in trait TyperOps with types
[error]     | (t: effekt.source.Tree, e: effekt.symbols.BlockType): Unit
[error]     | (t: effekt.source.Tree, e: effekt.symbols.ValueType): Unit
[error]     |both match arguments ((impl : effekt.source.Implementation), (tpe : Nothing))
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:492:34
[error] 492 |            val captVar = Context.freshCaptVar(CaptUnificationVar.InferredUnbox(u))
[error]     |                          ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:544:14
[error] 544 |      Context.requireSubtype(sc, lit.tpe, ErrorContext.PatternMatch(p))
[error]     |      ^^^^^^^^^^^^^^^^^^^^^^
[error]     |      value requireSubtype is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:555:60
[error] 555 |      val freshUniversals   = universals.map { t => Context.freshTypeVar(t, pattern) }
[error]     |                                                    ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshTypeVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:563:55
[error] 563 |      val FunctionType(_, _, vps, _, ret, _) = Context.instantiate(sym.toType, targs, Nil)
[error]     |                                               ^^^^^^^^^^^^^^^^^^^
[error]     |           value instantiate is not a member of effekt.context.Context
[error] -- [E006] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:583:9
[error] 583 |    case MatchGuard.BooleanGuard(condition) =>
[error]     |         ^^^^^^^^^^
[error]     |         Not found: MatchGuard
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E007] Type Mismatch Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:584:40
[error] 584 |      val Result(tpe, effs) = checkExpr(condition, Some(TBoolean))
[error]     |                                        ^^^^^^^^^
[error]     |                                        Found:    (condition : Any)
[error]     |                                        Required: effekt.source.Term
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E006] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:586:9
[error] 586 |    case MatchGuard.PatternGuard(scrutinee, pattern) =>
[error]     |         ^^^^^^^^^^
[error]     |         Not found: MatchGuard
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E007] Type Mismatch Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:587:40
[error] 587 |      val Result(tpe, effs) = checkExpr(scrutinee, None)
[error]     |                                        ^^^^^^^^^
[error]     |                                        Found:    (scrutinee : Any)
[error]     |                                        Required: effekt.source.Term
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E007] Type Mismatch Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:588:31
[error] 588 |      Result(checkPattern(tpe, pattern), effs)
[error]     |                               ^^^^^^^
[error]     |                               Found:    (pattern : Any)
[error]     |                               Required: effekt.source.MatchPattern
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:610:40
[error] 610 |          val inferredCapture = Context.freshCaptVar(CaptUnificationVar.VarRegion(d))
[error]     |                                ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:613:30
[error] 613 |          flowingInto(Context.without(inferredCapture, List(sym.capture))) {
[error]     |                      ^^^^^^^^^^^^^^^
[error]     |value without is not a member of effekt.context.Context - did you mean x$3.withFocus?
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:642:24
[error] 642 |      val cap = Context.freshCaptVar(CaptUnificationVar.FunctionRegion(d))
[error]     |                ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:652:24
[error] 652 |      val cap = Context.freshCaptVar(CaptUnificationVar.BlockRegion(d))
[error]     |                ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:723:40
[error] 723 |          val inferredCapture = Context.freshCaptVar(CaptUnificationVar.FunctionRegion(d))
[error]     |                                ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:825:60
[error] 825 |        given inferredCapture: CaptUnificationVar = Context.freshCaptVar(CaptUnificationVar.BlockRegion(d))
[error]     |                                                    ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:931:31
[error] 931 |      val bodyRegion = Context.freshCaptVar(CaptUnificationVar.AnonymousFunctionRegion(arg))
[error]     |                       ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:964:36
[error] 964 |      val inferredCapture = Context.freshCaptVar(CaptUnificationVar.AnonymousFunctionRegion(arg)
[error]     |                            ^^^^^^^^^^^^^^^^^^^^
[error]     |          value freshCaptVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1055:62
[error] 1055 |          case (param :: params, Nil) => ValueTypeRef(Context.freshTypeVar(param, call)) :: fillInTypeArguments(params, Nil)
[error]      |                                                      ^^^^^^^^^^^^^^^^^^^^
[error]      |        value freshTypeVar is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1189:88
[error] 1189 |    val (typeArgs, captArgs, bt @ FunctionType(_, _, vps, bps, ret, retEffs)) = Context.instantiateFresh(funTpe)
[error]      |                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^
[error]      |    value instantiateFresh is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1318:6
[error] 1318 |    C.requireSubregion(c, current)
[error]      |    ^^^^^^^^^^^^^^^^^^
[error]      |    value requireSubregion is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1330:6
[error] 1330 |    C.requireSubregion(from, to)
[error]      |    ^^^^^^^^^^^^^^^^^^
[error]      |    value requireSubregion is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1336:6
[error] 1336 |    C.requireSubregionWithout(from, to, filter)
[error]      |    ^^^^^^^^^^^^^^^^^^^^^^^^^
[error]      |value requireSubregionWithout is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1343:14
[error] 1343 |      Context.requireSubtype(got, declared,
[error]      |      ^^^^^^^^^^^^^^^^^^^^^^
[error]      |      value requireSubtype is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1348:14
[error] 1348 |      Context.requireSubtype(got, declared,
[error]      |      ^^^^^^^^^^^^^^^^^^^^^^
[error]      |      value requireSubtype is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1353:12
[error] 1353 |    Context.requireSubtype(scrutinee, patternTpe, ErrorContext.PatternMatch(pattern))
[error]      |    ^^^^^^^^^^^^^^^^^^^^^^
[error]      |    value requireSubtype is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1356:12
[error] 1356 |    Context.requireSubtype(got, expected,
[error]      |    ^^^^^^^^^^^^^^^^^^^^^^
[error]      |    value requireSubtype is not a member of effekt.context.Context
[error] -- [E008] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1360:12
[error] 1360 |    Context.requireSubtype(got, expected,
[error]      |    ^^^^^^^^^^^^^^^^^^^^^^
[error]      |    value requireSubtype is not a member of effekt.context.Context
[error] -- [E006] Not Found Error: /Users/jonathan/Desktop/github/effekt/effekt/shared/src/main/scala/effekt/Typer.scala:1638:30
[error] 1638 |    var capturesForLSP: List[(Tree, CaptureSet)] = Nil
[error]      |                              ^^^^
[error]      |                           Not found: type Tree - did you mean Type?
[error]      |
[error]      | longer explanation available when compiling with `-explain`

(update: I had to update the trace just now)

@odersky
Copy link
Contributor

odersky commented Apr 26, 2024

I guess the question is why does it need the base classes of Context when running the namer on TyperOps? Maybe the next nightly will give more info. Could it be an implicit search that needs to analyze the import?

@Kordyjan Kordyjan modified the milestone: 3.5.0 May 10, 2024
@odersky
Copy link
Contributor

odersky commented Jul 2, 2024

Closing this for now, let's re-open if there's new evidence that the diagnostics are insufficient.

@Gedochao Gedochao closed this as completed Jul 3, 2024
WojciechMazur pushed a commit that referenced this issue Jul 6, 2024
Also report type-checked right hand sides and export expansions.

Streamline trace-handling code using inline functions.

Fixes #20245

[Cherry-picked cfc46e4]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants