1 write to ConstantValue
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CompilationTestUtils.cs (1)
236summary.ConstantValue = semanticModel.GetConstantValue(expr);
67 references to ConstantValue
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (16)
Semantics\ExpressionBodiedMemberTests.cs (1)
107Assert.Equal(10, semanticInfo.ConstantValue);
Semantics\InterpolationTests.cs (1)
4617Assert.False(semanticInfo.ConstantValue.HasValue);
Semantics\RawInterpolationTests_Handler.cs (1)
2918Assert.False(semanticInfo.ConstantValue.HasValue);
Semantics\UnsafeTests.cs (13)
8888Assert.False(summary.ConstantValue.HasValue); 8923Assert.False(summary.ConstantValue.HasValue); 9350Assert.False(summary.ConstantValue.HasValue); 10642Assert.False(typeSummary.ConstantValue.HasValue); 10655Assert.Equal(s_specialTypeSizeOfMap[type.SpecialType], sizeOfSummary.ConstantValue); 10704Assert.False(typeSummary.ConstantValue.HasValue); 10717Assert.Equal(s_specialTypeSizeOfMap[type.GetEnumUnderlyingType().SpecialType], sizeOfSummary.ConstantValue); 10764Assert.False(typeSummary.ConstantValue.HasValue); 10777Assert.False(sizeOfSummary.ConstantValue.HasValue); 11320Assert.False(stackAllocSummary.ConstantValue.HasValue); 11332Assert.False(typeSummary.ConstantValue.HasValue); 11346Assert.True(countSummary.ConstantValue.HasValue); 11347Assert.Equal((short)20, countSummary.ConstantValue.Value);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (50)
Compilation\GetSemanticInfoTests.cs (4)
1428Assert.Null(bindInfo.ConstantValue.Value); 1469Assert.Null(bindInfo.ConstantValue.Value); 1503Assert.Null(bindInfo.ConstantValue.Value); 4298Assert.False(info.ConstantValue.HasValue);
Compilation\SemanticModelGetSemanticInfoTests.cs (46)
1759Assert.Null(semanticInfo.ConstantValue.Value); 1819Assert.Equal(true, semanticInfo.ConstantValue); 1849Assert.Equal(0, semanticInfo.ConstantValue); 1879Assert.Equal(0, semanticInfo.ConstantValue); 3469Assert.Equal((byte)133, semanticInfo.ConstantValue); 3948Assert.Null(semanticInfo.ConstantValue.Value); 4581Assert.Equal(2, semanticInfo.ConstantValue); 4619Assert.Equal(2, semanticInfo.ConstantValue); 4685Assert.Equal(2, semanticInfo.ConstantValue); 4826Assert.Equal(3, semanticInfo.ConstantValue); 5586Assert.Equal(1, semanticInfo.ConstantValue); 5618Assert.Equal(1, semanticInfo.ConstantValue); 5773Assert.Equal(43, semanticInfo.ConstantValue); 5840Assert.Equal(43, semanticInfo.ConstantValue); 5908Assert.Equal(43, semanticInfo.ConstantValue); 5976Assert.Equal(43, semanticInfo.ConstantValue); 6043Assert.Equal(43, semanticInfo.ConstantValue); 6071Assert.Equal(1, semanticInfo.ConstantValue); 6211Assert.Equal(5, (int)semanticInfo.ConstantValue.Value); 6818Assert.Equal(123, semanticInfo.ConstantValue); 6977Assert.Equal(1, semanticInfo.ConstantValue); 7355Assert.Equal(1, semanticInfo.ConstantValue); 7411Assert.Equal(4L, semanticInfo.ConstantValue); 7498Assert.Equal(4, semanticInfo.ConstantValue); 8526Assert.Equal(true, semanticInfo.ConstantValue); 8572Assert.Null(semanticInfo.ConstantValue.Value); 8738Assert.Equal(2.2, semanticInfo.ConstantValue); 8780Assert.Null(semanticInfo.ConstantValue.Value); 8821Assert.Equal(true, semanticInfo.ConstantValue); 8863Assert.Equal(true, semanticInfo.ConstantValue); 8945Assert.Equal(97, semanticInfo.ConstantValue); 9095Assert.Equal(0, semanticInfo.ConstantValue); 9492Assert.Equal(5, semanticInfo.ConstantValue); 10986Assert.Equal(2, semanticInfo.ConstantValue); 11017Assert.Equal(21, semanticInfo.ConstantValue); 11048Assert.Equal(21, semanticInfo.ConstantValue); 11081Assert.Equal(21, semanticInfo.ConstantValue); 11114Assert.Equal(21, semanticInfo.ConstantValue); 11278Assert.Equal((short)9, semanticInfo.ConstantValue); 11315Assert.Equal(12, semanticInfo.ConstantValue); 11352Assert.Equal(12, semanticInfo.ConstantValue); 11392Assert.Equal(12, semanticInfo.ConstantValue); 11472Assert.Equal(true, semanticInfo.ConstantValue); 11509Assert.Null(semanticInfo.ConstantValue.Value); 11722Assert.Equal(1, semanticInfo.ConstantValue); 13454Assert.Equal(1, semanticInfo.ConstantValue);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CompilationTestUtils.cs (1)
217public bool IsCompileTimeConstant { get { return ConstantValue.HasValue; } }