@@ -9,7 +9,7 @@ import scala.collection.mutable.Set as MutSet
9
9
import scala .collection .mutable .ArrayBuffer as ArrayBuffer
10
10
import mlscript .codegen .CodeGenError
11
11
12
- class MonomorphError (error : String ) extends Error (error)
12
+ class CompilerError (error : String ) extends Error (error)
13
13
14
14
class ClassLifter (logDebugMsg : Boolean = false ) {
15
15
type ClassName = String
@@ -250,7 +250,7 @@ class ClassLifter(logDebugMsg: Boolean = false) {
250
250
val nE = liftTerm(expr)
251
251
val nR = liftTerm(rhs)
252
252
(IfThen (nE._1, nR._1), nE._2 ++ nR._2)
253
- case _ => throw MonomorphError (s " Unknown IfBody: ${body}" )
253
+ case _ => throw CompilerError (s " Unknown IfBody: ${body}" )
254
254
}
255
255
256
256
private def liftTuple (tup : Tup )(using ctx : LocalContext , cache : ClassCache , globFuncs : Map [Var , (Var , LocalContext )], outer : Option [ClassInfoCache ]): (Tup , LocalContext ) = {
@@ -400,7 +400,7 @@ class ClassLifter(logDebugMsg: Boolean = false) {
400
400
case Sel (receiver, fieldName) =>
401
401
val nRec = liftTerm(receiver)
402
402
(Sel (nRec._1, fieldName), nRec._2)
403
- case Splc (fields) => throw MonomorphError (s " Unimplemented liftTerm: ${target}" )
403
+ case Splc (fields) => throw CompilerError (s " Unimplemented liftTerm: ${target}" )
404
404
case Subs (arr, idx) =>
405
405
val (ltrm, lctx) = liftTerm(arr)
406
406
val (rtrm, rctx) = liftTerm(idx)
@@ -413,7 +413,7 @@ class ClassLifter(logDebugMsg: Boolean = false) {
413
413
val ret = liftTerm(lhs)
414
414
val nTs = targs.map(liftType).unzip
415
415
(TyApp (ret._1, nTs._1), nTs._2.fold(ret._2)(_ ++ _))
416
- case With (trm, fields) => throw MonomorphError (s " Unimplemented liftTerm: ${target}" )
416
+ case With (trm, fields) => throw CompilerError (s " Unimplemented liftTerm: ${target}" )
417
417
case New (Some ((t : TypeName , prm : Tup )), TypingUnit (Nil )) =>
418
418
val ret = liftConstr(t, prm)
419
419
(New (Some ((ret._1, ret._2)), TypingUnit (Nil )), ret._3)
@@ -433,7 +433,7 @@ class ClassLifter(logDebugMsg: Boolean = false) {
433
433
val nSta = New (Some ((nTpNm, Tup (Nil ))), TypingUnit (Nil ))
434
434
val ret = liftEntities(List (anoCls, nSta))
435
435
(Blk (ret._1), ret._2)
436
- case New (head, body) => throw MonomorphError (s " Unimplemented liftTerm: ${target}" )
436
+ case New (head, body) => throw CompilerError (s " Unimplemented liftTerm: ${target}" )
437
437
case Blk (stmts) =>
438
438
val ret = liftEntities(stmts)
439
439
(Blk (ret._1), ret._2)
@@ -448,7 +448,7 @@ class ClassLifter(logDebugMsg: Boolean = false) {
448
448
val (bod2, ctx) = liftTerm(bod)
449
449
val (sts2, ctx2) = liftEntities(sts)
450
450
(Where (bod2, sts2), ctx2)
451
- case _ : Eqn | _ : Super | _ : Rft | _ : While | _ : Quoted | _ : Unquoted | _ : Ann => throw MonomorphError (s " Unimplemented liftTerm: ${target}" ) // TODO
451
+ case _ : Eqn | _ : Super | _ : Rft | _ : While | _ : Quoted | _ : Unquoted | _ : Ann => throw CompilerError (s " Unimplemented liftTerm: ${target}" ) // TODO
452
452
case patmat : AdtMatchWith => lastWords(s " Cannot liftTermNew ${patmat}" )
453
453
}
454
454
@@ -485,7 +485,7 @@ class ClassLifter(logDebugMsg: Boolean = false) {
485
485
((v, Fld (flags, tmp._1)), tmp._2)
486
486
}.unzip
487
487
(Rcd (ret._1), ret._2.fold(emptyCtx)(_ ++ _))
488
- case _ => throw MonomorphError (s " Unimplemented liftTermAsType: ${target}" )
488
+ case _ => throw CompilerError (s " Unimplemented liftTermAsType: ${target}" )
489
489
}
490
490
491
491
private def liftTypeName (target : TypeName )(using ctx : LocalContext , cache : ClassCache , globFuncs : Map [Var , (Var , LocalContext )], outer : Option [ClassInfoCache ]): (TypeName , LocalContext ) = {
@@ -579,7 +579,7 @@ class ClassLifter(logDebugMsg: Boolean = false) {
579
579
val (body2, ctx) = liftType(body)
580
580
PolyType (targs, body2) -> ctx
581
581
case Top | Bot | _ : Literal | _ : TypeTag | _ : TypeVar => target.asInstanceOf [Type ] -> emptyCtx
582
- case _ : Selection => throw MonomorphError (s " Unimplemented liftType: ${target}" ) // TODO
582
+ case _ : Selection => throw CompilerError (s " Unimplemented liftType: ${target}" ) // TODO
583
583
}
584
584
585
585
@@ -603,7 +603,7 @@ class ClassLifter(logDebugMsg: Boolean = false) {
603
603
}.unzip
604
604
(func.copy(rhs = Right (PolyType (nTargs._1, nBody._1)))(func.declareLoc, func.virtualLoc, func.mutLoc, func.signature, func.outer, func.genField, func.annotations),
605
605
nTargs._2.fold(nBody._2)(_ ++ _))
606
- case _ => throw MonomorphError (s " Unimplemented liftMemberFunc: ${func}" ) // TODO
606
+ case _ => throw CompilerError (s " Unimplemented liftMemberFunc: ${func}" ) // TODO
607
607
}
608
608
}
609
609
@@ -630,7 +630,7 @@ class ClassLifter(logDebugMsg: Boolean = false) {
630
630
case (tn, ctx) => (L (tn), ctx)
631
631
case R (tv) => R (tv) -> emptyCtx}).unzip
632
632
NuFunDef (rec, globFuncs.get(nm).get._1, N , nTpVs, Right (PolyType (nTargs._1, nBody._1)))(N , N , N , N , N , true , Nil )
633
- case _ => throw MonomorphError (s " Unimplemented liftGlobalFunc: ${func}" )
633
+ case _ => throw CompilerError (s " Unimplemented liftGlobalFunc: ${func}" )
634
634
})
635
635
}
636
636
0 commit comments