From 5f579d83ab0567852843a05b11be17abc68a0148 Mon Sep 17 00:00:00 2001 From: Mike Solomon Date: Sun, 21 Aug 2022 20:55:16 +0300 Subject: [PATCH] Gets rid of typing rule for record identifiers --- src/Language/PureScript/TypeChecker/Types.hs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/Language/PureScript/TypeChecker/Types.hs b/src/Language/PureScript/TypeChecker/Types.hs index 59c73e66e8..b230610cc4 100644 --- a/src/Language/PureScript/TypeChecker/Types.hs +++ b/src/Language/PureScript/TypeChecker/Types.hs @@ -369,20 +369,10 @@ infer' (Literal ss (ArrayLiteral vals)) = do return $ TypedValue' True (Literal ss (ArrayLiteral ts')) (srcTypeApp tyArray els) infer' (Literal ss (ObjectLiteral ps)) = do ensureNoDuplicateProperties ps - -- We make a special case for Vars in record labels, since these are the - -- only types of expressions for which 'infer' can return a polymorphic type. - -- They need to be instantiated here. - let shouldInstantiate :: Expr -> Bool - shouldInstantiate Var{} = True - shouldInstantiate (PositionedValue _ _ e) = shouldInstantiate e - shouldInstantiate _ = False - - inferProperty :: (PSString, Expr) -> m (PSString, (Expr, SourceType)) + let inferProperty :: (PSString, Expr) -> m (PSString, (Expr, SourceType)) inferProperty (name, val) = do TypedValue' _ val' ty <- infer val - valAndType <- if shouldInstantiate val - then instantiatePolyTypeWithUnknowns val' ty - else pure (val', ty) + valAndType <- instantiatePolyTypeWithUnknowns val' ty pure (name, valAndType) toRowListItem (lbl, (_, ty)) = srcRowListItem (Label lbl) ty