@@ -107,6 +107,9 @@ end CyclicMsg
107107abstract  class  ReferenceMsg (errorId : ErrorMessageID )(using  Context ) extends  Message (errorId): 
108108  def  kind  =  MessageKind .Reference 
109109
110+ abstract  class  StagingMessage (errorId : ErrorMessageID )(using  Context ) extends  Message (errorId): 
111+   override  final  def  kind  =  MessageKind .Staging 
112+ 
110113abstract  class  EmptyCatchOrFinallyBlock (tryBody : untpd.Tree , errNo : ErrorMessageID )(using  Context )
111114extends  SyntaxMsg (errNo) {
112115  def  explain (using  Context ) =  {
@@ -3165,3 +3168,20 @@ object UnusedSymbol {
31653168    def  privateMembers (using  Context ):  UnusedSymbol  =  new  UnusedSymbol (i " unused private member " )
31663169    def  patVars (using  Context ):  UnusedSymbol  =  new  UnusedSymbol (i " unused pattern variable " )
31673170}
3171+ 
3172+ final  class  QuotedTypeMissing (tpe : Type )(using  Context ) extends  StagingMessage (QuotedTypeMissingID ): 
3173+ 
3174+   private  def  witness  =  defn.QuotedTypeClass .typeRef.appliedTo(tpe)
3175+ 
3176+   override  protected  def  msg (using  Context ):  String  =  
3177+     i " Reference to  $tpe within quotes requires a given  ${witness} in scope " 
3178+ 
3179+   override  protected  def  explain (using  Context ):  String  = 
3180+     i """ Referencing ` $tpe` inside a quoted expression requires a ` ${witness}` to be in scope.  
3181+         |Since Scala is subject to erasure at runtime, the type information will be missing during the execution of the code. 
3182+         |` ${witness}` is therefore needed to carry ` $tpe`'s type information into the quoted code.  
3183+         |Without an implicit ` ${witness}`, the type ` $tpe` cannot be properly referenced within the expression.  
3184+         |To resolve this, ensure that a ` ${witness}` is available, either through a context-bound or explicitly. 
3185+         | """ 
3186+ 
3187+ end  QuotedTypeMissing 
0 commit comments