131 references to GetConstantValue
Microsoft.CodeAnalysis.CodeStyle (2)
Microsoft.CodeAnalysis.CSharp.CodeStyle (10)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.Features (14)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (33)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (48)
Compilation\SemanticModelAPITests.cs (38)
1437var constantInfo = speculativeModel.GetConstantValue(expr);
1475var constantInfo = speculativeModel.GetConstantValue(expr);
1523var constantInfo = speculativeModel.GetConstantValue(expr);
1611var constantInfo = speculativeModel.GetConstantValue(expr);
1696var constantInfo = speculativeModel.GetConstantValue(expr);
2785var constantVal = speculativeModel.GetConstantValue(switchLabel.Value);
3912var value0 = model.GetConstantValue(init0);
3921var value1 = model.GetConstantValue(init1);
3928var value2 = model.GetConstantValue(init2);
4108Assert.True(model.GetConstantValue(actual[0]).HasValue);
4109Assert.Equal("Hello, world!", model.GetConstantValue(actual[0]).Value);
4110Assert.False(model.GetConstantValue(actual[1]).HasValue);
4146Assert.Equal("Number 3", model.GetConstantValue(actual[0]).Value);
4149Assert.Equal("Level 5 Number 3", model.GetConstantValue(actual[1]).Value);
4151Assert.False(model.GetConstantValue(actual[2]).HasValue);
4154Assert.Equal("Testing", model.GetConstantValue(actual[3]).Value);
4157Assert.Equal("ConstantInterpolatedString", model.GetConstantValue(actual[4]).Value);
4160Assert.Equal("Level 5", model.GetConstantValue(actual[5]).Value);
4163Assert.Equal("Radio Noise", model.GetConstantValue(actual[6]).Value);
4166Assert.Equal("Level 5", model.GetConstantValue(actual[7]).Value);
4188Assert.True(model.GetConstantValue(actual[0]).HasValue);
4189Assert.Equal("Hello, world!", model.GetConstantValue(actual[0]).Value);
4191Assert.False(model.GetConstantValue(actual[1]).HasValue);
4213Assert.True(model.GetConstantValue(actual[0]).HasValue);
4214Assert.Equal(0, model.GetConstantValue(actual[0]).Value);
4217Assert.True(model.GetConstantValue(actual[1]).HasValue);
4218Assert.Equal(true, model.GetConstantValue(actual[1]).Value);
4241Assert.True(model.GetConstantValue(actual[0]).HasValue);
4242Assert.Null(model.GetConstantValue(actual[0]).Value);
4279Assert.Equal("Number 3", model.GetConstantValue(actual[0]).Value);
4283Assert.Equal("Level 5 Number 3", model.GetConstantValue(actual[1]).Value);
4286Assert.False(model.GetConstantValue(actual[2]).HasValue);
4290Assert.Equal("Testing", model.GetConstantValue(actual[3]).Value);
4294Assert.Equal("ConstantInterpolatedString", model.GetConstantValue(actual[4]).Value);
4298Assert.Equal("Level 5", model.GetConstantValue(actual[5]).Value);
4302Assert.Equal("Radio Noise", model.GetConstantValue(actual[6]).Value);
4306Assert.Equal("Level 5", model.GetConstantValue(actual[7]).Value);
4460Assert.Equal("DEBUG", model.GetConstantValue(root.DescendantNodes().OfType<InvocationExpressionSyntax>().Single()));
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
Microsoft.CodeAnalysis.CSharp.Workspaces (3)
Microsoft.CodeAnalysis.Features (2)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (8)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (1)
Microsoft.Maui.Controls.BindingSourceGen (1)
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)