Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove warnings Infer.scala #1059

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions core/src/main/scala/org/bykn/bosatsu/rankn/Infer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ object Infer {
* Return a Rho type (not a Forall), by assigning
* new meta variables for each of the outer ForAll variables
*/
def instantiate(t: Type, region: Region): Infer[Type.Rho] =
def instantiate(t: Type): Infer[Type.Rho] =
t match {
case Type.ForAll(vars, rho) =>
// TODO: it may be possible to improve type checking
Expand Down Expand Up @@ -502,13 +502,13 @@ object Infer {
(t, rho) match {
case ([email protected](_, _), rho) =>
// Rule SPEC
instantiate(fa, left).flatMap(subsCheckRho(_, rho, left, right))
instantiate(fa).flatMap(subsCheckRho2(_, rho, left, right))
case (rhot: Type.Rho, rho) =>
subsCheckRho2(rhot, rho, left, right)
}

def subsCheckRho2(t: Type.Rho, rho: Type.Rho, left: Region, right: Region): Infer[TypedExpr.Coerce] =
// get the kinds to make sure they are well kindinded
// get the kinds to make sure they are well kinded
kindOf(t, left).product(kindOf(rho, right)) *>
((t, rho) match {
case (rho1, Type.Fun(a2, r2)) =>
Expand All @@ -518,7 +518,7 @@ object Infer {
(a1, r1) = a1r1
// since rho is in weak prenex form, and Fun is covariant on r2, we know
// r2 is in weak-prenex form and a rho type
rhor2 <- assertRho(r2, s"subsCheckRho($t, $rho, $left, $right), line 462", right)
rhor2 <- assertRho(r2, s"subsCheckRho2($t, $rho, $left, $right), line 521", right)
coerce <- subsCheckFn(a1, r1, a2, rhor2, left, right)
} yield coerce
case (Type.Fun(a1, r1), rho2) =>
Expand Down Expand Up @@ -591,7 +591,7 @@ object Infer {
subsCheckRho(sigma, t, r, tr)
case [email protected](_) =>
for {
rho <- instantiate(sigma, r)
rho <- instantiate(sigma)
_ <- infer.set((rho, r))
ks <- checkedKinds
// there is no point in zonking here, we just instantiated rho
Expand Down Expand Up @@ -1212,7 +1212,7 @@ object Infer {
} yield rest.updated(v0, right)
case (_, [email protected](_, _)) =>
// we have to instantiate a rho type
instantiate(fa, sigmaRegion).flatMap(loop(revArgs, leftKind, _))
instantiate(fa).flatMap(loop(revArgs, leftKind, _))
case ((v0, k) :: rest, _) =>
// (k -> leftKind)(k)
for {
Expand Down
Loading