2 implementations of Type
Microsoft.CodeAnalysis.CSharp (1)
Symbols\PublicModel\LocalSymbol.cs (1)
25ITypeSymbol ILocalSymbol.Type
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\Source\LocalSymbol.vb (1)
395Private ReadOnly Property ILocalSymbol_Type As ITypeSymbol Implements ILocalSymbol.Type
283 references to Type
ConfigurationSchemaGenerator (1)
RuntimeSource\Configuration.Binder\Parser\ConfigurationBinder.cs (1)
108ILocalReferenceOperation l => l.Local.Type,
Microsoft.AspNetCore.App.CodeFixes (2)
Dependencies\AddPackageFixer.cs (1)
71ILocalSymbol localSymbol => localSymbol.Type,
Dependencies\ExtensionMethodsCompletionProvider.cs (1)
68ILocalSymbol localSymbol => localSymbol.Type,
Microsoft.CodeAnalysis (11)
Operations\ControlFlowGraphBuilder.cs (10)
3798local.Type, 4019processResource(new LocalReferenceOperation(localSymbol, isDeclaration: false, semanticModel: null, declarator.Syntax, localSymbol.Type, 4369lockStatement.LockTakenSymbol.Type, constantValue: null, isImplicit: true); 4410lockStatement.LockTakenSymbol.Type, constantValue: null, isImplicit: true); 4661current = applyConversion(info?.ElementConversion, current, local.Type); 4668local.Type, 4785operation.LoopControlVariable.Syntax, loopObject.Type, 5432declarator.Syntax, local.Type, constantValue: null, isImplicit: true); 5859type: localSymbol.Type, 5876var localRef = new LocalReferenceOperation(localSymbol, isDeclaration: true, semanticModel: null, declarator.Syntax, localSymbol.Type, constantValue: null, isImplicit: true);
SymbolDisplay\AbstractSymbolDisplayVisitor_Minimal.cs (1)
102return localSymbol.Type;
Microsoft.CodeAnalysis.CodeStyle (8)
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (1)
68variableDeclarator.Symbol.Type is not ITypeSymbol iterationType)
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractObjectCreationExpressionAnalyzer.cs (1)
147if (local.Type is IDynamicTypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (2)
333ILocalSymbol localSymbol => localSymbol.Type, 615ILocalSymbol localSymbol => localSymbol.Type,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (4)
458CompareAcrossSemanticModels(localSymbol.Type, newLocalSymbol.Type); 791if (!SymbolsAreCompatible(originalLocalVariables[i].Type, newLocalVariables[i].Type))
Microsoft.CodeAnalysis.CodeStyle.Fixes (4)
src\Analyzers\Core\CodeFixes\ForEachCast\AbstractForEachCastCodeFixProvider.cs (3)
70Contract.ThrowIfNull(variableDeclarator.Symbol.Type); 74var conversion = semanticModel.Compilation.ClassifyCommonConversion(elementType, variableDeclarator.Symbol.Type); 76var rewritten = GetRewrittenCollection(editor.Generator, expression, variableDeclarator.Symbol.Type, conversion);
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (1)
586var declarationStatement = CreateLocalDeclarationStatement(declaredLocal.Type, declaredLocal.Name);
Microsoft.CodeAnalysis.CSharp (4)
Compilation\CSharpSemanticModel.cs (1)
596return (local.Type, local.NullableAnnotation);
SymbolDisplay\SymbolDisplayVisitor.cs (3)
269symbol.Type.Accept(this.NotFirstVisitor); 285CanAddConstant(symbol.Type, symbol.ConstantValue)) 291AddConstantValue(symbol.Type, symbol.ConstantValue);
Microsoft.CodeAnalysis.CSharp.CodeStyle (8)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
532if (!local.Type.IsRefLikeType)
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (2)
143if (!localSymbol.Type.Equals(asType)) 238if (localSymbol.Type.NullableAnnotation == NullableAnnotation.Annotated)
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
127if (!localSymbol.Type.Equals(isType))
src\Analyzers\CSharp\Analyzers\UseTupleSwap\CSharpUseTupleSwapDiagnosticAnalyzer.cs (2)
110if (local.Type.IsRefLikeType || local.Type.RequiresUnsafeModifier())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ILocalSymbolExtensions.cs (2)
21HasTypeParameterWithName(localFunctionOrMethodDeclaration, localSymbol.Type.Name) && 22HasTypeParameterWithName(localFunctionStatement, localSymbol.Type.Name))
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (4)
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (2)
218var newType = GenerateTypeSyntaxOrVar(local.Type, options); 231var explicitType = declaration.Type.IsVar ? local.Type?.GenerateTypeSyntax() : declaration.Type;
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (1)
144var localType = local.Type.WithNullableAnnotation(NullableAnnotation.NotAnnotated);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpMoveDeclarationNearReferenceService.cs (1)
63return Equals(localSymbol.Type, rightType.Type);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (4)
SymbolKey\SymbolKeyMetadataVsSourceTests.cs (1)
264var localType = ((ILocalSymbol)local).Type;
SymbolKey\SymbolKeyTestBase.cs (3)
341if (v is ILocalSymbol local && (local.Type.Kind == SymbolKind.ArrayType || local.Type.Kind == SymbolKind.PointerType)) 343list.Add(local.Type);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (20)
CodeGen\CodeGenDeconstructTests.cs (2)
1678Assert.True(x.Type.GetSymbol().TupleElementNames.IsDefault); 6370Assert.Equal("System.Int32", symbol.Type.ToTestDisplayString());
CodeGen\CodeGenTupleTest.cs (18)
12695var m1Tuple = model.LookupSymbols(node.SpanStart, name: "v1").OfType<ILocalSymbol>().Single().Type.GetSymbol<NamedTypeSymbol>(); 12696var m2Tuple = model.LookupSymbols(node.SpanStart, name: "v2").OfType<ILocalSymbol>().Single().Type.GetSymbol<NamedTypeSymbol>(); 12697var m6Tuple = model.LookupSymbols(node.SpanStart, name: "v6").OfType<ILocalSymbol>().Single().Type.GetSymbol<NamedTypeSymbol>(); 14456var v1Type = ((ILocalSymbol)symbolInfo.Symbol).Type; 14466var v2Type = ((ILocalSymbol)symbolInfo.Symbol).Type; 16569var xSymbol = (INamedTypeSymbol)((ILocalSymbol)model.GetDeclaredSymbol(x)).Type; 16606var xSymbol = (INamedTypeSymbol)((ILocalSymbol)model.GetDeclaredSymbol(x)).Type; 17406Assert.Equal("(System.Int32 Alice, System.String Bob)", x1Symbol.Type.ToTestDisplayString()); 17407var bobField = x1Symbol.Type.GetMember("Bob"); 17440Assert.True(x1Symbol.Type.GetSymbol().TupleElementNames.IsDefault); 22858var xSymbol = ((ILocalSymbol)model.GetDeclaredSymbol(x)).Type; 24270Assert.Equal("(System.Int32 notA, System.Int32 notB)", xSymbol.Type.ToTestDisplayString()); 24333Assert.Equal("(System.Int32 notA, System.Int32 notB)", xSymbol.Type.ToTestDisplayString()); 24397var collectionSymbol = (model.GetDeclaredSymbol(collection) as ILocalSymbol)?.Type; 24470var collectionSymbol = (model.GetDeclaredSymbol(collection) as ILocalSymbol)?.Type; 24543var collectionSymbol = (model.GetDeclaredSymbol(collection) as ILocalSymbol)?.Type; 24617var collectionSymbol = (model.GetDeclaredSymbol(collection) as ILocalSymbol)?.Type; 25026var xSymbol = ((ILocalSymbol)model.GetDeclaredSymbol(x)).Type;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (58)
FirstClassSpanTests.cs (2)
5002AssertEx.Equal("System.Int32[]", aSymbol.Type.ToTestDisplayString()); 5005var lookupResult = model.LookupSymbols(d1Access.Name.SpanStart, aSymbol.Type, "M", includeReducedExtensionMethods: true);
FlowAnalysis\RegionAnalysisTests.cs (2)
3335Assert.Equal("Int32", intsym.Type.Name); 3336Assert.Equal("Int64", longsym.Type.Name);
Semantics\LockTests.cs (1)
186Assert.Equal("System.Threading.Lock", localSymbol.Type.ToTestDisplayString());
Semantics\OutVarTests.cs (34)
987AssertInfoForDeclarationExpressionSyntax(model, decl, expectedSymbol: local, expectedType: local.Type); 994Assert.Equal(local.Type, model.GetTypeInfo(reference).Type); 1150AssertInfoForDeclarationExpressionSyntax(model, decl, local, local.Type); 5756Assert.Equal("System.Int32", ((ILocalSymbol)compilation.GetSemanticModel(tree).GetDeclaredSymbol(GetVariableDesignation(x1Decl))).Type.ToTestDisplayString()); 12875Assert.Equal("System.Int32", ((ILocalSymbol)compilation.GetSemanticModel(tree).GetDeclaredSymbol(GetVariableDesignation(yDecl))).Type.ToTestDisplayString()); 18036Assert.Equal("Cls.var", ((ILocalSymbol)model.GetDeclaredSymbol(GetVariableDesignation(x1Decl))).Type.ToTestDisplayString()); 18436Assert.Equal("System.Int32", ((ILocalSymbol)compilation.GetSemanticModel(tree).GetDeclaredSymbol(GetVariableDesignation(x1Decl))).Type.ToTestDisplayString()); 18500Assert.Equal("System.Int32", ((ILocalSymbol)compilation.GetSemanticModel(tree).GetDeclaredSymbol(GetVariableDesignation(x1Decl))).Type.ToTestDisplayString()); 18549Assert.Equal("System.Int32", ((ILocalSymbol)compilation.GetSemanticModel(tree).GetDeclaredSymbol(GetVariableDesignation(x1Decl))).Type.ToTestDisplayString()); 18594Assert.Equal("System.Int32", ((ILocalSymbol)compilation.GetSemanticModel(tree).GetDeclaredSymbol(GetVariableDesignation(x1Decl))).Type.ToTestDisplayString()); 20225Assert.True(x1.Type.IsErrorType()); 20254Assert.Equal("System.Int32", x1.Type.ToTestDisplayString()); 21313Assert.True(((ILocalSymbol)y1).Type.IsErrorType()); 21373Assert.True(symbol.Type.IsErrorType()); 33622Assert.Equal("System.Int32", symbol.Type.ToTestDisplayString()); 33708Assert.Equal("System.Int32", symbol.Type.ToTestDisplayString()); 34764Assert.Equal("System.Int32", symbol.Type.ToTestDisplayString()); 34845Assert.Equal("System.Int32", symbol.Type.ToTestDisplayString()); 34897Assert.Equal("System.Int32", symbol.Type.ToTestDisplayString()); 34951Assert.Equal("System.Int32", symbol.Type.ToTestDisplayString()); 35009Assert.Equal("System.Int32", symbol.Type.ToTestDisplayString()); 35060Assert.Equal("System.Int32", symbol.Type.ToTestDisplayString()); 35113Assert.Equal("System.Int32", symbol.Type.ToTestDisplayString()); 35152Assert.Equal("System.Int32", symbol.Type.ToTestDisplayString()); 35186Assert.Equal("var", symbol.Type.ToTestDisplayString()); 35225Assert.Equal("var", symbol.Type.ToTestDisplayString()); 35269Assert.Equal("var", symbol.Type.ToTestDisplayString()); 35300Assert.Equal("var", symbol.Type.ToTestDisplayString()); 35339Assert.Equal("var", symbol.Type.ToTestDisplayString()); 35372Assert.Equal("var", symbol.Type.ToTestDisplayString()); 35408Assert.Equal("var", symbol.Type.ToTestDisplayString()); 35447Assert.Equal("var", symbol.Type.ToTestDisplayString()); 35477Assert.Equal("var", symbol.Type.ToTestDisplayString()); 35514Assert.Equal("var", symbol.Type.ToTestDisplayString());
Semantics\PatternMatchingTestBase.cs (2)
108var type = local.Type; 150var type = ((ILocalSymbol)symbol).Type;
Semantics\PatternMatchingTests.cs (2)
1161Assert.Equal("System.Int32", ((ILocalSymbol)compilation.GetSemanticModel(tree).GetDeclaredSymbol(x1Decl[0])).Type.ToTestDisplayString()); 11390var types = locals.Select(local => ((ILocalSymbol)model.GetDeclaredSymbol(local)).Type.ToTestDisplayString()).ToArray();
Semantics\PatternMatchingTests_ListPatterns.cs (11)
3332Assert.Equal(expectedType, local.Type.ToTestDisplayString(includeNonNullable: true)); 3339Assert.Equal(expectedType, local.Type.ToTestDisplayString(includeNonNullable: true)); 3647Assert.Equal(declaredType, ((ILocalSymbol)symbol).Type.ToDisplayString()); 3727Assert.Equal("System.Int32", ((ILocalSymbol)symbol).Type.ToTestDisplayString()); 3742Assert.Equal("System.Int32", ((ILocalSymbol)symbol).Type.ToTestDisplayString()); 4097Assert.Equal(expectedType, local.Type.ToTestDisplayString(includeNonNullable: true)); 4184Assert.Equal(expectedType, local.Type.ToTestDisplayString(includeNonNullable: true)); 4261Assert.Equal(expectedType, local.Type.ToTestDisplayString(includeNonNullable: true)); 4376Assert.Equal(expectedType, local.Type.ToTestDisplayString(includeNonNullable: true)); 4417Assert.Equal(declaredType, ((ILocalSymbol)symbol).Type.ToDisplayString()); 4568Assert.Equal(expectedType, local.Type.ToTestDisplayString(includeNonNullable: true));
Semantics\PatternMatchingTests_Scope.cs (3)
12160Assert.True(((ILocalSymbol)y1).Type.IsErrorType()); 12214Assert.True(symbol.Type.IsErrorType()); 13828Assert.Equal("System.Int32", x1.Type.ToTestDisplayString());
Semantics\PatternMatchingTests2.cs (1)
725Assert.Equal("int", ((ILocalSymbol)symbol).Type.ToDisplayString());
Microsoft.CodeAnalysis.CSharp.Features (17)
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (5)
390var type = localSymbol.Type.GenerateTypeSyntax(); 398var arrayType = (ArrayTypeSyntax)localSymbol.Type.GenerateTypeSyntax(); 419if (localSymbol.Type.ContainsAnonymousType() || localSymbol.Type is IErrorTypeSymbol { Name: null or "" }) 422return expression.Cast(localSymbol.Type);
InlineHints\CSharpInlineTypeHintsService.cs (1)
59var type = local?.Type;
ReplaceConditionalWithStatements\CSharpReplaceConditionalWithStatementsCodeRefactoringProvider.cs (1)
74type, symbol.Type.GenerateTypeSyntax(allowVar: false).WithTriviaFrom(type));
ReverseForStatement\CSharpReverseForStatementCodeRefactoringProvider.cs (1)
95return local?.Type.SpecialType switch
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
532if (!local.Type.IsRefLikeType)
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (2)
143if (!localSymbol.Type.Equals(asType)) 238if (localSymbol.Type.NullableAnnotation == NullableAnnotation.Annotated)
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
127if (!localSymbol.Type.Equals(isType))
src\Analyzers\CSharp\Analyzers\UseTupleSwap\CSharpUseTupleSwapDiagnosticAnalyzer.cs (2)
110if (local.Type.IsRefLikeType || local.Type.RequiresUnsafeModifier())
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (2)
218var newType = GenerateTypeSyntaxOrVar(local.Type, options); 231var explicitType = declaration.Type.IsVar ? local.Type?.GenerateTypeSyntax() : declaration.Type;
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (1)
144var localType = local.Type.WithNullableAnnotation(NullableAnnotation.NotAnnotated);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (54)
Semantics\AwaitExpressionTests.cs (1)
275Assert.Equal("System.Int32", symbolV.Type.ToTestDisplayString());
Semantics\DeconstructionTests.cs (2)
4175Assert.Equal("System.Int32", ((ILocalSymbol)x1).Type.ToTestDisplayString()); 4180Assert.Equal("System.Int32", ((ILocalSymbol)x2).Type.ToTestDisplayString());
Semantics\DelegateTypeTests.cs (1)
14352var delegateType = (INamedTypeSymbol)local.Type;
Semantics\ForEachTests.cs (1)
2889var localSymbolType = localSymbol.Type;
Semantics\FunctionPointerTests.cs (1)
2092AssertEx.Equal("delegate* unmanaged<System.Int32>", local.Type.ToTestDisplayString());
Semantics\LocalFunctionTests.cs (1)
4693Assert.Equal("System.Int32", symbol.Type.ToTestDisplayString());
Semantics\LockTests.cs (3)
48Assert.Equal(SpecialType.System_Object, localSymbol.Type.SpecialType); 606VerifySemanticInfoForLockStatements(compilation, symbol.Type.GetSymbol(), isSymbolNull: true); 630VerifySemanticInfoForLockStatements(compilation, symbol.Type.GetSymbol());
Semantics\NullableReferenceTypesTests.cs (19)
5174Assert.Equal(CodeAnalysis.NullableAnnotation.Annotated, local.Type.NullableAnnotation); 5175Assert.Equal("T?", local.Type.ToTestDisplayString(includeNonNullable: true)); 145378Assert.Equal("System.Object?", local.Type.ToTestDisplayString()); 145380Assert.Equal(CodeAnalysis.NullableAnnotation.Annotated, local.Type.NullableAnnotation); 145419Assert.Equal("System.Object?", local.Type.ToTestDisplayString()); 145421Assert.Equal(CodeAnalysis.NullableAnnotation.Annotated, local.Type.NullableAnnotation); 145459Assert.Equal("System.Object?", local.Type.ToTestDisplayString()); 145461Assert.Equal(CodeAnalysis.NullableAnnotation.Annotated, local.Type.NullableAnnotation); 145497Assert.Equal("System.Object?", local.Type.ToTestDisplayString()); 145499Assert.Equal(CodeAnalysis.NullableAnnotation.Annotated, local.Type.NullableAnnotation); 145535Assert.Equal("System.Object?", local.Type.ToTestDisplayString()); 145537Assert.Equal(CodeAnalysis.NullableAnnotation.Annotated, local.Type.NullableAnnotation); 145639Assert.Equal("System.Object?", local.Type.ToTestDisplayString()); 145641Assert.Equal(CodeAnalysis.NullableAnnotation.Annotated, local.Type.NullableAnnotation); 145678Assert.Equal("System.Object?", local.Type.ToTestDisplayString()); 145680Assert.Equal(CodeAnalysis.NullableAnnotation.Annotated, local.Type.NullableAnnotation); 154885symbol.Type.NullableAnnotation); 158819Assert.Equal("T?", local.Type.ToTestDisplayString()); 158820Assert.Equal(CodeAnalysis.NullableAnnotation.Annotated, local.Type.NullableAnnotation);
Semantics\RefEscapingTests.cs (1)
72return ((ILocalSymbol)model.GetDeclaredSymbol(decl)).Type;
Semantics\RefFieldTests.cs (1)
17947var delegateInvokeMethods = decls.Select(d => ((ILocalSymbol)model.GetDeclaredSymbol(d)).Type.GetSymbol<NamedTypeSymbol>().DelegateInvokeMethod).ToArray();
Semantics\TopLevelStatementsTests.cs (4)
6330Assert.Equal(expectedType, ((ILocalSymbol)xRef).Type.ToTestDisplayString()); 6331Assert.Equal(expectedType, ((ILocalSymbol)xDecl).Type.ToTestDisplayString()); 6379Assert.Equal(expectedType, ((ILocalSymbol)xDecl).Type.ToTestDisplayString()); 6385Assert.Equal(expectedType, ((ILocalSymbol)xRef).Type.ToTestDisplayString());
Semantics\TryCatchTests.cs (1)
48Assert.Equal("System.IO.IOException", localSymbol.Type.ToDisplayString());
Semantics\UnsafeTests.cs (9)
6332return ((ILocalSymbol)model.GetDeclaredSymbol(decl)).Type; 6391return ((ILocalSymbol)model.GetDeclaredSymbol(decl)).Type; 7278Assert.Equal(type, ((ILocalSymbol)declaredSymbol).Type); 7860Assert.Equal(structPointerType.GetPublicSymbol(), ((ILocalSymbol)receiverSymbol).Type); 7927Assert.Equal(structType.GetPublicSymbol(), ((ILocalSymbol)receiverSymbol).Type); 8171Assert.Equal(intPointerType.GetPublicSymbol(), ((ILocalSymbol)receiverSymbol).Type); 8183Assert.Equal(intType.GetPublicSymbol(), ((ILocalSymbol)indexSymbol).Type); 10185ITypeSymbol type = symbol.Type; 11339Assert.Equal(countSummary.Type, countSymbol.Type);
Semantics\UsingStatementTests.cs (9)
67Assert.Equal(SpecialType.System_IDisposable, declaredLocal.Type.SpecialType); 1348Assert.Equal(((ILocalSymbol)declaredSymbol).Type, typeInfo.Symbol); 1389Assert.Equal(((ILocalSymbol)model.GetDeclaredSymbol(usingStatement.Declaration.Variables.First())).Type, typeInfo.Symbol); 1525VerifySymbolInfoForUsingStatements(compilation, x.Type); 1556VerifySymbolInfoForUsingStatements(compilation, x.Type, 2); 1585VerifySymbolInfoForUsingStatements(compilation, x.Type, 1); 1613VerifySymbolInfoForUsingStatements(compilation, x.Type, 1); 1642VerifySymbolInfoForUsingStatements(compilation, x.Type, 1); 1670VerifySymbolInfoForUsingStatements(compilation, x.Type, 1);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (43)
Compilation\GetSemanticInfoTests.cs (1)
2729Assert.Equal(type, ((ILocalSymbol)symbol).Type);
Compilation\SemanticModelAPITests.cs (7)
1791Assert.Equal("Int32", ((ILocalSymbol)local).Type.Name); 1844Assert.Equal("Int32", ((ILocalSymbol)local).Type.Name); 1857Assert.Equal("String", ((ILocalSymbol)local).Type.Name); 2397Assert.Equal("Int32", ((ILocalSymbol)local).Type.Name); 2580Assert.Equal("Int32", ((ILocalSymbol)local).Type.Name); 2594Assert.Equal("String", ((ILocalSymbol)local).Type.Name); 2608Assert.Equal("Int32", ((ILocalSymbol)local).Type.Name);
SymbolDisplay\SymbolDisplayTests.cs (1)
8313var type = ((ILocalSymbol)model.GetDeclaredSymbol(name.Names[0])).Type;
Symbols\AccessorOverriddenOrHiddenMembersTests.cs (2)
1030Assert.Equal("Disposable", localD.Type.Name); 1031Assert.Equal(classDisposable, localD.Type);
Symbols\AnonymousTypesSymbolTests.cs (2)
1691var typeA3 = localA3.Type; 1692var typeA4 = localA4.Type;
Symbols\ConversionTests.cs (1)
397ITypeSymbol targetType = ((ILocalSymbol)model.GetDeclaredSymbol(variableDeclarator)).Type;
Symbols\Source\DeclaringSyntaxNodeTests.cs (2)
265var localA1Type = localA1.Type; 329var localType = local.Type;
Symbols\Source\NullablePublicAPITests.cs (22)
1006var result = localSymbol.Type.NullableAnnotation; 1178Assert.Equal(declaredSymbol.Type.NullableAnnotation, declaredSymbol.NullableAnnotation); 1950Assert.Equal(PublicNullableAnnotation.Annotated, symbol.Type.NullableAnnotation); 1997Assert.Equal(expectedAnnotation, symbol.Type.NullableAnnotation); 2058Assert.Equal(expectedAnnotation1, symbols[0].Type.NullableAnnotation); 2060Assert.Equal(expectedAnnotation2, symbols[1].Type.NullableAnnotation); 2101Assert.Equal(expectedAnnotation1, symbols[0].Type.NullableAnnotation); 2103Assert.Equal(expectedAnnotation2, symbols[1].Type.NullableAnnotation); 2140Assert.Equal(PublicNullableAnnotation.Annotated, ((ILocalSymbol)specModel.GetDeclaredSymbol(newDeclarator)).Type.NullableAnnotation); 2144Assert.Equal(PublicNullableAnnotation.Annotated, ((ILocalSymbol)specModel.GetDeclaredSymbol(newDeclarator)).Type.NullableAnnotation); 2189Assert.Equal(expectedAnnotation, symbol.Type.NullableAnnotation); 2221Assert.Equal(PublicNullableAnnotation.Annotated, symbol.Type.NullableAnnotation); 2259Assert.Equal(expectedAnnotation, symbol.Type.NullableAnnotation); 2291Assert.Equal(expectedAnnotation, symbol.Type.NullableAnnotation); 2337Assert.Equal(expectedAnnotation, symbol.Type.NullableAnnotation); 2379Assert.Equal(expectedAnnotation, symbol.Type.NullableAnnotation); 2422Assert.Equal(expectedAnnotation, symbol.Type.NullableAnnotation); 2464Assert.Equal(PublicNullableAnnotation.Annotated, symbol.Type.NullableAnnotation); 2512Assert.Equal(expectedAnnotation, symbol.Type.NullableAnnotation); 2561Assert.Equal(expectedAnnotation, symbol.Type.NullableAnnotation); 3923Assert.Equal(PublicNullableAnnotation.Annotated, o2Symbol.Type.NullableAnnotation); 3937Assert.Equal(PublicNullableAnnotation.Annotated, o4Symbol.Type.NullableAnnotation);
Symbols\TypeTests.cs (5)
1685var anonymousType = (locals[3] as ILocalSymbol).Type; 1692Assert.Equal((locals[0] as ILocalSymbol).Type, memType, SymbolEqualityComparer.ConsiderEverything); 1700Assert.Same((locals[1] as ILocalSymbol).Type, memType); 1713Assert.Same((locals[2] as ILocalSymbol).Type, memType); 1768var memType = sym.Type;
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
Extensions.cs (1)
823return ((ILocalSymbol)symbol).Type;
Microsoft.CodeAnalysis.CSharp.Workspaces (4)
Rename\CSharpRenameRewriterLanguageService.cs (1)
775(matchingLocal.IsKind(SymbolKind.Local) && ((ILocalSymbol)matchingLocal).Type.IsDelegateType()) ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ILocalSymbolExtensions.cs (2)
21HasTypeParameterWithName(localFunctionOrMethodDeclaration, localSymbol.Type.Name) && 22HasTypeParameterWithName(localFunctionStatement, localSymbol.Type.Name))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpMoveDeclarationNearReferenceService.cs (1)
63return Equals(localSymbol.Type, rightType.Type);
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
AbstractTypeParameterChecker.cs (1)
68Visit(symbol.Type);
Microsoft.CodeAnalysis.Features (14)
Completion\Providers\ImportCompletionProvider\AbstractExtensionMethodImportCompletionProvider.cs (1)
106ILocalSymbol localSymbol => localSymbol.Type,
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (2)
189foreachVariable.Type, requireCollectionStatement, foreachStatement); 201var foreachType = foreachVariable.Type;
ExtractMethod\MethodExtractor.Analyzer.cs (2)
653ILocalSymbol local => local.Type, 752AddTypeParametersToMap(TypeParameterCollector.Collect(local.Type), sortedMap);
IntroduceUsingStatement\AbstractIntroduceUsingStatementCodeRefactoringProvider.cs (1)
84var localType = declarator.Symbol.Type;
LanguageServices\AnonymousTypeDisplayService\AbstractStructuralTypeDisplayService.StructuralTypeCollectorVisitor.cs (1)
45=> symbol.Type.Accept(this);
QuickInfo\CommonSemanticQuickInfoProvider.ErrorVisitor.cs (1)
36=> Visit(symbol.Type);
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (1)
68variableDeclarator.Symbol.Type is not ITypeSymbol iterationType)
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractObjectCreationExpressionAnalyzer.cs (1)
147if (local.Type is IDynamicTypeSymbol)
src\Analyzers\Core\CodeFixes\ForEachCast\AbstractForEachCastCodeFixProvider.cs (3)
70Contract.ThrowIfNull(variableDeclarator.Symbol.Type); 74var conversion = semanticModel.Compilation.ClassifyCommonConversion(elementType, variableDeclarator.Symbol.Type); 76var rewritten = GetRewrittenCollection(editor.Generator, expression, variableDeclarator.Symbol.Type, conversion);
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (1)
586var declarationStatement = CreateLocalDeclarationStatement(declaredLocal.Type, declaredLocal.Name);
Microsoft.CodeAnalysis.Test.Utilities (5)
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (4)
108AssignTo(local, local.Type, localsSourceTypes, initializer.Value); 114AssignTo(local, local.Type, localsSourceTypes, initializer.Value); 126if (HasMoreSpecificSourceType(local, local.Type, localsSourceTypes, out var mostSpecificSourceType)) 243AssignTo(targetLocal, targetLocal.Type, localsSourceTypes, sourceType);
Diagnostics\LocalCouldBeConstAnalyzer.cs (1)
88var localType = local.Type;
Microsoft.CodeAnalysis.VisualBasic (3)
SymbolDisplay\SymbolDisplayVisitor.vb (2)
292symbol.Type.Accept(Me) 300AddConstantValue(symbol.Type, symbol.ConstantValue)
Symbols\Source\LocalSymbol.vb (1)
395Private ReadOnly Property ILocalSymbol_Type As ITypeSymbol Implements ILocalSymbol.Type
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\VariableDeclaratorSyntaxExtensions.vb (1)
41Return localSymbol.Type
Microsoft.CodeAnalysis.VisualBasic.Features (3)
CodeRefactorings\InlineTemporary\VisualBasicInlineTemporaryCodeRefactoringProvider.vb (1)
395explicitInitializer = explicitInitializer.CastIfPossible(local.Type,
Completion\CompletionProviders\EnumCompletionProvider.vb (1)
92If(TryCast(symbol, ILocalSymbol)?.Type,
ReplaceConditionalWithStatementsCodeRefactoringProvider\VisualBasicReplaceConditionalWithStatementsCodeRefactoringProvider.vb (1)
65symbol.Type.GenerateTypeSyntax())))
Microsoft.CodeAnalysis.VisualBasic.Workspaces (4)
ObsoleteSymbol\VisualBasicObsoleteSymbolService.vb (1)
48If IsSymbolObsolete(localSymbol?.Type) Then
Simplification\Reducers\VisualBasicVariableDeclaratorReducer.vb (2)
154If localSymbol IsNot Nothing AndAlso TypeOf localSymbol IsNot IErrorTypeSymbol AndAlso TypeOf localSymbol.Type IsNot IErrorTypeSymbol Then 155typeSymbol = localSymbol.Type
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\VariableDeclaratorSyntaxExtensions.vb (1)
41Return localSymbol.Type
Microsoft.CodeAnalysis.Workspaces (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (2)
333ILocalSymbol localSymbol => localSymbol.Type, 615ILocalSymbol localSymbol => localSymbol.Type,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (4)
458CompareAcrossSemanticModels(localSymbol.Type, newLocalSymbol.Type); 791if (!SymbolsAreCompatible(originalLocalVariables[i].Type, newLocalVariables[i].Type))
Microsoft.VisualStudio.LanguageServices.CSharp (1)
LanguageService\CSharpHelpContextService.cs (1)
188symbol = localSymbol.Type;
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
Help\VisualBasicHelpContextService.Visitor.vb (2)
820If local.Type.IsAnonymousType Then 823result = _service.FormatSymbol(local.Type)