on master help sign in
validate that macro names do not conflict with existing relvars
4beffa3AgentM
src/lib/ProjectM36/RelationalExpression.hs+7−1
@@ -1379,8 +1379,14 @@ typeForGraphRefRelationalExpr NotEquals{} = do
1379typeForGraphRefRelationalExpr (Extend extendTupleExpr expr) = do
1379typeForGraphRefRelationalExpr (Extend extendTupleExpr expr) = do
1380 rel <- typeForGraphRefRelationalExpr expr
1380 rel <- typeForGraphRefRelationalExpr expr
1381 evalGraphRefRelationalExpr (Extend extendTupleExpr (ExistingRelation rel))
1381 evalGraphRefRelationalExpr (Extend extendTupleExpr (ExistingRelation rel))
1382−typeForGraphRefRelationalExpr expr@With{} = do
1382+typeForGraphRefRelationalExpr expr@(With withs _) = do
1383 let expr' = substituteWithNameMacros [] expr
1383 let expr' = substituteWithNameMacros [] expr
1384+ checkMacroName (WithNameExpr macroName tid) = do
1385+ rvs <- relationVariables <$> gfDatabaseContextForMarker tid
1386+ case M.lookup macroName rvs of
1387+ Just _ -> lift $ except $ Left (RelVarAlreadyDefinedError macroName) --this error does not include the transaction marker, but should be good enough to identify the cause
1388+ Nothing -> pure ()
1389+ mapM checkMacroName (map fst withs)
1384 typeForGraphRefRelationalExpr expr'
1390 typeForGraphRefRelationalExpr expr'
1385
1391
1386evalGraphRefAttributeNames :: GraphRefAttributeNames -> GraphRefRelationalExpr -> GraphRefRelationalExprM (S.Set AttributeName)
1392evalGraphRefAttributeNames :: GraphRefAttributeNames -> GraphRefRelationalExpr -> GraphRefRelationalExprM (S.Set AttributeName)
test/TutorialD/Interpreter/TestBase.hs+1−1
@@ -49,7 +49,7 @@ expectTutorialDErr sessionId conn matchFunc tutd = case parseTutorialD tutd of
49 DisplayRelationResult _ -> assertFailure "displayrelation?"
49 DisplayRelationResult _ -> assertFailure "displayrelation?"
50 DisplayDataFrameResult _ -> assertFailure "displaydataframe?"
50 DisplayDataFrameResult _ -> assertFailure "displaydataframe?"
51 DisplayParseErrorResult _ _ -> assertFailure "displayparseerrorresult?"
51 DisplayParseErrorResult _ _ -> assertFailure "displayparseerrorresult?"
52− DisplayErrorResult err -> assertBool ("match error on: " ++ unpack err) (matchFunc err)
52+ DisplayErrorResult err -> assertBool (unpack tutd ++ " match error on: " ++ unpack err) (matchFunc err)
53 QuietSuccessResult -> pure ()
53 QuietSuccessResult -> pure ()
54
54
55eitherFail :: Either RelationalError a -> IO ()
55eitherFail :: Either RelationalError a -> IO ()