File tree Expand file tree Collapse file tree 3 files changed +37
-6
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 3 files changed +37
-6
lines changed Original file line number Diff line number Diff line change @@ -350,12 +350,18 @@ object Splicer {
350350
351351 private def interpretedStaticMethodCall (moduleClass : Symbol , fn : Symbol )(implicit env : Env ): List [Object ] => Object = {
352352 val (inst, clazz) =
353- if (moduleClass.name.startsWith(str.REPL_SESSION_LINE ))
354- (null , loadReplLineClass(moduleClass))
355- else {
356- val inst = loadModule(moduleClass)
357- (inst, inst.getClass)
358- }
353+ try
354+ if (moduleClass.name.startsWith(str.REPL_SESSION_LINE ))
355+ (null , loadReplLineClass(moduleClass))
356+ else {
357+ val inst = loadModule(moduleClass)
358+ (inst, inst.getClass)
359+ }
360+ catch
361+ case MissingClassDefinedInCurrentRun (sym) if ctx.compilationUnit.isSuspendable =>
362+ if (ctx.settings.XprintSuspension .value)
363+ report.echo(i " suspension triggered by a dependency on $sym" , pos)
364+ ctx.compilationUnit.suspend() // this throws a SuspendException
359365
360366 val name = fn.name.asTermName
361367 val method = getMethod(clazz, name, paramsSig(fn))
Original file line number Diff line number Diff line change 1+ import scala .quoted .*
2+
3+ class InlinedInt [T <: Int ]
4+
5+ object DFType :
6+ trait Width [T ]:
7+ type Out <: Int
8+ transparent inline given [T ]: Width [T ] = $ { getWidthMacro[T ] }
9+ def getWidthMacro [T ](using Quotes , Type [T ]): Expr [Width [T ]] =
10+ ' {
11+ new Width [T ] {
12+ type Out = 1
13+ }
14+ }
15+
16+ trait DFBits [W <: Int ]
17+ object DFBits extends DFBitsCompanion
18+
19+ trait DFToken [T ]
20+ extension [T ](token : DFToken [T ])(using w : DFType .Width [T ])
21+ def width : InlinedInt [w.Out ] = ???
Original file line number Diff line number Diff line change 1+ // nopos-error
2+ trait DFBitsCompanion :
3+ type Token [W <: Int ] = DFToken [DFType .DFBits [W ]]
4+ extension [LW <: Int ](lhs : DFType .DFBits .Token [LW ]) def foo : Unit = lhs.width
You can’t perform that action at this time.
0 commit comments