Skip to content

Commit cd6b2d0

Browse files
committed
Merge branch '682' into 0.6
2 parents b6c82cb + 89b0703 commit cd6b2d0

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module Main where
2+
3+
type X r = { | r }
4+
5+
foreign import x "var x = {};" :: forall r. X r
6+
7+
blah :: forall r. X r -> X r
8+
blah x = x
9+
10+
test = blah x
11+
{ baz = "blah"
12+
}
13+
14+
main = Debug.Trace.trace "Done"

src/Language/PureScript/TypeChecker/Types.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,10 +1010,11 @@ check' (TypeClassDictionaryConstructorApp name ps) t = do
10101010
return $ TypedValue True (TypeClassDictionaryConstructorApp name ps') t
10111011
check' (ObjectUpdate obj ps) t@(TypeApp o row) | o == tyObject = do
10121012
ensureNoDuplicateProperties ps
1013-
us <- zip (map fst ps) <$> replicateM (length ps) fresh
1013+
-- We need to be careful to avoid duplicate labels here.
1014+
-- We check _obj_ agaist the type _t_ with the types in _ps_ replaced with unknowns.
10141015
let (propsToCheck, rest) = rowToList row
1015-
propsToRemove = map fst ps
1016-
remainingProps = filter (\(p, _) -> p `notElem` propsToRemove) propsToCheck
1016+
(removedProps, remainingProps) = partition (\(p, _) -> p `elem` map fst ps) propsToCheck
1017+
us <- zip (map fst removedProps) <$> replicateM (length ps) fresh
10171018
obj' <- check obj (TypeApp tyObject (rowFromList (us ++ remainingProps, rest)))
10181019
ps' <- checkProperties ps row True
10191020
return $ TypedValue True (ObjectUpdate obj' ps') t

0 commit comments

Comments
 (0)