Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Civl] miscellaneous bug fixes #806

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/Concurrency/CivlTypeChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public static void CheckRefinementSignature(YieldProcedureDecl proc, CheckingCon
var procInParams = proc.InParams.Where(x => proc.VisibleFormals.Contains(x)).ToList();
var procOutParams = proc.OutParams.Where(x => proc.VisibleFormals.Contains(x)).ToList();
var actionInParams = refinedActionDecl.InParams;
var actionOutParams = refinedActionDecl.OutParams.SkipLast(refinedActionDecl.Creates.Count).ToList();
var actionOutParams = refinedActionDecl.OutParams;
signatureMatcher.MatchFormals(procInParams, actionInParams, SignatureMatcher.IN);
signatureMatcher.MatchFormals(procOutParams, actionOutParams, SignatureMatcher.OUT);
}
Expand Down
9 changes: 9 additions & 0 deletions Source/Concurrency/LinearDomainCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ private bool ContainsPermissionType(Type type)
}));
}
}
if (type is MapType mapType)
{
mapType.Arguments.ForEach(argType => ContainsPermissionType(argType));
ContainsPermissionType(mapType.Result);
if (ContainsPermissionType(mapType.Result))
{
linearTypes.Add(type);
}
}
}
return linearTypes.Contains(type);
}
Expand Down
1 change: 1 addition & 0 deletions Source/Concurrency/LinearTypeChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ lheapValExpr.Args[0].Type is CtorType ctorType &&
{
return ExtractRootFromAccessPathExpr(lheapValExpr.Args[0]);
}
return ExtractRootFromAccessPathExpr(nAryExpr.Args[0]);
}
}
return null;
Expand Down
9 changes: 3 additions & 6 deletions Source/Core/AST/AbsyExpr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1357,12 +1357,9 @@ public override void Typecheck(TypecheckingContext tc)
if (Decl is GlobalVariable)
{
var globalVarLayerRange = Decl.LayerRange;
if (actionDecl.HasMoverType)
{
// a global variable introduced at layer n is visible to a mover action only at layer n+1 or higher
globalVarLayerRange = new LayerRange(globalVarLayerRange.LowerLayer + 1, globalVarLayerRange.UpperLayer);
}
if (!actionDecl.LayerRange.Subset(globalVarLayerRange))
if (!actionDecl.LayerRange.Subset(globalVarLayerRange) ||
// a global variable introduced at layer n is visible to a mover action only at layer n+1 or higher
actionDecl.HasMoverType && actionDecl.LayerRange.LowerLayer == globalVarLayerRange.LowerLayer)
{
tc.Error(this, $"variable not available across layers in {actionDecl.LayerRange}: {Decl.Name}");
}
Expand Down
Loading