@@ -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