Skip to content

Commit b325301

Browse files
committed
Fix nullable unwraping in VB
1 parent 61987a6 commit b325301

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/Workspaces/VisualBasic/Portable/Recommendations/VisualBasicRecommendationServiceRunner.vb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Recommendations
277277

278278
Debug.Assert(Not excludeInstance OrElse Not useBaseReferenceAccessibility)
279279

280+
Dim unwrapNullable = False
280281
If _context.TargetToken.GetPreviousToken().IsKind(SyntaxKind.QuestionToken) Then
281-
Dim type = TryCast(container, INamedTypeSymbol)
282-
If type?.ConstructedFrom.SpecialType = SpecialType.System_Nullable_T Then
283-
container = type.GetTypeArguments().First()
282+
Dim type = container.GetSymbolType()
283+
If type?.OriginalDefinition?.SpecialType = SpecialType.System_Nullable_T Then
284+
unwrapNullable = True
284285
End If
285286
End If
286287

@@ -298,7 +299,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Recommendations
298299
.SelectMany(Function(n) LookupSymbolsInContainer(n, position, excludeInstance)) _
299300
.ToImmutableArray()
300301
Else
301-
symbols = GetMemberSymbols(container, position, excludeInstance, useBaseReferenceAccessibility, unwrapNullable:=False)
302+
symbols = GetMemberSymbols(container, position, excludeInstance, useBaseReferenceAccessibility, unwrapNullable)
302303
End If
303304

304305
If excludeShared Then

0 commit comments

Comments
 (0)