96 references to IsBad
Microsoft.CodeAnalysis (4)
EnumConstantHelper.cs (1)
22Debug.Assert(!constantValue.IsBad);
Operations\ControlFlowGraphBuilder.cs (2)
4914else if (!(operation.StepValue.GetConstantValue() is { IsBad: false }) && 5087else if (operation.StepValue.GetConstantValue() is { IsBad: false } value)
Operations\Operation.cs (1)
98if (OperationConstantValue == null || OperationConstantValue.IsBad)
Microsoft.CodeAnalysis.CSharp (90)
Binder\Binder_Attributes.cs (1)
852if (constantValue.IsBad)
Binder\Binder_Conversions.cs (6)
1964hasErrors |= constantValue?.IsBad == true; 2382lambdaParameter.ExplicitDefaultConstantValue is { IsBad: false } lambdaParamDefault) 2385if (delegateParamDefault?.IsBad != true && lambdaParamDefault != delegateParamDefault) 3154else if (sourceConstantValue.IsBad) 3216Debug.Assert(!sourceValue.IsBad); 3587if (value.IsBad)
Binder\Binder_Expressions.cs (2)
4721if (constantValue == null || constantValue.IsBad || expression.Type.SpecialType != SpecialType.System_Int32) 4739if (constantValue == null || constantValue.IsBad)
Binder\Binder_InterpolatedString.cs (4)
103if (alignmentConstant != null && !alignmentConstant.IsBad) 144!(value.ConstantValueOpt is { IsString: true, IsBad: false })) 324p is BoundStringInsert { Alignment.ConstantValueOpt: null or { IsBad: true } } or 325BoundStringInsert { Format.ConstantValueOpt: null or { IsBad: true } });
Binder\Binder_Invocation.cs (2)
1666if (InAttributeArgument && parameterDefaultValue?.IsBad == true) 1675{ IsBad: true } => ConstantValue.Null,
Binder\Binder_Operators.cs (16)
1082hasErrors = hasErrors || resultConstant != null && resultConstant.IsBad; 1396resultKind: LookupResultKind.Viable, left, right, type: left.Type, hasErrors: constantValue != null && constantValue.IsBad); 2618if (resultTypeSymbol.SpecialType != SpecialType.System_Boolean && constantValue != null && !constantValue.IsBad) 2660if (valueLeft.IsBad || valueRight.IsBad) 2695if (concatResult.IsBad) 4258if (constantValue != null && !constantValue.IsBad) 4285if (value == null || value.IsBad) 4791if (constantValue.IsBad) 5350if (constantValue.IsBad) 5378if (isOperatorConstantResult.IsBad) 5738return new BoundUnconvertedConditionalOperator(node, condition, trueExpr, falseExpr, constantValue, noCommonTypeError, hasErrors: constantValue?.IsBad == true); 5758hasErrors = constantValue != null && constantValue.IsBad; 5831if (trueValue == null || trueValue.IsBad) 5837if (falseValue == null || falseValue.IsBad) 5843if (conditionValue == null || conditionValue.IsBad)
Binder\Binder_Patterns.cs (1)
1648if (!hasErrors && constantValueOpt != null && !constantValueOpt.IsBad && double.IsNaN(constantValueOpt.DoubleValue))
Binder\DecisionDagBuilder.cs (3)
1157if (valueFac == null || value.IsBad) 2238case BoundDagValueTest t when !t.Value.IsBad: 2242case BoundDagRelationalTest t when !t.Value.IsBad:
Binder\PatternExplainer.cs (1)
614if (value.IsBad)
Binder\Semantics\Conversions\ConversionsBase.cs (2)
1368int value = constantValue.IsBad ? 0 : constantValue.Int32Value; 1390else if (specialSource == SpecialType.System_Int64 && destination.GetSpecialTypeSafe() == SpecialType.System_UInt64 && (constantValue.IsBad || 0 <= constantValue.Int64Value))
Binder\SwitchBinder.cs (2)
108if ((object)constantValue != null && !constantValue.IsBad) 290if ((object)constantValue != null && !constantValue.IsBad)
Binder\SwitchBinder_Patterns.cs (1)
109if (label.Pattern is BoundConstantPattern cp && !cp.ConstantValue.IsBad && FindMatchingSwitchCaseLabel(cp.ConstantValue, p) != label.Label)
Compilation\MemberSemanticModel.cs (1)
1265return constantValue == null || constantValue.IsBad
Compiler\MethodCompiler.cs (1)
582SetGlobalErrorIfTrue(constantValue == null || constantValue.IsBad);
Lowering\LocalRewriter\LocalRewriter_AsOperator.cs (1)
55if (constantValue.IsBad)
Lowering\LocalRewriter\LocalRewriter_IsOperator.cs (1)
62if (constantValue.IsBad)
Lowering\LocalRewriter\LocalRewriter_Literal.cs (1)
47return new BoundLiteral(syntax, constantValue, type, hasErrors: constantValue.IsBad);
Symbols\FieldSymbol.cs (1)
159return constantValue != null && !constantValue.IsBad; //can be null in error scenarios
Symbols\LocalSymbol.cs (1)
331return constantValue != null && !constantValue.IsBad; //can be null in error scenarios
Symbols\Source\FieldSymbolWithAttributesAndModifiers.cs (2)
267if (!attrValue.IsBad) 279if ((object)constValue != null && !constValue.IsBad && constValue != attrValue)
Symbols\Source\SourceComplexParameterSymbol.cs (3)
267if (!_lazyDefaultSyntaxValue.IsBad) 333if (defaultValue == null || defaultValue.IsBad) 899if (!value.IsBad)
Symbols\Source\SourceEnumConstantSymbol.cs (1)
211if (otherValue.IsBad)
Symbols\Source\SourceFieldSymbol.cs (1)
301!value.IsBad &&
Utilities\ValueSetFactory.BoolValueSet.cs (2)
56bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, value.BooleanValue); 71bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, value.BooleanValue);
Utilities\ValueSetFactory.BoolValueSetFactory.cs (3)
55return value.IsBad ? BoolValueSet.AllValues : Related(relation, value.BooleanValue); 61return left.IsBad || right.IsBad || left.BooleanValue == right.BooleanValue;
Utilities\ValueSetFactory.ByteTC.cs (1)
55byte INumericTC<byte>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? (byte)0 : constantValue.ByteValue;
Utilities\ValueSetFactory.CharTC.cs (1)
49char INumericTC<char>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? (char)0 : constantValue.CharValue;
Utilities\ValueSetFactory.DecimalTC.cs (1)
35public decimal FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? 0m : constantValue.DecimalValue;
Utilities\ValueSetFactory.DecimalValueSetFactory.cs (1)
28value.IsBad ? NumericValueSet<decimal>.AllValues(DecimalTC.Instance) : Related(relation, DecimalTC.Instance.FromConstantValue(value));
Utilities\ValueSetFactory.DoubleTC.cs (1)
83double INumericTC<double>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? 0.0 : constantValue.DoubleValue;
Utilities\ValueSetFactory.EnumeratedValueSet.cs (2)
88bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, _tc.FromConstantValue(value)); 111bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, _tc.FromConstantValue(value));
Utilities\ValueSetFactory.EnumeratedValueSetFactory.cs (1)
39value.IsBad || value.IsNull ? EnumeratedValueSet<T>.AllValues(_tc) : this.Related(relation, _tc.FromConstantValue(value));
Utilities\ValueSetFactory.FloatingValueSet.cs (2)
139value.IsBad || this.Any(relation, _tc.FromConstantValue(value)); 148bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, _tc.FromConstantValue(value));
Utilities\ValueSetFactory.FloatingValueSetFactory.cs (1)
36value.IsBad
Utilities\ValueSetFactory.IntTC.cs (1)
65public int FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? 0 : constantValue.Int32Value;
Utilities\ValueSetFactory.LongTC.cs (1)
55long INumericTC<long>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? 0L : constantValue.Int64Value;
Utilities\ValueSetFactory.NintValueSet.cs (2)
74bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || All(relation, value.Int32Value); 85bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, value.Int32Value);
Utilities\ValueSetFactory.NintValueSetFactory.cs (1)
45return value.IsBad ? NintValueSet.AllValues : Related(relation, IntTC.DefaultInstance.FromConstantValue(value));
Utilities\ValueSetFactory.NonNegativeIntValueSetFactory.cs (1)
58value.IsBad ? AllValues : Related(relation, IntTC.NonNegativeInstance.FromConstantValue(value));
Utilities\ValueSetFactory.NuintValueSet.cs (2)
63bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || All(relation, value.UInt32Value); 72bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, value.UInt32Value);
Utilities\ValueSetFactory.NuintValueSetFactory.cs (1)
43return value.IsBad ? NuintValueSet.AllValues : Related(relation, UIntTC.Instance.FromConstantValue(value));
Utilities\ValueSetFactory.NumericValueSet.cs (2)
107bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, _tc.FromConstantValue(value)); 129bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, _tc.FromConstantValue(value));
Utilities\ValueSetFactory.NumericValueSetFactory.cs (1)
53value.IsBad ? NumericValueSet<T>.AllValues(_tc) : Related(relation, _tc.FromConstantValue(value));
Utilities\ValueSetFactory.SByteTC.cs (1)
54sbyte INumericTC<sbyte>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? (sbyte)0 : constantValue.SByteValue;
Utilities\ValueSetFactory.ShortTC.cs (1)
55short INumericTC<short>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? (short)0 : constantValue.Int16Value;
Utilities\ValueSetFactory.SingleTC.cs (1)
87float INumericTC<float>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? 0.0F : constantValue.SingleValue;
Utilities\ValueSetFactory.StringTC.cs (1)
19var result = constantValue.IsBad ? string.Empty : constantValue.StringValue;
Utilities\ValueSetFactory.UIntTC.cs (1)
49public uint FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? (uint)0 : constantValue.UInt32Value;
Utilities\ValueSetFactory.ULongTC.cs (1)
55ulong INumericTC<ulong>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? 0UL : constantValue.UInt64Value;
Utilities\ValueSetFactory.UShortTC.cs (1)
49ushort INumericTC<ushort>.FromConstantValue(ConstantValue constantValue) => constantValue.IsBad ? (ushort)0 : constantValue.UInt16Value;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\ConstantTests.cs (1)
1465if (constantValue.IsBad)
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
PDB\MethodDebugInfo.Native.cs (1)
662if (constantValue.IsBad)