File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
src/Language/PureScript/TypeChecker Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 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"
Original file line number Diff line number Diff line change @@ -1010,10 +1010,11 @@ check' (TypeClassDictionaryConstructorApp name ps) t = do
10101010 return $ TypedValue True (TypeClassDictionaryConstructorApp name ps') t
10111011check' (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
You can’t perform that action at this time.
0 commit comments