Skip to content

Commit

Permalink
Update SemanticModelAPITests.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Sun committed Aug 14, 2020
1 parent 4e2f8fe commit 8333853
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4025,7 +4025,7 @@ static void F()
}

[WorkItem(976, "https://github.com/dotnet/roslyn/issues/976")]
[Fact(Skip = "PROTOTYPE(CONSTISTR) - Asserts that Interpolated Strings are not constant, but the first can be.")]
[Fact]
public void ConstantValueOfInterpolatedString()
{
var source = @"
Expand All @@ -4041,9 +4041,15 @@ static void Main(string[] args)
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe);
var tree = comp.SyntaxTrees.Single();
var model = comp.GetSemanticModel(tree);

var expected = new bool[2];
expected[0] = true;
expected[1] = false;
var iterator = 0;
foreach (var interp in tree.GetRoot().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>())
{
Assert.False(model.GetConstantValue(interp).HasValue);
Assert.Equal(expected[iterator], model.GetConstantValue(interp).HasValue);
iterator++;
}
}

Expand Down

0 comments on commit 8333853

Please sign in to comment.