Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit d273be1

Browse files
authored
add hack to prevent True/False/None/... from being use-before-def (microsoft#464)
1 parent 4449820 commit d273be1

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/Analysis/Engine/Impl/Analyzer/ExpressionEvaluator.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,19 @@ public IAnalysisSet LookupAnalysisSetByName(Node node, string name, bool addRef
149149
refs = createIn.CreateVariable(node, _unit, name, addRef);
150150
res = refs.Types;
151151
} else {
152-
// ... warn the user
153-
warn = true;
152+
switch (name) {
153+
// "atom" in Python grammar.
154+
case "True":
155+
case "False":
156+
case "None":
157+
case "...":
158+
Debug.Fail($"Known good name '{name}' not found in scope");
159+
break;
160+
default:
161+
// ... warn the user
162+
warn = true;
163+
break;
164+
}
154165
}
155166
}
156167
}

0 commit comments

Comments
 (0)