Skip to content

Commit e561df6

Browse files
committed
fixed typing annotations being incorrectly interpreted as classes instead of instances of repective classes microsoft#459
1 parent 54fa812 commit e561df6

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ public IAnalysisSet EvaluateAnnotation(Expression annotation) {
9999
Evaluate(annotation);
100100

101101
return new TypeAnnotation(_unit.State.LanguageVersion, annotation)
102-
.GetValue(new ExpressionEvaluatorAnnotationConverter(this, annotation, _unit)) ?? AnalysisSet.Empty;
102+
.GetValue(new ExpressionEvaluatorAnnotationConverter(this, annotation, _unit))
103+
?.GetInstanceType() ?? AnalysisSet.Empty;
103104
}
104105

105106
/// <summary>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private IAnalysisSet FinalizeNames(IAnalysisSet types) {
6262
}
6363
var n = c.GetConstantValueAsString();
6464
if (!string.IsNullOrEmpty(n)) {
65-
return _eval.LookupAnalysisSetByName(_node, n, addDependency: true).GetInstanceType();
65+
return _eval.LookupAnalysisSetByName(_node, n, addDependency: true);
6666
}
6767
return c;
6868
})

src/Analysis/Engine/Impl/Values/TypingTypeInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public override IAnalysisSet Call(Node node, AnalysisUnit unit, IAnalysisSet[] a
5757
returnInternalTypes: true
5858
);
5959
foreach (var type in ce.Args.MaybeEnumerate().Where(e => e?.Expression != null).Select(e => new TypeAnnotation(unit.State.LanguageVersion, e.Expression))) {
60-
newArgs.Add(type.GetValue(eval) ?? AnalysisSet.Empty);
60+
newArgs.Add(type.GetValue(eval)?.GetInstanceType() ?? AnalysisSet.Empty);
6161
}
6262
return new TypingTypeInfo(_baseName, _innerValue, newArgs);
6363
});
@@ -83,7 +83,7 @@ public override IAnalysisSet GetIndex(Node node, AnalysisUnit unit, IAnalysisSet
8383
returnInternalTypes: true
8484
);
8585
foreach (var type in exprs.Select(e => new TypeAnnotation(unit.State.LanguageVersion, e))) {
86-
newArgs.Add(type.GetValue(eval) ?? AnalysisSet.Empty);
86+
newArgs.Add(type.GetValue(eval)?.GetInstanceType() ?? AnalysisSet.Empty);
8787
}
8888
return new TypingTypeInfo(_baseName, _innerValue, newArgs);
8989
});

0 commit comments

Comments
 (0)