-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better error diagnostics under -explain-cyclic
Also report type-checked right hand sides and export expansions. Streamline trace-handling code using inline functions. Fixes #20245
- Loading branch information
Showing
16 changed files
with
164 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
-- [E046] Cyclic Error: tests/neg/i20245/Typer_2.scala:16:57 ----------------------------------------------------------- | ||
16 | private[typer] val unification = new Unification(using this) // error | ||
| ^ | ||
| Cyclic reference involving class Context | ||
| | ||
| The error occurred while trying to compute the base classes of class Context | ||
| which required to compute the base classes of trait TyperOps | ||
| which required to compute the signature of trait TyperOps | ||
| which required to elaborate the export clause export unification.requireSubtype | ||
| which required to compute the signature of value unification | ||
| which required to type the right hand side of value unification since no explicit type was given | ||
| which required to compute the base classes of class Context | ||
| | ||
| Run with both -explain-cyclic and -Ydebug-cyclic to see full stack trace. | ||
| | ||
| longer explanation available when compiling with `-explain` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package effekt | ||
package context | ||
|
||
import effekt.typer.TyperOps | ||
|
||
|
||
abstract class Context extends TyperOps { | ||
|
||
// bring the context itself in scope | ||
implicit val context: Context = this | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package effekt | ||
package util | ||
|
||
object messages { | ||
trait ErrorReporter { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package effekt | ||
package source | ||
|
||
import effekt.context.Context | ||
|
||
object Resolvable { | ||
|
||
// There need to be two resolve extension methods for the error to show up | ||
// They also need to take an implicit Context | ||
extension (n: Int) { | ||
def resolve(using C: Context): Unit = ??? | ||
} | ||
|
||
extension (b: Boolean) { | ||
def resolve(using C: Context): Unit = ??? | ||
} | ||
} | ||
export Resolvable.resolve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package effekt | ||
package typer | ||
|
||
import effekt.util.messages.ErrorReporter | ||
|
||
import effekt.context.{ Context } | ||
|
||
// This import is also NECESSARY for the cyclic error | ||
import effekt.source.{ resolve } | ||
|
||
|
||
trait TyperOps extends ErrorReporter { self: Context => | ||
|
||
// passing `this` as ErrorReporter here is also NECESSARY for the cyclic error | ||
private[typer] val unification = new Unification(using this) | ||
|
||
// this export is NECESSARY for the cyclic error | ||
export unification.{ requireSubtype } | ||
|
||
println(1) | ||
|
||
// vvvvvvvv insert a line here, save, and run `compile` again vvvvvvvvvv | ||
} | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//> using options -explain-cyclic | ||
package effekt | ||
package typer | ||
|
||
import effekt.util.messages.ErrorReporter | ||
|
||
import effekt.context.{ Context } | ||
|
||
// This import is also NECESSARY for the cyclic error | ||
import effekt.source.{ resolve } | ||
|
||
|
||
trait TyperOps extends ErrorReporter { self: Context => | ||
|
||
// passing `this` as ErrorReporter here is also NECESSARY for the cyclic error | ||
private[typer] val unification = new Unification(using this) // error | ||
|
||
// this export is NECESSARY for the cyclic error | ||
export unification.{ requireSubtype } | ||
|
||
// vvvvvvvv insert a line here, save, and run `compile` again vvvvvvvvvv | ||
} | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package effekt | ||
package typer | ||
|
||
import effekt.util.messages.ErrorReporter | ||
|
||
|
||
class Unification(using C: ErrorReporter) { | ||
|
||
def requireSubtype(): Unit = () | ||
|
||
} |