@@ -1155,15 +1155,27 @@ evalGraphRefTupleExprs mAttrs (TupleExprs fixedMarker tupleExprL) = do
1155 [] -> pure emptyAttributes
1155 [] -> pure emptyAttributes
1156 (headTuple:tailTuples) -> do
1156 (headTuple:tailTuples) -> do
1157 --gather up resolved atom types or throw an error if an attribute cannot be made concrete from the inferred types- this could still fail if the type cannot be inferred (e.g. from [Nothing, Nothing])
1157 --gather up resolved atom types or throw an error if an attribute cannot be made concrete from the inferred types- this could still fail if the type cannot be inferred (e.g. from [Nothing, Nothing])
1158− let mostResolvedTypes =
1158+ let
1159− foldr (\tup acc ->
1159+ processTupleAttrs (tupAttr, accAttr) =
1160− fmap (\(tupAttr,accAttr) -> --if the attribute is a constructedatomtype, we can recurse into it to potentially resolve type variables
1160+ --if the attribute is a constructedatomtype, we can recurse into it to potentially resolve type variables
1161− if isResolvedAttribute accAttr then
1161+ if isResolvedAttribute accAttr && tupAttr == accAttr then
1162− accAttr
1162+ pure accAttr
1164− case resolveAttributes accAttr tupAttr of
1164+ lift $ except $ resolveAttributes accAttr tupAttr
1165− Left _ -> accAttr
1165+ mostResolvedTypes <-
1166+ foldM (\acc tup -> do
1167+ let zipped = zip (V.toList $ tupleAttributes tup) acc
1168+ accNames = S.fromList $ map A.attributeName acc
1169+ tupNames = A.attributeNameSet (tupleAttributes tup)
1170+ attrNamesDiff = S.union (S.difference accNames tupNames) (S.difference tupNames accNames)
1171+ unless (null attrNamesDiff) (throwError (AttributeNamesMismatchError attrNamesDiff))
1172+ nextTupleAttrs <- mapM processTupleAttrs zipped
1173+ let diff = A.attributesDifference (A.attributesFromList nextTupleAttrs) (A.attributesFromList acc)
1174+ if diff == A.emptyAttributes then
1175+ pure nextTupleAttrs
1177+ throwError (TupleAttributeTypeMismatchError diff)
1166− Right val -> val) (zip (V.toList $ tupleAttributes tup) acc)) (V.toList $ tupleAttributes headTuple) tailTuples
1178+ ) (V.toList $ tupleAttributes headTuple) tailTuples
1167 pure (A.attributesFromList mostResolvedTypes)
1179 pure (A.attributesFromList mostResolvedTypes)
1168 --strategy: if all the tuple expr transaction markers refer to one location, then we can pass the type constructor mapping from that location, otherwise, we cannot assume that the types are the same
1180 --strategy: if all the tuple expr transaction markers refer to one location, then we can pass the type constructor mapping from that location, otherwise, we cannot assume that the types are the same
1169 tConsMap <- case singularTransactions tupleExprL of
1181 tConsMap <- case singularTransactions tupleExprL of