-
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.
Relax method signature matching under Mode.CheckBoundsOrSelfType
- Loading branch information
Showing
5 changed files
with
405 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Foo: | ||
type In | ||
type Bar = { def go(in: In): Unit } | ||
type False = false | ||
|
||
class Test: | ||
def t1: Unit = valueOf[Foo#False] |
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,59 @@ | ||
package izumi.reflect.dottyreflection | ||
|
||
import scala.quoted.Quotes | ||
|
||
trait InspectorBase extends ReflectionUtil { | ||
|
||
val qctx: Quotes | ||
import qctx.reflect._ | ||
|
||
protected def shift: Int | ||
|
||
// FIXME reimplement TrivialMacroLogger on Scala 3 | ||
inline def debug: debug = valueOf[debug] | ||
final type debug = false | ||
|
||
// println instead of report.info because report.info eats all the subsequent report.info's after first. | ||
inline final protected def logStart(inline s: String): Unit = { | ||
inline if (debug) println(" " * shift + currentPositionStr + s) | ||
} | ||
|
||
inline final protected def log(inline s: String): Unit = { | ||
inline if (debug) println(" " * shift + currentPositionStr + " -> " + s) | ||
} | ||
|
||
inline final protected def logTpeAttrs[T](inline typeRepr: TypeRepr): Unit = { | ||
inline if (debug) { | ||
val tree = TypeTree.of(using typeRepr.asType) | ||
val symbol = tree.symbol | ||
System | ||
.err.println( | ||
currentPositionStr + ": " + | ||
s"Attrs[${tree.show}]: type=${symbol.isType}, term=${symbol.isTerm}, packageDef=${symbol.isPackageDef}, classDef=${symbol.isClassDef}, typeDef=${symbol.isValDef}, defdef=${symbol.isDefDef}, bind=${symbol.isBind}, nosymbol=${symbol.isNoSymbol}" | ||
) | ||
} | ||
} | ||
|
||
private def currentPositionStr: String = { | ||
val pos = qctx.reflect.Position.ofMacroExpansion | ||
s"${pos.sourceFile.name}:${pos.endLine}" | ||
} | ||
|
||
} | ||
|
||
object InspectorBase { | ||
|
||
private[reflect] inline def ifDebug[A](inline f: => Unit): Unit = { | ||
inline if (valueOf[InspectorBase#debug]) { | ||
//[error] ^^^^^^^^^^^^^ | ||
//[error] izumi.reflect.dottyreflection.InspectorBase is not a legal path | ||
//[error] since it has a member InternalTypeRefOrParamRef with possibly conflicting bounds Object{def underlying(ctx: Any): Nothing} <: ... <: Object{def underlying(ctx: Nothing): Matchable} | ||
f | ||
} | ||
} | ||
|
||
private[reflect] inline def log(inline shift: Int, s: String): Unit = { | ||
inline if (valueOf[InspectorBase#debug]) println(" " * shift + " -> " + s) | ||
} | ||
|
||
} |
Oops, something went wrong.