Skip to content

Commit 09b5082

Browse files
committed
Changes from meeting
1 parent fc32f52 commit 09b5082

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

shared/src/main/scala/mlscript/ConstraintSolver.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -849,15 +849,15 @@ class ConstraintSolver extends NormalForms { self: Typer =>
849849
}
850850
val u = lhs.tsc.filter(_._1.constraints.sizeCompare(1) === 0)
851851
u.foreachEntry { case (k, _) =>
852-
k.tvs.foreach {
852+
k.tvs.mapValues(_.unwrapProxies).foreach { // TODO less inefficient; remove useless case
853853
case (_,tv: TV) => tv.tsc.remove(k)
854854
case (_,ProvType(tv: TV)) => tv.tsc.remove(k)
855855
case _ => ()
856856
}
857857
}
858858
u.foreachEntry { case (k, _) =>
859859
k.constraints.head.zip(k.tvs).foreach {
860-
case (c, (pol, t)) => if (pol) rec(t, c, true) else rec(c, t, true)
860+
case (c, (pol, t)) => if (pol) rec(t, c, false) else rec(c, t, false)
861861
}
862862
}
863863
lhs.lowerBounds.foreach(rec(_, rhs, true)) // propagate from the bound
@@ -877,15 +877,15 @@ class ConstraintSolver extends NormalForms { self: Typer =>
877877
}
878878
val u = rhs.tsc.filter(_._1.constraints.sizeCompare(1) === 0)
879879
u.foreachEntry { case (k, _) =>
880-
k.tvs.foreach {
880+
k.tvs.mapValues(_.unwrapProxies).foreach { // TODO less inefficient; remove useless case
881881
case (_,tv: TV) => tv.tsc.remove(k)
882882
case (_,ProvType(tv: TV)) => tv.tsc.remove(k)
883883
case _ => ()
884884
}
885885
}
886886
u.foreachEntry { case (k, _) =>
887887
k.constraints.head.zip(k.tvs).foreach {
888-
case (c, (pol, t)) => if (pol) rec(t, c, true) else rec(c, t, true)
888+
case (c, (pol, t)) => if (pol) rec(t, c, false) else rec(c, t, false)
889889
}
890890
}
891891
rhs.upperBounds.foreach(rec(lhs, _, true)) // propagate from the bound

shared/src/test/diff/fcp/Overloads.mls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ f(0) + 1
109109
//│ ╟── type `number` is not an instance of type `int`
110110
//│ ║ l.13: def BBNN: bool -> bool & number -> number
111111
//│ ║ ^^^^^^
112-
//│ ╟── but it flows into integer literal with expected type `int`
112+
//│ ╟── but it flows into application with expected type `int`
113113
//│ ║ l.105: f(0) + 1
114-
//│ ╙── ^
114+
//│ ╙── ^^^^
115115
//│ res: error | int
116116

117117
f : int -> number

shared/src/test/diff/nu/HeungTung.mls

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,7 @@ g(0)
488488
//│ ╔══[ERROR] Type mismatch in application:
489489
//│ ║ l.487: g(0)
490490
//│ ║ ^^^^
491-
//│ ╟── integer literal of type `Int` does not match type `?a`
492-
//│ ║ l.487: g(0)
493-
//│ ║ ^
491+
//│ ╟── expression of type `Int` does not match type `?a`
494492
//│ ╟── Note: constraint arises from application:
495493
//│ ║ l.477: let g = x => s(r(x))
496494
//│ ╙── ^^^^
@@ -523,15 +521,14 @@ fun snd: A -> Int -> Int & Str -> Str -> Str
523521
:e
524522
x => app2(snd)(x):Int
525523
//│ ╔══[ERROR] Type mismatch in type ascription:
526-
//│ ║ l.524: x => app2(snd)(x):Int
524+
//│ ║ l.522: x => app2(snd)(x):Int
527525
//│ ║ ^^^^^^^^^^^^
528-
//│ ╟── application of type `Int` is not an instance of type `A`
526+
//│ ╟── type `Int` is not an instance of type `A`
527+
//│ ║ l.515: fun app2: ('a -> 'a -> 'a) -> 'a -> 'a
528+
//│ ║ ^^
529529
//│ ╟── Note: constraint arises from type reference:
530-
//│ ║ l.520: fun snd: A -> Int -> Int & Str -> Str -> Str
531-
//│ ║ ^
532-
//│ ╟── from type reference:
533-
//│ ║ l.524: x => app2(snd)(x):Int
534-
//│ ╙── ^^^
530+
//│ ║ l.518: fun snd: A -> Int -> Int & Str -> Str -> Str
531+
//│ ╙── ^
535532
//│ nothing -> Int
536533
//│ res
537534
//│ = <no result>

0 commit comments

Comments
 (0)