Skip to content

Commit

Permalink
optimize the common case
Browse files Browse the repository at this point in the history
  • Loading branch information
johnynek committed Dec 16, 2023
1 parent cf55130 commit 8bae4f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion core/src/main/scala/org/bykn/bosatsu/KindFormula.scala
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ object KindFormula {
): IorNec[Error, List[DefinedType[Kind.Arg]]] =
dts
.foldM((List.empty[DefinedType[Kind.Arg]], Set.empty[RankNType.TyConst])) { case (st @ (acc, failed), dt) =>
if (dt.dependsOn.exists(failed)) {
// don't evaluate dependsOn if failed is empty
if (failed.nonEmpty && dt.dependsOn.exists(failed)) {
// there was at least one failure already, just return and let that failure signal
Ior.Right(st)
}
Expand Down
4 changes: 1 addition & 3 deletions core/src/main/scala/org/bykn/bosatsu/rankn/Type.scala
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,7 @@ object Type {
case class TyApply(on: Rho, arg: Type) extends Rho {
lazy val normalize: Rho = TyApply(on.normalize, arg.normalize)
}
case class TyConst(tpe: Const) extends Leaf {
def isPredef: Boolean = tpe.toDefined.packageName == PackageName.PredefName
}
case class TyConst(tpe: Const) extends Leaf
case class TyVar(toVar: Var) extends Leaf
case class TyMeta(toMeta: Meta) extends Leaf

Expand Down

0 comments on commit 8bae4f8

Please sign in to comment.