783 references to HasValue
Microsoft.CodeAnalysis (12)
DiagnosticAnalyzer\AnalyzerDriver.cs (1)
1509if (!optionalEvent.HasValue)
DiagnosticAnalyzer\AsyncQueue.cs (3)
238return result.HasValue 248if (!result.HasValue) 259/// <see cref="Optional{T}.HasValue"/> will be <see langword="false"/>.
Operations\IOperation.cs (2)
43/// If the operation is an expression that evaluates to a constant value, <see cref="Optional{Object}.HasValue"/> is true and <see cref="Optional{Object}.Value"/> is the value of the expression. Otherwise, <see cref="Optional{Object}.HasValue"/> is false.
Operations\Operation.cs (2)
93/// If the operation is an expression that evaluates to a constant value, <see cref="Optional{Object}.HasValue"/> is true and <see cref="Optional{Object}.Value"/> is the value of the expression. Otherwise, <see cref="Optional{Object}.HasValue"/> is false.
Optional.cs (4)
10/// Combines a value, <see cref="Value"/>, and a flag, <see cref="HasValue"/>, 39/// Gets the value of the current object. Not meaningful unless <see cref="HasValue"/> returns <see langword="true"/>. 43/// <see cref="HasValue"/> is <see langword="false"/>.</para> 46/// <para>The value if <see cref="HasValue"/> is <see langword="true"/>; otherwise, the default value for type
Microsoft.CodeAnalysis.CodeStyle (26)
AbstractPopulateSwitchDiagnosticAnalyzer.cs (1)
119=> constantValue.HasValue && Equals(constantValue.Value, value);
AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (1)
93if (operand.ConstantValue.HasValue && operand.Kind == OperationKind.Literal &&
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
233if (!initializer.Value.ConstantValue.HasValue)
AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (2)
159value.ConstantValue.HasValue) 621if (assignmentValue.ConstantValue.HasValue)
AbstractSimplifyConditionalDiagnosticAnalyzer.cs (1)
164return constantValue.HasValue && constantValue.Value is bool b && b == value;
AbstractSimplifyInterpolationHelpers.cs (3)
90if (invocation.Arguments[0].Value is ILiteralOperation { ConstantValue: { HasValue: true, Value: string value } } literal && 211? alignmentOp is { ConstantValue.HasValue: true } 248=> argument.Value.ConstantValue is { HasValue: true, Value: ' ' };
AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
266return operation.ConstantValue.HasValue &&
CustomDataFlowAnalysis.cs (1)
149if (current.BranchValue.ConstantValue.HasValue && current.BranchValue.ConstantValue.Value is bool constant)
EditorConfigValueSerializer.cs (1)
50return optionalBool.HasValue ? new Optional<bool?>(optionalBool.Value) : new Optional<bool?>();
EditorConfigValueSerializer`1.cs (1)
47if (optionalValue.HasValue)
EmbeddedSyntaxToken.cs (6)
65kind.HasValue ? kind.Value : Kind, 66leadingTrivia.HasValue ? leadingTrivia.Value : LeadingTrivia, 67virtualChars.HasValue ? virtualChars.Value : VirtualChars, 68trailingTrivia.HasValue ? trailingTrivia.Value : TrailingTrivia, 69diagnostics.HasValue ? diagnostics.Value : Diagnostics, 70value.HasValue ? value.Value : Value);
OperationExtensions.cs (1)
372=> operand is ILiteralOperation { ConstantValue: { HasValue: true, Value: null } };
PopulateSwitchExpressionHelpers.cs (2)
45if (arm.Pattern is IConstantPatternOperation { Value.ConstantValue: { HasValue: true, Value: null } }) 79if (operation is IConstantPatternOperation { Value.ConstantValue: { HasValue: true, Value: not null and var value } })
PopulateSwitchStatementHelpers.cs (2)
78if (value.ConstantValue is { HasValue: true, Value: null }) 108if (value is null || !value.ConstantValue.HasValue)
SuppressMessageAttributeState.cs (1)
145value.ConstantValue.HasValue &&
UseConditionalExpressionHelpers.cs (1)
105=> trueValue is ILiteralOperation { ConstantValue: { HasValue: true, Value: bool value } } && value == val;
Microsoft.CodeAnalysis.CodeStyle.Fixes (20)
CodeGenerationContext.cs (14)
199var newContextLocation = contextLocation.HasValue ? contextLocation.Value : this.ContextLocation; 200var newAfterThisLocation = afterThisLocation.HasValue ? afterThisLocation.Value : this.AfterThisLocation; 201var newBeforeThisLocation = beforeThisLocation.HasValue ? beforeThisLocation.Value : this.BeforeThisLocation; 202var newAddImports = addImports.HasValue ? addImports.Value : this.AddImports; 203var newAdditionalImports = additionalImports.HasValue ? additionalImports.Value : this.AdditionalImports; 204var newGenerateMembers = generateMembers.HasValue ? generateMembers.Value : this.GenerateMembers; 205var newMergeNestedNamespaces = mergeNestedNamespaces.HasValue ? mergeNestedNamespaces.Value : this.MergeNestedNamespaces; 206var newMergeAttributes = mergeAttributes.HasValue ? mergeAttributes.Value : this.MergeAttributes; 207var newGenerateDefaultAccessibility = generateDefaultAccessibility.HasValue ? generateDefaultAccessibility.Value : this.GenerateDefaultAccessibility; 208var newGenerateMethodBodies = generateMethodBodies.HasValue ? generateMethodBodies.Value : this.GenerateMethodBodies; 209var newGenerateDocumentationComments = generateDocumentationComments.HasValue ? generateDocumentationComments.Value : this.GenerateDocumentationComments; 210var newAutoInsertionLocation = autoInsertionLocation.HasValue ? autoInsertionLocation.Value : this.AutoInsertionLocation; 211var newSortMembers = sortMembers.HasValue ? sortMembers.Value : this.SortMembers; 212var newReuseSyntax = reuseSyntax.HasValue ? reuseSyntax.Value : this.ReuseSyntax;
CodeGenerationSymbolFactory.cs (3)
306name.HasValue ? name.Value : parameter.Name, 309defaultValue.HasValue 537returnTypeAttributes: returnTypeAttributes.HasValue ? returnTypeAttributes.Value : method.GetReturnTypeAttributes(),
SyntaxGeneratorExtensions_Negate.cs (3)
413if (numericValue.HasValue && numericValue.Value is 0) 451if (operation?.Kind == OperationKind.Literal && operation.ConstantValue.HasValue && operation.ConstantValue.Value is true) 455else if (operation?.Kind == OperationKind.Literal && operation.ConstantValue.HasValue && operation.ConstantValue.Value is false)
Microsoft.CodeAnalysis.CSharp (12)
FlowAnalysis\AbstractFlowPass.cs (5)
444this.State = initialState.HasValue ? initialState.Value : TopState(); 1776if (oldTryState.HasValue) 1805if (oldTryState.HasValue) 1850if (oldTryState.HasValue) 2384if (oldState.HasValue)
FlowAnalysis\AbstractFlowPass_LocalFunctions.cs (1)
164if (NonMonotonicState.HasValue)
FlowAnalysis\DefiniteAssignment.cs (1)
1671if (NonMonotonicState.HasValue)
FlowAnalysis\DefiniteAssignment.LocalFunctions.cs (1)
203if (NonMonotonicState.HasValue)
FlowAnalysis\NullableWalker.cs (4)
1734if (initialState.HasValue) 2624if (newState != NullableFlowState.NotNull && NonMonotonicState.HasValue) 7147Debug.Assert(lambdaState.HasValue); 8980initialState.HasValue ? initialState.Value : State.Clone(),
Microsoft.CodeAnalysis.CSharp.CodeStyle (8)
CastSimplifier.cs (2)
138return constantValue.HasValue && 829=> operation.ConstantValue.HasValue && operation.ConstantValue.Value is null;
CSharpAsAndMemberAccessDiagnosticAnalyzer.cs (3)
97if (!constantValue.HasValue) 140if (!constantValue.HasValue) 154if (!constantValue.HasValue)
CSharpUsePatternCombinatorsAnalyzer.cs (1)
164: operation.ConstantValue.HasValue;
CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
271=> operation.ConstantValue.HasValue &&
UseSimpleUsingStatementDiagnosticAnalyzer.cs (1)
249return constantValue.HasValue;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (4)
ConvertToRecordHelpers.cs (2)
704ConstantValue.HasValue: true, 888ConstantValue.HasValue: true,
CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
105else if (semanticModel.GetConstantValue(defaultLiteral, cancellationToken) is var constant && constant.HasValue)
CSharpUseRangeOperatorCodeFixProvider.cs (1)
172if (startOperation.ConstantValue.HasValue &&
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
CodeGeneration\SyntaxGeneratorTests.cs (1)
96Assert.True(constantValue.HasValue);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (1)
CodeGen\CodeGenTupleEqualityTests.cs (1)
713Assert.False(model.GetConstantValue(tuple2).HasValue);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Semantics\PatternMatchingTests.cs (1)
6575Assert.False(model.GetConstantValue(caseDefault.Pattern).HasValue);
Microsoft.CodeAnalysis.CSharp.Features (14)
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (2)
355var (left, right) when model.GetConstantValue(left).HasValue => (right, left, Flipped: true), 356var (left, right) when model.GetConstantValue(right).HasValue => (left, right, Flipped: false),
ConvertToRecordHelpers.cs (2)
704ConstantValue.HasValue: true, 888ConstantValue.HasValue: true,
CSharpAsAndMemberAccessDiagnosticAnalyzer.cs (3)
97if (!constantValue.HasValue) 140if (!constantValue.HasValue) 154if (!constantValue.HasValue)
CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
105else if (semanticModel.GetConstantValue(defaultLiteral, cancellationToken) is var constant && constant.HasValue)
CSharpUsePatternCombinatorsAnalyzer.cs (1)
164: operation.ConstantValue.HasValue;
CSharpUseRangeOperatorCodeFixProvider.cs (1)
172if (startOperation.ConstantValue.HasValue &&
CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
271=> operation.ConstantValue.HasValue &&
QuickInfo\CSharpDiagnosticAnalyzerQuickInfoProvider.cs (1)
128if (checkIdObject.HasValue && checkIdObject.Value is string checkId)
ReverseForStatement\CSharpReverseForStatementCodeRefactoringProvider.cs (1)
107=> valueOpt.HasValue && IsIntegral(valueOpt.Value) && ToUInt64(valueOpt.Value) == value;
UseSimpleUsingStatementDiagnosticAnalyzer.cs (1)
249return constantValue.HasValue;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (37)
Semantics\ConstantTests.cs (1)
2926Assert.True(constantValue.HasValue);
Semantics\ImplicitObjectCreationTests.cs (7)
1872Assert.False(model.GetConstantValue(def).HasValue); 1902Assert.False(model.GetConstantValue(def).HasValue); 1932Assert.False(model.GetConstantValue(def).HasValue); 2043Assert.False(model.GetConstantValue(@new).HasValue); 2078Assert.False(model.GetConstantValue(@new).HasValue); 2224Assert.False(model.GetConstantValue(def).HasValue); 2572Assert.False(model.GetConstantValue(def).HasValue);
Semantics\InterpolationTests.cs (1)
4590Assert.False(semanticInfo.ConstantValue.HasValue);
Semantics\LambdaTests.cs (1)
8028Assert.True(constantValue.HasValue);
Semantics\RawInterpolationTests_Handler.cs (1)
2917Assert.False(semanticInfo.ConstantValue.HasValue);
Semantics\TargetTypedDefaultTests.cs (16)
249Assert.True(model.GetConstantValue(def).HasValue); 286Assert.True(model.GetConstantValue(def).HasValue); 525Assert.False(model.GetConstantValue(def).HasValue); 571Assert.False(model.GetConstantValue(def).HasValue); 614Assert.False(model.GetConstantValue(def).HasValue); 672Assert.False(model.GetConstantValue(def).HasValue); 753Assert.False(model.GetConstantValue(def).HasValue); 841Assert.False(model.GetConstantValue(def).HasValue); 870Assert.False(model.GetConstantValue(def).HasValue); 3059Assert.False(model.GetConstantValue(def).HasValue); 3579Assert.False(model.GetConstantValue(default1).HasValue); 3587Assert.False(model.GetConstantValue(default2).HasValue); 3594Assert.False(model.GetConstantValue(default3).HasValue); 3601Assert.True(model.GetConstantValue(default4).HasValue); 3677Assert.False(model.GetConstantValue(value).HasValue); 3718Assert.False(model.GetConstantValue(defaultValue).HasValue);
Semantics\UnsafeTests.cs (10)
6050Assert.False(summary.ConstantValue.HasValue); 6085Assert.False(summary.ConstantValue.HasValue); 6512Assert.False(summary.ConstantValue.HasValue); 7797Assert.False(typeSummary.ConstantValue.HasValue); 7859Assert.False(typeSummary.ConstantValue.HasValue); 7919Assert.False(typeSummary.ConstantValue.HasValue); 7932Assert.False(sizeOfSummary.ConstantValue.HasValue); 8468Assert.False(stackAllocSummary.ConstantValue.HasValue); 8480Assert.False(typeSummary.ConstantValue.HasValue); 8494Assert.True(countSummary.ConstantValue.HasValue);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (27)
Compilation\GetSemanticInfoTests.cs (3)
2737Assert.False(model.GetConstantValue(expr).HasValue); 2808Assert.False(model.GetConstantValue(expr).HasValue); 4298Assert.False(info.ConstantValue.HasValue);
Compilation\SemanticModelAPITests.cs (18)
1438Assert.True(constantInfo.HasValue, "must be a constant"); 1476Assert.True(constantInfo.HasValue, "must be a constant"); 1524Assert.True(constantInfo.HasValue, "must be a constant"); 1612Assert.True(constantInfo.HasValue, "must be a constant"); 1697Assert.True(constantInfo.HasValue, "must be a constant"); 2786Assert.True(constantVal.HasValue); 3914Assert.True(value0.HasValue); 3924Assert.False(value1.HasValue); 3931Assert.False(value2.HasValue); 4108Assert.True(model.GetConstantValue(actual[0]).HasValue); 4110Assert.False(model.GetConstantValue(actual[1]).HasValue); 4151Assert.False(model.GetConstantValue(actual[2]).HasValue); 4188Assert.True(model.GetConstantValue(actual[0]).HasValue); 4191Assert.False(model.GetConstantValue(actual[1]).HasValue); 4213Assert.True(model.GetConstantValue(actual[0]).HasValue); 4217Assert.True(model.GetConstantValue(actual[1]).HasValue); 4241Assert.True(model.GetConstantValue(actual[0]).HasValue); 4286Assert.False(model.GetConstantValue(actual[2]).HasValue);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (5)
4276Assert.True(constantInfo.HasValue, "must be constant"); 4291Assert.True(constantInfo.HasValue, "must be constant"); 4337Assert.True(constantInfo.HasValue, "must be constant"); 4360Assert.True(constantInfo.HasValue, "must be constant"); 4382Assert.True(constantInfo.HasValue, "must be constant");
Symbols\EnumTests.cs (1)
355Assert.False(value.HasValue);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CompilationTestUtils.cs (1)
217public bool IsCompileTimeConstant { get { return ConstantValue.HasValue; } }
Microsoft.CodeAnalysis.CSharp.Workspaces (4)
CastSimplifier.cs (2)
138return constantValue.HasValue && 829=> operation.ConstantValue.HasValue && operation.ConstantValue.Value is null;
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (2)
272if (!nameofValueOpt.HasValue) 392semanticModel.GetConstantValue(invocationExpr).HasValue &&
Microsoft.CodeAnalysis.EditorFeatures (1)
SolutionEvents\HostLegacySolutionEventsWorkspaceEventListener.cs (1)
90if (!shouldReport.HasValue || !shouldReport.Value)
Microsoft.CodeAnalysis.Features (86)
AbstractPopulateSwitchDiagnosticAnalyzer.cs (1)
119=> constantValue.HasValue && Equals(constantValue.Value, value);
AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (1)
93if (operand.ConstantValue.HasValue && operand.Kind == OperationKind.Literal &&
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
233if (!initializer.Value.ConstantValue.HasValue)
AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (2)
159value.ConstantValue.HasValue) 621if (assignmentValue.ConstantValue.HasValue)
AbstractSimplifyConditionalDiagnosticAnalyzer.cs (1)
164return constantValue.HasValue && constantValue.Value is bool b && b == value;
AbstractSimplifyInterpolationHelpers.cs (3)
90if (invocation.Arguments[0].Value is ILiteralOperation { ConstantValue: { HasValue: true, Value: string value } } literal && 211? alignmentOp is { ConstantValue.HasValue: true } 248=> argument.Value.ConstantValue is { HasValue: true, Value: ' ' };
AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
266return operation.ConstantValue.HasValue &&
AddImport\AbstractAddImportFeatureService.cs (2)
72return result.HasValue ? result.Value : ImmutableArray<AddImportFixData>.Empty; 523return result.HasValue ? result.Value : ImmutableArray<AddImportFixData>.Empty;
Completion\CompletionItem.cs (12)
283var newSpan = span.HasValue ? span.Value : Span; 284var newDisplayText = displayText.HasValue ? displayText.Value : DisplayText; 285var newFilterText = filterText.HasValue ? filterText.Value : FilterText; 286var newSortText = sortText.HasValue ? sortText.Value : SortText; 287var newInlineDescription = inlineDescription.HasValue ? inlineDescription.Value : InlineDescription; 288var newProperties = properties.HasValue ? properties.Value : Properties; 289var newTags = tags.HasValue ? tags.Value : Tags; 290var newRules = rules.HasValue ? rules.Value : Rules; 291var newDisplayTextPrefix = displayTextPrefix.HasValue ? displayTextPrefix.Value : DisplayTextPrefix; 292var newDisplayTextSuffix = displayTextSuffix.HasValue ? displayTextSuffix.Value : DisplayTextSuffix; 293var newIsComplexTextEdit = isComplexTextEdit.HasValue ? isComplexTextEdit.Value : IsComplexTextEdit; 294var newAdditionalFilterTexts = additionalFilterTexts.HasValue ? additionalFilterTexts.Value.NullToEmpty() : AdditionalFilterTexts;
Completion\CompletionItemRules.cs (6)
180var newFilterRules = filterRules.HasValue ? filterRules.Value : FilterCharacterRules; 181var newCommitRules = commitRules.HasValue ? commitRules.Value : CommitCharacterRules; 182var newEnterKeyRule = enterKeyRule.HasValue ? enterKeyRule.Value : EnterKeyRule; 183var newFormatOnCommit = formatOnCommit.HasValue ? formatOnCommit.Value : FormatOnCommit; 184var newMatchPriority = matchPriority.HasValue ? matchPriority.Value : MatchPriority; 185var newSelectionBehavior = selectionBehavior.HasValue ? selectionBehavior.Value : SelectionBehavior;
Completion\CompletionList.cs (4)
125var newSpan = span.HasValue ? span.Value : Span; 126var newItemsList = itemsList.HasValue ? itemsList.Value : ItemsList; 127var newRules = rules.HasValue ? rules.Value : Rules; 128var newSuggestionModeItem = suggestionModeItem.HasValue ? suggestionModeItem.Value : SuggestionModeItem;
Completion\CompletionRules.cs (5)
103var newDismissIfEmpty = dismissIfEmpty.HasValue ? dismissIfEmpty.Value : DismissIfEmpty; 104var newDismissIfLastCharacterDeleted = dismissIfLastCharacterDeleted.HasValue ? dismissIfLastCharacterDeleted.Value : DismissIfLastCharacterDeleted; 105var newDefaultCommitCharacters = defaultCommitCharacters.HasValue ? defaultCommitCharacters.Value : DefaultCommitCharacters; 106var newDefaultEnterKeyRule = defaultEnterKeyRule.HasValue ? defaultEnterKeyRule.Value : DefaultEnterKeyRule; 107var newSnippetsRule = snippetsRule.HasValue ? snippetsRule.Value : SnippetsRule;
Completion\Providers\AbstractInternalsVisibleToCompletionProvider.cs (1)
237if (constantCandidate.HasValue && constantCandidate.Value is string argument)
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.cs (1)
77result = remoteResult.HasValue ? remoteResult.Value : null;
ConvertForToForEach\AbstractConvertForToForEachCodeRefactoringProvider.cs (2)
93if (initializerValue is not { HasValue: true, Value: 0 }) 100if (stepValue is not { HasValue: true, Value: 1 })
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (1)
439: operation.ConstantValue.HasValue;
ConvertNumericLiteral\AbstractConvertNumericLiteralCodeRefactoringProvider.cs (1)
46if (!valueOpt.HasValue)
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (1)
224if (!result.HasValue)
DocumentHighlighting\AbstractDocumentHighlightsService.cs (1)
51if (!result.HasValue)
EditAndContinue\CommittedSolution.cs (2)
256else if (!maybeMatchingSourceText.HasValue) 391await TryGetMatchingSourceTextAsync(sourceText, sourceFilePath, currentDocument: null, sourceTextProvider, requiredChecksum, checksumAlgorithm, cancellationToken).ConfigureAwait(false) is { HasValue: true, Value: not null })
EditAndContinue\Remote\RemoteDebuggingSessionProxy.cs (8)
56documentsToReanalyze = documentsToReanalyzeOpt.HasValue ? documentsToReanalyzeOpt.Value : ImmutableArray<DocumentId>.Empty; 81documentsToReanalyze = documentsToReanalyzeOpt.HasValue ? documentsToReanalyzeOpt.Value : ImmutableArray<DocumentId>.Empty; 131if (result.HasValue) 189documentsToReanalyze = documentsToReanalyzeOpt.HasValue ? documentsToReanalyzeOpt.Value : ImmutableArray<DocumentId>.Empty; 224return result.HasValue ? result.Value : null; 240return result.HasValue ? result.Value : null; 256return result.HasValue ? result.Value : ImmutableArray<ImmutableArray<ActiveStatementSpan>>.Empty; 279return result.HasValue ? result.Value : ImmutableArray<ActiveStatementSpan>.Empty;
EditAndContinue\Remote\RemoteEditAndContinueServiceProxy.cs (2)
163if (sessionIdOpt.HasValue) 200if (!diagnosticData.HasValue)
EncapsulateField\AbstractEncapsulateFieldService.cs (1)
124if (!result.HasValue)
ExternalAccess\UnitTesting\API\UnitTestingSearchHelpers.cs (2)
40if (!location.HasValue || location.Value is null) 63if (!locations.HasValue)
FullyQualify\AbstractFullyQualifyService.cs (1)
51if (!result.HasValue)
InheritanceMargin\AbstractInheritanceMarginService.cs (1)
63if (!result.HasValue)
IntroduceVariable\AbstractIntroduceVariableService.State.cs (1)
217if (document.SemanticModel.GetConstantValue(expression, cancellationToken) is { HasValue: true, Value: var value })
J\s\src\Analyzers\Core\Analyzers\UseConditionalExpression\UseConditionalExpressionHelpers.cs\UseConditionalExpressionHelpers.cs (1)
105=> trueValue is ILiteralOperation { ConstantValue: { HasValue: true, Value: bool value } } && value == val;
NavigationBar\AbstractNavigationBarItemService.cs (1)
34return result.HasValue
PopulateSwitchExpressionHelpers.cs (2)
45if (arm.Pattern is IConstantPatternOperation { Value.ConstantValue: { HasValue: true, Value: null } }) 79if (operation is IConstantPatternOperation { Value.ConstantValue: { HasValue: true, Value: not null and var value } })
PopulateSwitchStatementHelpers.cs (2)
78if (value.ConstantValue is { HasValue: true, Value: null }) 108if (value is null || !value.ConstantValue.HasValue)
StackTraceExplorer\StackTraceExplorerService.cs (1)
60if (!result.HasValue)
Structure\BlockSpan.cs (7)
90var newIsCollapsible = isCollapsible.HasValue ? isCollapsible.Value : IsCollapsible; 91var newTextSpan = textSpan.HasValue ? textSpan.Value : TextSpan; 92var newHintSpan = hintSpan.HasValue ? hintSpan.Value : HintSpan; 93var newType = type.HasValue ? type.Value : Type; 94var newBannerText = bannerText.HasValue ? bannerText.Value : BannerText; 95var newAutoCollapse = autoCollapse.HasValue ? autoCollapse.Value : AutoCollapse; 96var newIsDefaultCollapsed = isDefaultCollapsed.HasValue ? isDefaultCollapsed.Value : IsDefaultCollapsed;
SuppressMessageAttributeState.cs (1)
145value.ConstantValue.HasValue &&
SymbolSearch\Windows\SymbolSearchUpdateEngineProxy.cs (3)
28return result.HasValue ? result.Value : ImmutableArray<PackageWithTypeResult>.Empty; 38return result.HasValue ? result.Value : ImmutableArray<PackageWithAssemblyResult>.Empty; 48return result.HasValue ? result.Value : ImmutableArray<ReferenceAssemblyWithTypeResult>.Empty;
TaskList\AbstractTaskListService.cs (1)
41if (!result.HasValue)
ValueTracking\ValueTrackingService.cs (2)
44if (!result.HasValue) 74if (!result.HasValue)
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.InProcOrRemoteHostAnalyzerRunner.cs (1)
195if (!result.HasValue)
Microsoft.CodeAnalysis.Remote.Workspaces (1)
ServiceHubRemoteHostClient.cs (1)
88if (remoteProcessId.HasValue)
Microsoft.CodeAnalysis.Test.Utilities (26)
Compilation\OperationTreeVerifier.cs (2)
110if (operation.ConstantValue.HasValue) 220if (constant.HasValue)
Compilation\TestOperationVisitor.cs (6)
1344Assert.False(pattern.ConstantValue.HasValue); 1532Assert.False(operation.ConstantValue.HasValue); 1542Assert.False(operation.ConstantValue.HasValue); 1705if (!operation.Value.ConstantValue.HasValue || operation.Value.ConstantValue.Value != null) 1783Assert.False(operation.ConstantValue.HasValue); 1809Assert.False(operation.ConstantValue.HasValue);
CustomDataFlowAnalysis.cs (1)
149if (current.BranchValue.ConstantValue.HasValue && current.BranchValue.ConstantValue.Value is bool constant)
Diagnostics\EmptyArrayAnalyzer.cs (1)
79if (arrayLength.HasValue &&
Diagnostics\LocalCouldBeConstAnalyzer.cs (1)
92if (initializer != null && initializer.Value.ConstantValue.HasValue)
Diagnostics\OperationTestAnalyzer.cs (15)
158if (conditionRight.ConstantValue.HasValue && 175setupAssignment.Value.ConstantValue.HasValue && 193if (advanceIncrementOpt.HasValue && advanceOperationCode.HasValue) 249advanceOperation.RightOperand.ConstantValue.HasValue && 264advanceAssignment.Value.ConstantValue.HasValue && 356singleValueExpression.ConstantValue.HasValue && 376rangeMinExpression.ConstantValue.HasValue && 379rangeMaxExpression.ConstantValue.HasValue && 399relationalValueExpression.ConstantValue.HasValue && 587if (argumentValue.HasValue && argument.Type.SpecialType == SpecialType.System_Int32) 632literal.ConstantValue.HasValue && 668if (argument.Value.ConstantValue.HasValue && argument.Value.ConstantValue.Value == null) 1109if (dimensionSize.HasValue && IntegralValue(dimensionSize.Value) > 3) 1136if (dimensionSize.HasValue && IntegralValue(dimensionSize.Value) > 3) 1623if (rightValue.HasValue && rightValue.Value is int && (int)rightValue.Value == 10)
Microsoft.CodeAnalysis.VisualBasic (4)
Analysis\FlowAnalysis\DataFlowPass.vb (4)
677If Me._tryState.HasValue Then 1451If oldTryState.HasValue Then 1472If oldTryState.HasValue Then 1506If oldTryState.HasValue Then
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (1)
SpeculationAnalyzer.vb (1)
562Me.SpeculativeSemanticModel.GetConstantValue(newExpression).HasValue Then
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (1)
Attributes\AttributeTests.vb (1)
2105Assert.True(constantValue.HasValue)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (394)
Binding\ImplicitVariableTests.vb (2)
1244Assert.False(semanticInfo.ConstantValue.HasValue) 1264Assert.False(semanticInfo.ConstantValue.HasValue)
Compilation\MyTemplateTests.vb (2)
248Assert.False(semanticSummary.ConstantValue.HasValue) 306Assert.False(semanticSummary.ConstantValue.HasValue)
Compilation\SemanticModelAPITests.vb (8)
623Assert.True(initializerConstantVal.HasValue, "must be a constant") 676Assert.True(constantInfo.HasValue, "must be a constant") 729Assert.True(constantInfo.HasValue, "must be a constant") 1250Assert.True(constantInfo.HasValue, "must be constant") 1267Assert.True(constantInfo.HasValue, "must be constant") 1315Assert.True(constantInfo.HasValue, "must be constant") 1351Assert.True(constantInfo.HasValue, "must be constant") 4587Assert.False(model.GetConstantValue(interp).HasValue)
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (14)
2173Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 2178Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 2183Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 2188Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 2193Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 2198Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 2203Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 2208Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 2213Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 2218Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 2223Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 2228Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 2233Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 2238Assert.Equal(True, semanticInfo.ConstantValue.HasValue)
ExtensionMethods\SemanticModelTests.vb (5)
78Assert.False(semanticInfo.ConstantValue.HasValue) 136Assert.False(semanticInfo.ConstantValue.HasValue) 193Assert.False(semanticInfo.ConstantValue.HasValue) 1350Assert.False(semanticInfo.ConstantValue.HasValue) 1399Assert.False(semanticInfo.ConstantValue.HasValue)
Semantics\ArrayLiteralTests.vb (6)
1510Assert.False(semanticSummary.ConstantValue.HasValue) 1644Assert.False(semanticSummary.ConstantValue.HasValue) 1699Assert.False(semanticSummary.ConstantValue.HasValue) 1734Assert.False(semanticSummary.ConstantValue.HasValue) 2063Assert.False(semanticSummary.ConstantValue.HasValue) 2096Assert.False(semanticSummary.ConstantValue.HasValue)
Semantics\GetExtendedSemanticInfoTests.vb (202)
126Assert.False(semanticInfo.ConstantValue.HasValue) 161Assert.False(semanticInfo.ConstantValue.HasValue) 198Assert.False(semanticInfo.ConstantValue.HasValue) 241Assert.False(semanticInfo.ConstantValue.HasValue) 284Assert.False(semanticInfo.ConstantValue.HasValue) 327Assert.False(semanticInfo.ConstantValue.HasValue) 377Assert.False(semanticInfo.ConstantValue.HasValue) 426Assert.False(semanticInfo.ConstantValue.HasValue) 475Assert.False(semanticInfo.ConstantValue.HasValue) 515Assert.False(semanticInfo.ConstantValue.HasValue) 559Assert.False(semanticInfo.ConstantValue.HasValue) 607Assert.False(semanticInfo.ConstantValue.HasValue) 662Assert.False(semanticInfo.ConstantValue.HasValue) 713Assert.False(semanticSummary.ConstantValue.HasValue) 758Assert.False(semanticSummary.ConstantValue.HasValue) 816Assert.False(semanticSummary.ConstantValue.HasValue) 875Assert.False(semanticSummary.ConstantValue.HasValue) 924Assert.False(semanticSummary.ConstantValue.HasValue) 969Assert.False(semanticSummary.ConstantValue.HasValue) 1018Assert.False(semanticSummary.ConstantValue.HasValue) 1069Assert.False(semanticSummary.ConstantValue.HasValue) 1120Assert.False(semanticSummary.ConstantValue.HasValue) 1162Assert.False(semanticInfo.ConstantValue.HasValue) 1208Assert.False(semanticInfo.ConstantValue.HasValue) 1257Assert.False(semanticInfo.ConstantValue.HasValue) 1302Assert.False(semanticInfo.ConstantValue.HasValue) 1347Assert.False(semanticInfo.ConstantValue.HasValue) 1385Assert.True(semanticInfo.ConstantValue.HasValue) 1427Assert.False(semanticInfo.ConstantValue.HasValue) 1465Assert.False(semanticInfo.ConstantValue.HasValue) 1530Assert.False(semanticInfo.ConstantValue.HasValue) 1545Assert.False(semanticInfo.ConstantValue.HasValue) 1560Assert.False(semanticInfo.ConstantValue.HasValue) 1575Assert.False(semanticInfo.ConstantValue.HasValue) 1592Assert.False(semanticInfo.ConstantValue.HasValue) 1635Assert.False(semanticSummary.ConstantValue.HasValue) 1681Assert.False(semanticSummary.ConstantValue.HasValue) 1722Assert.False(semanticSummary.ConstantValue.HasValue) 1763Assert.False(semanticSummary.ConstantValue.HasValue) 1811Assert.False(semanticSummary.ConstantValue.HasValue) 1862Assert.False(semanticSummary.ConstantValue.HasValue) 1896Assert.False(semanticInfo.ConstantValue.HasValue) 1940Assert.False(semanticInfo.ConstantValue.HasValue) 1970Assert.False(semanticInfo.ConstantValue.HasValue) 2002Assert.False(semanticInfo.ConstantValue.HasValue) 2056Assert.True(semanticInfo.ConstantValue.HasValue) 2089Assert.False(semanticInfo.ConstantValue.HasValue) 2124Assert.False(semanticInfo.ConstantValue.HasValue) 2156Assert.False(semanticInfo.ConstantValue.HasValue) 2187Assert.False(semanticInfo.ConstantValue.HasValue) 2219Assert.False(semanticInfo.ConstantValue.HasValue) 2260Assert.False(semanticInfo.ConstantValue.HasValue) 2298Assert.False(semanticInfo.ConstantValue.HasValue) 2338Assert.False(semanticInfo.ConstantValue.HasValue) 2376Assert.False(semanticInfo.ConstantValue.HasValue) 2414Assert.False(semanticInfo.ConstantValue.HasValue) 2452Assert.False(semanticInfo.ConstantValue.HasValue) 2483Assert.False(semanticInfo.ConstantValue.HasValue) 2527Assert.True(semanticInfo.ConstantValue.HasValue) 2607Assert.False(semanticInfo.ConstantValue.HasValue) 2688Assert.False(semanticInfo.ConstantValue.HasValue) 2719Assert.True(semanticInfo.ConstantValue.HasValue) 2754Assert.False(semanticInfo.ConstantValue.HasValue) 2795Assert.False(semanticInfo.ConstantValue.HasValue) 2844Assert.False(semanticInfo.ConstantValue.HasValue) 2893Assert.False(semanticInfo.ConstantValue.HasValue) 2911Assert.True(semanticInfo.ConstantValue.HasValue) 2931Assert.True(semanticInfo.ConstantValue.HasValue) 2949Assert.True(semanticInfo.ConstantValue.HasValue) 2969Assert.True(semanticInfo.ConstantValue.HasValue) 2989Assert.True(semanticInfo.ConstantValue.HasValue) 3030Assert.True(semanticInfo.ConstantValue.HasValue) 3154Assert.False(semanticInfo.ConstantValue.HasValue) 3190Assert.False(semanticInfo.ConstantValue.HasValue) 3224Assert.False(semanticInfo.ConstantValue.HasValue) 3435Assert.True(semanticInfo.ConstantValue.HasValue) 3483Assert.False(semanticInfo.ConstantValue.HasValue) 3564Assert.False(semanticInfo.ConstantValue.HasValue) 3623Assert.False(semanticInfo.ConstantValue.HasValue) 3674Assert.True(semanticInfo.ConstantValue.HasValue) 3727Assert.False(semanticInfo.ConstantValue.HasValue) 3777Assert.False(semanticInfo.ConstantValue.HasValue) 3817Assert.False(semanticSummary.ConstantValue.HasValue) 3855Assert.False(semanticSummary.ConstantValue.HasValue) 4030Assert.False(semanticInfo.ConstantValue.HasValue) 4068Assert.False(semanticInfo.ConstantValue.HasValue) 4106Assert.False(semanticInfo.ConstantValue.HasValue) 4138Assert.False(semanticInfo.ConstantValue.HasValue) 4171Assert.False(semanticInfo.ConstantValue.HasValue) 4206Assert.False(semanticInfo.ConstantValue.HasValue) 4245Assert.False(semanticInfo.ConstantValue.HasValue) 4283Assert.False(semanticInfo.ConstantValue.HasValue) 4322Assert.False(semanticInfo.ConstantValue.HasValue) 4356Assert.False(semanticInfo.ConstantValue.HasValue) 4395Assert.False(semanticInfo.ConstantValue.HasValue) 4431Assert.False(semanticInfo.ConstantValue.HasValue) 4470Assert.False(semanticInfo.ConstantValue.HasValue) 4509Assert.False(semanticInfo.ConstantValue.HasValue) 4548Assert.False(semanticInfo.ConstantValue.HasValue) 4591Assert.False(semanticInfo.ConstantValue.HasValue) 4628Assert.False(semanticInfo.ConstantValue.HasValue) 4663Assert.False(semanticInfo.ConstantValue.HasValue) 4725Assert.False(semanticInfo.ConstantValue.HasValue) 4763Assert.False(semanticInfo.ConstantValue.HasValue) 4806Assert.False(semanticInfo.ConstantValue.HasValue) 4849Assert.False(semanticInfo.ConstantValue.HasValue) 4879Assert.False(semanticInfo.ConstantValue.HasValue) 4910Assert.False(semanticInfo.ConstantValue.HasValue) 4942Assert.False(semanticInfo.ConstantValue.HasValue) 4974Assert.False(semanticInfo.ConstantValue.HasValue) 5001Assert.False(semanticInfo.ConstantValue.HasValue) 5035Assert.False(semanticInfo.ConstantValue.HasValue) 5069Assert.False(semanticInfo.ConstantValue.HasValue) 5107Assert.False(semanticInfo.ConstantValue.HasValue) 5138Assert.False(semanticInfo.ConstantValue.HasValue) 5170Assert.False(semanticInfo.ConstantValue.HasValue) 5202Assert.False(semanticInfo.ConstantValue.HasValue) 5248Assert.False(semanticInfo.ConstantValue.HasValue) 5294Assert.False(semanticInfo.ConstantValue.HasValue) 5321Assert.False(semanticInfo.ConstantValue.HasValue) 5351Assert.True(semanticInfo.ConstantValue.HasValue) 5382Assert.True(semanticInfo.ConstantValue.HasValue) 5418Assert.False(semanticInfo.ConstantValue.HasValue) 5449Assert.False(semanticInfo.ConstantValue.HasValue) 5482Assert.False(semanticInfo.ConstantValue.HasValue) 5514Assert.False(semanticInfo.ConstantValue.HasValue) 5544Assert.True(semanticInfo.ConstantValue.HasValue) 5572Assert.False(semanticInfo.ConstantValue.HasValue) 5601Assert.False(semanticInfo.ConstantValue.HasValue) 5623Assert.True(semanticInfo.ConstantValue.HasValue) 5661Assert.False(semanticInfo.ConstantValue.HasValue) 5681Assert.True(semanticInfo.ConstantValue.HasValue) 5723Assert.True(semanticInfo.ConstantValue.HasValue) 5819Assert.False(semanticInfo.ConstantValue.HasValue) 5874Assert.False(semanticInfo.ConstantValue.HasValue) 5921Assert.False(semanticInfo.ConstantValue.HasValue) 5981Assert.False(semanticInfo.ConstantValue.HasValue) 6023Assert.False(semanticSummary.ConstantValue.HasValue) 6070Assert.False(semanticSummary.ConstantValue.HasValue) 6115Assert.False(semanticSummary.ConstantValue.HasValue) 6157Assert.False(semanticSummary.ConstantValue.HasValue) 6193Assert.False(semanticInfo.ConstantValue.HasValue) 6905Assert.False(semanticInfo.ConstantValue.HasValue) 6943Assert.False(semanticInfo.ConstantValue.HasValue) 6980Assert.False(semanticInfo.ConstantValue.HasValue) 7018Assert.False(semanticInfo.ConstantValue.HasValue) 7055Assert.False(semanticInfo.ConstantValue.HasValue) 7093Assert.False(semanticInfo.ConstantValue.HasValue) 7130Assert.False(semanticInfo.ConstantValue.HasValue) 7168Assert.False(semanticInfo.ConstantValue.HasValue) 7208Assert.False(semanticInfo.ConstantValue.HasValue) 7251Assert.False(semanticInfo.ConstantValue.HasValue) 7291Assert.False(semanticInfo.ConstantValue.HasValue) 7338Assert.False(semanticInfo.ConstantValue.HasValue) 7415Assert.False(semanticSummary.ConstantValue.HasValue) 7456Assert.False(semanticSummary.ConstantValue.HasValue) 7488Assert.False(semanticInfo.ConstantValue.HasValue) 7537Assert.False(semanticInfo.ConstantValue.HasValue) 7836Assert.False(semanticSummary.ConstantValue.HasValue) 7872Assert.False(semanticSummary.ConstantValue.HasValue) 7907Assert.False(semanticSummary.ConstantValue.HasValue) 7945Assert.False(semanticSummary.ConstantValue.HasValue) 7984Assert.False(semanticSummary.ConstantValue.HasValue) 8023Assert.False(semanticSummary.ConstantValue.HasValue) 8062Assert.False(semanticSummary.ConstantValue.HasValue) 8101Assert.False(semanticSummary.ConstantValue.HasValue) 8139Assert.False(semanticSummary.ConstantValue.HasValue) 8177Assert.False(semanticSummary.ConstantValue.HasValue) 8296Assert.False(semanticSummary.ConstantValue.HasValue) 8341Assert.False(semanticSummary.ConstantValue.HasValue) 8386Assert.False(semanticSummary.ConstantValue.HasValue) 8431Assert.False(semanticSummary.ConstantValue.HasValue) 8469Assert.False(semanticSummary.ConstantValue.HasValue) 8529Assert.False(semanticSummary.ConstantValue.HasValue) 8569Assert.False(semanticSummary.ConstantValue.HasValue) 8714Assert.False(semanticSummary.ConstantValue.HasValue) 8753Assert.False(semanticSummary.ConstantValue.HasValue) 8791Assert.False(semanticSummary.ConstantValue.HasValue) 8830Assert.False(semanticSummary.ConstantValue.HasValue) 8945Assert.False(semanticSummary.ConstantValue.HasValue) 8982Assert.False(semanticSummary.ConstantValue.HasValue) 9018Assert.False(semanticSummary.ConstantValue.HasValue) 9055Assert.False(semanticSummary.ConstantValue.HasValue) 9093Assert.False(semanticSummary.ConstantValue.HasValue) 9135Assert.False(semanticSummary.ConstantValue.HasValue) 9487Assert.False(semanticSummary.ConstantValue.HasValue) 9522Assert.False(semanticSummary.ConstantValue.HasValue) 9560Assert.False(semanticSummary.ConstantValue.HasValue) 9602Assert.False(semanticSummary.ConstantValue.HasValue) 9635Assert.False(semanticInfo.ConstantValue.HasValue) 9670Assert.[False](semanticInfo.ConstantValue.HasValue) 9705Assert.[False](semanticInfo.ConstantValue.HasValue) 9740Assert.[False](semanticInfo.ConstantValue.HasValue) 9775Assert.[False](semanticInfo.ConstantValue.HasValue) 9819Assert.[False](semanticInfo.ConstantValue.HasValue) 9859Assert.[False](semanticInfo.ConstantValue.HasValue) 9904Assert.[False](semanticInfo.ConstantValue.HasValue) 9947Assert.[False](semanticInfo.ConstantValue.HasValue) 9979Assert.[False](semanticInfo.ConstantValue.HasValue) 10013Assert.[False](semanticInfo.ConstantValue.HasValue) 10059Assert.False(semanticSummary.ConstantValue.HasValue) 10101Assert.False(semanticSummary.ConstantValue.HasValue)
Semantics\GetSemanticInfoTests.vb (67)
139Assert.False(semanticInfo.ConstantValue.HasValue) 184Assert.False(semanticInfo.ConstantValue.HasValue) 230Assert.False(semanticInfo.ConstantValue.HasValue) 277Assert.False(semanticInfo.ConstantValue.HasValue) 323Assert.False(semanticInfo.ConstantValue.HasValue) 373Assert.False(semanticInfo.ConstantValue.HasValue) 423Assert.False(semanticInfo.ConstantValue.HasValue) 473Assert.False(semanticInfo.ConstantValue.HasValue) 523Assert.False(semanticInfo.ConstantValue.HasValue) 573Assert.False(semanticInfo.ConstantValue.HasValue) 729Assert.False(semanticSummary.ConstantValue.HasValue) 774Assert.False(semanticInfo.ConstantValue.HasValue) 1088Assert.False(semanticSummary.ConstantValue.HasValue) 1412Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 1417Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 1422Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 1427Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 1432Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 1437Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 1442Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 1447Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 1467Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 1472Assert.Equal(True, semanticInfo.ConstantValue.HasValue) 1514Assert.False(semanticSummary.ConstantValue.HasValue) 1549Assert.False(semanticSummary.ConstantValue.HasValue) 1857Assert.False(semanticSummary.ConstantValue.HasValue) 1891Assert.False(semanticSummary.ConstantValue.HasValue) 1925Assert.False(semanticSummary.ConstantValue.HasValue) 1963Assert.False(semanticSummary.ConstantValue.HasValue) 2011Assert.False(semanticSummary.ConstantValue.HasValue) 2058Assert.False(semanticSummary.ConstantValue.HasValue) 2071Assert.True(semanticSummary.ConstantValue.HasValue) 2085Assert.False(semanticSummary.ConstantValue.HasValue) 2102Assert.False(semanticSummary.ConstantValue.HasValue) 2154Assert.False(semanticSummary.ConstantValue.HasValue) 2174Assert.False(semanticSummary.ConstantValue.HasValue) 2207Assert.False(semanticSummary.ConstantValue.HasValue) 2217Assert.False(semanticSummary.ConstantValue.HasValue) 2253Assert.False(semanticSummary.ConstantValue.HasValue) 2304Assert.False(semanticSummary.ConstantValue.HasValue) 2318Assert.True(semanticSummary.ConstantValue.HasValue) 2363Assert.False(semanticSummary.ConstantValue.HasValue) 2377Assert.True(semanticSummary.ConstantValue.HasValue) 2427Assert.False(semanticSummary.ConstantValue.HasValue) 2539Assert.False(semanticSummary.ConstantValue.HasValue) 2581Assert.False(semanticSummary.ConstantValue.HasValue) 2666Assert.False(semanticSummary.ConstantValue.HasValue) 2752Assert.False(semanticSummary.ConstantValue.HasValue) 2795Assert.False(semanticSummary.ConstantValue.HasValue) 2843Assert.False(semanticSummary.ConstantValue.HasValue) 2896Assert.False(semanticSummary.ConstantValue.HasValue) 2957Assert.False(semanticSummary.ConstantValue.HasValue) 3022Assert.False(semanticSummary.ConstantValue.HasValue) 3185Assert.False(semanticSummary.ConstantValue.HasValue) 3243Assert.False(semanticSummary.ConstantValue.HasValue) 3303Assert.False(semanticSummary.ConstantValue.HasValue) 3393Assert.False(semanticSummary.ConstantValue.HasValue) 3446Assert.False(semanticSummary.ConstantValue.HasValue) 3499Assert.False(semanticSummary.ConstantValue.HasValue) 3553Assert.False(semanticSummary.ConstantValue.HasValue) 3600Assert.False(semanticSummary.ConstantValue.HasValue) 3658Assert.False(semanticSummary.ConstantValue.HasValue) 3697Assert.False(semanticSummary.ConstantValue.HasValue) 3825Assert.False(speculativeConstantValue.HasValue) 3848Assert.False(speculativeTypeInfo.HasValue) 3890Assert.False(semanticSummary.ConstantValue.HasValue) 5613Assert.False(semanticSummary.ConstantValue.HasValue)
Semantics\LambdaSemanticInfoTests.vb (12)
48Assert.False(semanticInfo.ConstantValue.HasValue) 80Assert.False(semanticInfo.ConstantValue.HasValue) 114Assert.False(semanticInfo.ConstantValue.HasValue) 146Assert.False(semanticInfo.ConstantValue.HasValue) 221Assert.False(semanticInfo.ConstantValue.HasValue) 256Assert.False(semanticInfo.ConstantValue.HasValue) 291Assert.False(semanticInfo.ConstantValue.HasValue) 329Assert.False(semanticInfo.ConstantValue.HasValue) 364Assert.False(semanticInfo.ConstantValue.HasValue) 403Assert.False(semanticInfo.ConstantValue.HasValue) 443Assert.False(semanticInfo.ConstantValue.HasValue) 729Assert.False(semanticInfo.ConstantValue.HasValue)
Semantics\OptionalArgumentTests.vb (1)
1070Assert.False(semanticSummary.ConstantValue.HasValue)
Semantics\QueryExpressions_SemanticModel.vb (54)
81Assert.False(semanticInfo.ConstantValue.HasValue) 99Assert.False(semanticInfo.ConstantValue.HasValue) 118Assert.False(semanticInfo.ConstantValue.HasValue) 151Assert.False(semanticInfo.ConstantValue.HasValue) 173Assert.False(semanticInfo.ConstantValue.HasValue) 201Assert.False(semanticInfo.ConstantValue.HasValue) 219Assert.False(semanticInfo.ConstantValue.HasValue) 238Assert.False(semanticInfo.ConstantValue.HasValue) 307Assert.False(semanticInfo.ConstantValue.HasValue) 325Assert.False(semanticInfo.ConstantValue.HasValue) 344Assert.False(semanticInfo.ConstantValue.HasValue) 373Assert.False(semanticInfo.ConstantValue.HasValue) 395Assert.False(semanticInfo.ConstantValue.HasValue) 423Assert.False(semanticInfo.ConstantValue.HasValue) 441Assert.False(semanticInfo.ConstantValue.HasValue) 460Assert.False(semanticInfo.ConstantValue.HasValue) 527Assert.False(semanticInfo.ConstantValue.HasValue) 545Assert.False(semanticInfo.ConstantValue.HasValue) 564Assert.False(semanticInfo.ConstantValue.HasValue) 593Assert.False(semanticInfo.ConstantValue.HasValue) 615Assert.False(semanticInfo.ConstantValue.HasValue) 643Assert.False(semanticInfo.ConstantValue.HasValue) 661Assert.False(semanticInfo.ConstantValue.HasValue) 680Assert.False(semanticInfo.ConstantValue.HasValue) 771Assert.False(semanticInfo.ConstantValue.HasValue) 789Assert.False(semanticInfo.ConstantValue.HasValue) 808Assert.False(semanticInfo.ConstantValue.HasValue) 837Assert.False(semanticInfo.ConstantValue.HasValue) 859Assert.False(semanticInfo.ConstantValue.HasValue) 887Assert.False(semanticInfo.ConstantValue.HasValue) 905Assert.False(semanticInfo.ConstantValue.HasValue) 924Assert.False(semanticInfo.ConstantValue.HasValue) 1006Assert.False(semanticInfo.ConstantValue.HasValue) 1090Assert.False(semanticInfo.ConstantValue.HasValue) 1162Assert.False(semanticInfo.ConstantValue.HasValue) 1311Assert.False(semanticInfo.ConstantValue.HasValue) 1335Assert.False(semanticInfo.ConstantValue.HasValue) 1393Assert.False(semanticInfo.ConstantValue.HasValue) 1413Assert.False(semanticInfo.ConstantValue.HasValue) 1559Assert.False(semanticInfo.ConstantValue.HasValue) 1659Assert.False(semanticInfo.ConstantValue.HasValue) 2115Assert.False(semanticInfo.ConstantValue.HasValue) 2163Assert.False(semanticInfo.ConstantValue.HasValue) 2196Assert.False(semanticInfo.ConstantValue.HasValue) 2547Assert.False(semanticInfo.ConstantValue.HasValue) 2681Assert.False(semanticInfo.ConstantValue.HasValue) 2732Assert.False(semanticInfo.ConstantValue.HasValue) 2787Assert.False(semanticInfo.ConstantValue.HasValue) 2915Assert.False(semanticInfo.ConstantValue.HasValue) 3339Assert.False(semanticInfo.ConstantValue.HasValue) 3374Assert.False(semanticInfo.ConstantValue.HasValue) 3543Assert.False(semanticInfo.ConstantValue.HasValue) 3981Assert.False(semanticSummary.ConstantValue.HasValue) 4001Assert.True(semanticSummary.ConstantValue.HasValue)
Semantics\SelectCaseTests.vb (14)
41Assert.True(semanticSummary.ConstantValue.HasValue) 75Assert.True(semanticSummary.ConstantValue.HasValue) 111Assert.False(semanticSummary.ConstantValue.HasValue) 150Assert.False(semanticSummary.ConstantValue.HasValue) 189Assert.False(semanticSummary.ConstantValue.HasValue) 221Assert.False(semanticSummary.ConstantValue.HasValue) 254Assert.False(semanticSummary.ConstantValue.HasValue) 294Assert.False(semanticSummary.ConstantValue.HasValue) 334Assert.False(semanticSummary.ConstantValue.HasValue) 375Assert.False(semanticSummary.ConstantValue.HasValue) 410Assert.True(semanticSummary.ConstantValue.HasValue) 504Assert.False(semanticSummary.ConstantValue.HasValue) 543Assert.True(semanticSummary.ConstantValue.HasValue) 587Assert.False(semanticSummary.ConstantValue.HasValue)
Semantics\SyncLockTests.vb (3)
252Assert.False(semanticSummary.ConstantValue.HasValue) 290Assert.False(semanticSummary.ConstantValue.HasValue) 323Assert.False(semanticSummary.ConstantValue.HasValue)
Semantics\TypeOfTests.vb (1)
796Assert.False(semantics.GetConstantValue(typeOfExpressions(5)).HasValue)
Semantics\WithBlockSemanticModelTests.vb (2)
40Assert.False(model.GetConstantValue(withExpression).HasValue) 70Assert.False(semanticInfo.ConstantValue.HasValue)
Semantics\XmlLiteralSemanticModelTests.vb (1)
543Assert.False(semanticSummary.ConstantValue.HasValue)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (6)
SymbolsTests\Source\EnumTests.vb (1)
1452Assert.True(value.HasValue)
SymbolsTests\Source\EventTests.vb (5)
1582Assert.False(semanticSummary.ConstantValue.HasValue) 1620Assert.False(semanticSummary.ConstantValue.HasValue) 1661Assert.False(semanticSummary.ConstantValue.HasValue) 1698Assert.False(semanticSummary.ConstantValue.HasValue) 1806Assert.False(semanticSummary.ConstantValue.HasValue)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (2)
Simplification\Simplifiers\AbstractVisualBasicSimplifier.vb (1)
157If Not nameofValueOpt.HasValue Then
SpeculationAnalyzer.vb (1)
562Me.SpeculativeSemanticModel.GetConstantValue(newExpression).HasValue Then
Microsoft.CodeAnalysis.Workspaces (74)
Classification\AbstractClassificationService.cs (2)
87if (classifiedSpans.HasValue) 134if (!cachedSpans.HasValue || cachedSpans.Value == null)
CodeFixesAndRefactorings\CommonFixAllState.cs (3)
54var (newDocument, newProject) = documentAndProject.HasValue ? documentAndProject.Value : (Document, Project); 55var newScope = scope.HasValue ? scope.Value : Scope; 56var newCodeActionEquivalenceKey = codeActionEquivalenceKey.HasValue ? codeActionEquivalenceKey.Value : CodeActionEquivalenceKey;
CodeGenerationContext.cs (14)
199var newContextLocation = contextLocation.HasValue ? contextLocation.Value : this.ContextLocation; 200var newAfterThisLocation = afterThisLocation.HasValue ? afterThisLocation.Value : this.AfterThisLocation; 201var newBeforeThisLocation = beforeThisLocation.HasValue ? beforeThisLocation.Value : this.BeforeThisLocation; 202var newAddImports = addImports.HasValue ? addImports.Value : this.AddImports; 203var newAdditionalImports = additionalImports.HasValue ? additionalImports.Value : this.AdditionalImports; 204var newGenerateMembers = generateMembers.HasValue ? generateMembers.Value : this.GenerateMembers; 205var newMergeNestedNamespaces = mergeNestedNamespaces.HasValue ? mergeNestedNamespaces.Value : this.MergeNestedNamespaces; 206var newMergeAttributes = mergeAttributes.HasValue ? mergeAttributes.Value : this.MergeAttributes; 207var newGenerateDefaultAccessibility = generateDefaultAccessibility.HasValue ? generateDefaultAccessibility.Value : this.GenerateDefaultAccessibility; 208var newGenerateMethodBodies = generateMethodBodies.HasValue ? generateMethodBodies.Value : this.GenerateMethodBodies; 209var newGenerateDocumentationComments = generateDocumentationComments.HasValue ? generateDocumentationComments.Value : this.GenerateDocumentationComments; 210var newAutoInsertionLocation = autoInsertionLocation.HasValue ? autoInsertionLocation.Value : this.AutoInsertionLocation; 211var newSortMembers = sortMembers.HasValue ? sortMembers.Value : this.SortMembers; 212var newReuseSyntax = reuseSyntax.HasValue ? reuseSyntax.Value : this.ReuseSyntax;
CodeGenerationSymbolFactory.cs (3)
306name.HasValue ? name.Value : parameter.Name, 309defaultValue.HasValue 537returnTypeAttributes: returnTypeAttributes.HasValue ? returnTypeAttributes.Value : method.GetReturnTypeAttributes(),
CodeRefactorings\SyntaxEditorBasedCodeRefactoringProvider.cs (1)
64var spans = fixAllSpans.HasValue ? fixAllSpans.Value : ImmutableArray.Create(editor.OriginalRoot.FullSpan);
CustomDataFlowAnalysis.cs (1)
149if (current.BranchValue.ConstantValue.HasValue && current.BranchValue.ConstantValue.Value is bool constant)
EditorConfigValueSerializer.cs (1)
50return optionalBool.HasValue ? new Optional<bool?>(optionalBool.Value) : new Optional<bool?>();
EditorConfigValueSerializer`1.cs (1)
47if (optionalValue.HasValue)
EmbeddedSyntaxToken.cs (6)
65kind.HasValue ? kind.Value : Kind, 66leadingTrivia.HasValue ? leadingTrivia.Value : LeadingTrivia, 67virtualChars.HasValue ? virtualChars.Value : VirtualChars, 68trailingTrivia.HasValue ? trailingTrivia.Value : TrailingTrivia, 69diagnostics.HasValue ? diagnostics.Value : Diagnostics, 70value.HasValue ? value.Value : Value);
FindSymbols\Declarations\DeclarationFinder_AllDeclarations.cs (1)
47if (!result.HasValue)
FindSymbols\Declarations\DeclarationFinder_SourceDeclarations.cs (4)
53if (!result.HasValue) 91if (!result.HasValue) 124if (!result.HasValue) 157if (!result.HasValue)
FindSymbols\FindReferences\DependentTypeFinder_Remote.cs (1)
39if (!result.HasValue)
OperationExtensions.cs (1)
372=> operand is ILiteralOperation { ConstantValue: { HasValue: true, Value: null } };
Rename\ConflictEngine\ConflictResolver.cs (1)
76if (result.HasValue && result.Value != null)
Rename\LightweightRenameLocations.cs (1)
98if (result.HasValue && result.Value != null)
Rename\Renamer.cs (1)
189if (result.HasValue && result.Value != null)
Shared\TestHooks\AsynchronousOperationListenerProvider.cs (1)
137if (isCompleted.HasValue && !isCompleted.Value)
Storage\SQLite\v2\SQLitePersistentStorage.Accessor.cs (6)
133return optional.HasValue && checksum == optional.Value; 152Contract.ThrowIfTrue(optional.HasValue && optional.Value == null); 153return optional.HasValue ? optional.Value : null; 188if (optional.HasValue) 192if (optional.HasValue) 315return storedChecksum.HasValue && checksum == storedChecksum.Value;
SyntaxGeneratorExtensions_Negate.cs (3)
413if (numericValue.HasValue && numericValue.Value is 0) 451if (operation?.Kind == OperationKind.Literal && operation.ConstantValue.HasValue && operation.ConstantValue.Value is true) 455else if (operation?.Kind == OperationKind.Literal && operation.ConstantValue.HasValue && operation.ConstantValue.Value is false)
Workspace\Solution\DocumentInfo.cs (6)
106var newLoader = loader.HasValue ? loader.Value : TextLoader; 107var newDocumentServiceProvider = documentServiceProvider.HasValue ? documentServiceProvider.Value : DocumentServiceProvider; 220var newSourceCodeKind = sourceCodeKind.HasValue ? sourceCodeKind.Value : SourceCodeKind; 221var newFilePath = filePath.HasValue ? filePath.Value : FilePath; 222var newIsGenerated = isGenerated.HasValue ? isGenerated.Value : IsGenerated; 223var newDesignTimeOnly = designTimeOnly.HasValue ? designTimeOnly.Value : DesignTimeOnly;
Workspace\Solution\ProjectInfo.cs (13)
296var newCompilationOptions = compilationOptions.HasValue ? compilationOptions.Value : CompilationOptions; 297var newParseOptions = parseOptions.HasValue ? parseOptions.Value : ParseOptions; 304var newHostObjectType = hostObjectType.HasValue ? hostObjectType.Value : HostObjectType; 564var newFilePath = filePath.HasValue ? filePath.Value : FilePath; 565var newOutputPath = outputPath.HasValue ? outputPath.Value : OutputFilePath; 566var newOutputRefPath = outputRefPath.HasValue ? outputRefPath.Value : OutputRefFilePath; 567var newCompilationOutputPaths = compilationOutputInfo.HasValue ? compilationOutputInfo.Value : CompilationOutputInfo; 568var newDefaultNamespace = defaultNamespace.HasValue ? defaultNamespace.Value : DefaultNamespace; 569var newChecksumAlgorithm = checksumAlgorithm.HasValue ? checksumAlgorithm.Value : ChecksumAlgorithm; 570var newIsSubmission = isSubmission.HasValue ? isSubmission.Value : IsSubmission; 571var newHasAllInformation = hasAllInformation.HasValue ? hasAllInformation.Value : HasAllInformation; 572var newRunAnalyzers = runAnalyzers.HasValue ? runAnalyzers.Value : RunAnalyzers; 573var newTelemetryId = telemetryId.HasValue ? telemetryId.Value : TelemetryId;
Workspace\Solution\SolutionInfo.cs (2)
135var newFilePath = filePath.HasValue ? filePath.Value : FilePath; 136var newTelemetryId = telemetryId.HasValue ? telemetryId.Value : TelemetryId;
Workspace\Solution\SolutionState.cs (1)
207var newFrozenSourceGeneratedDocumentState = frozenSourceGeneratedDocument.HasValue ? frozenSourceGeneratedDocument.Value : _frozenSourceGeneratedDocumentState;
Microsoft.VisualStudio.LanguageServices (7)
CodeLens\RemoteCodeLensReferencesService.cs (4)
61return result.HasValue ? result.Value : null; 107return result.HasValue ? result.Value : null; 132return result.HasValue ? result.Value : null; 270return result.HasValue ? result.Value : null;
Options\VisualStudioSettingsOptionPersister.cs (2)
80if (result.HasValue) 92if (fallbackResult.HasValue)
UnusedReferences\UnusedReferenceAnalysisService.cs (1)
37if (!result.HasValue)
Microsoft.VisualStudio.LanguageServices.CSharp (3)
CodeModel\MethodXml\MethodXmlBuilder.cs (2)
250if (!constantValue.HasValue) 292if (!constantValue.HasValue)
Options\CSharpVisualStudioOptionStorageReadFallbacks.cs (1)
77if (value.HasValue)
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
CodeModel\MethodXML\MethodXmlBuilder.vb (2)
233If Not constantValue.HasValue Then 530If Not constantValue.HasValue Then
Roslyn.VisualStudio.Next.UnitTests (6)
Options\VisualStudioSettingsOptionPersisterTests.cs (6)
199Assert.True(result.HasValue); 242Assert.False(result.HasValue); 265Assert.True(result.HasValue); 272Assert.True(newValue.HasValue); 303Assert.True(result.HasValue); 310Assert.True(newValue.HasValue);