-
Notifications
You must be signed in to change notification settings - Fork 262
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
Name resolution error #2905
Comments
Two workarounds for now, until @keyboardDrummer or myself find a fix
|
I think this PR will fix it: #2734 |
The issue seems to be new in 3.8.0; the original example was OK in 3.7.3.
|
Looks like we might be able to fix this before the refactoring by reverting / fixing this commit:
|
Yes, I'd be in favour of that, although note that it would break the hover feature in the IDE which #2437 fixed. |
I wonder why we use Bad patch: diff --git a/Source/DafnyCore/Cloner.cs b/Source/DafnyCore/Cloner.cs
index ccfe66355..a01ce6e53 100644
--- a/Source/DafnyCore/Cloner.cs
+++ b/Source/DafnyCore/Cloner.cs
@@ -208,7 +208,7 @@ namespace Microsoft.Dafny {
}
public virtual LocalVariable CloneLocalVariable(LocalVariable local) {
- return new LocalVariable(Tok(local.Tok), Tok(local.EndTok), local.Name, CloneType(local.OptionalType), local.IsGhost);
+ return new LocalVariable(Tok(local.Tok), Tok(local.EndTok), local.Name, local.OptionalType, local.IsGhost);
}
public virtual VT CloneIVariable<VT>(VT v) where VT : IVariable {
var iv = (IVariable)v;
diff --git a/Source/DafnyCore/Resolver.cs b/Source/DafnyCore/Resolver.cs
index 3cd4261f0..c90d816ee 100644
--- a/Source/DafnyCore/Resolver.cs
+++ b/Source/DafnyCore/Resolver.cs
@@ -12174,7 +12174,7 @@ namespace Microsoft.Dafny {
private class ClonerKeepLocalVariablesIfTypeNotSet : Cloner {
public override LocalVariable CloneLocalVariable(LocalVariable local) {
if (local.type == null) {
- return local;
+ local.type = new InferredTypeProxy();
}
return base.CloneLocalVariable(local); |
…ors anymore This PR ensures that, in the case of branch duplication in resolution, exactly one branch reuses the same variables as the original branch (local variable declarations, formals, and bound variables in patterns). That way, we fix #2905 and moreover fix the previous issue that hovering other variables in match cases was not displaying type information
This minimal code, if executed with Dafny, will trigger the following error:
The text was updated successfully, but these errors were encountered: