Binder\Binder_Conversions.cs (26)
380case TypeKind.Enum:
381case TypeKind.Struct:
382case TypeKind.Class when !type.IsAnonymousType: // We don't want to enable object creation with unspeakable types
384case TypeKind.TypeParameter:
386case TypeKind.Delegate:
388case TypeKind.Interface:
390case TypeKind.Array:
391case TypeKind.Class:
392case TypeKind.Dynamic:
394goto case TypeKind.Error;
395case TypeKind.Pointer:
396case TypeKind.FunctionPointer:
398goto case TypeKind.Error;
399case TypeKind.Error:
1276Debug.Assert(delegateType is NamedTypeSymbol { TypeKind: TypeKind.Delegate, DelegateInvokeMethod: { HasUseSiteError: false } }
1277|| delegateType.TypeKind == TypeKind.FunctionPointer,
1383static bool hasConversion(TypeKind targetKind, Conversions conversions, TypeSymbol source, TypeSymbol destination,
1401return targetKind == TypeKind.FunctionPointer
1406static ErrorCode getMethodMismatchErrorCode(TypeKind type)
1409TypeKind.Delegate => ErrorCode.ERR_MethDelegateMismatch,
1410TypeKind.FunctionPointer => ErrorCode.ERR_MethFuncPtrMismatch,
1414static ErrorCode getRefMismatchErrorCode(TypeKind type)
1417TypeKind.Delegate => ErrorCode.ERR_DelegateRefMismatch,
1418TypeKind.FunctionPointer => ErrorCode.ERR_FuncPtrRefMismatch,
1443Debug.Assert(Conversions.IsAssignableFromMulticastDelegate(delegateOrFuncPtrType, ref discardedUseSiteInfo) || delegateOrFuncPtrType.TypeKind == TypeKind.Delegate || delegateOrFuncPtrType.TypeKind == TypeKind.FunctionPointer);
Symbols\TypeSymbolExtensions.cs (68)
63if (type.TypeKind != TypeKind.TypeParameter)
109if (type.TypeKind == TypeKind.TypeParameter)
201return type.TypeKind == TypeKind.Enum;
296case TypeKind.Pointer:
297case TypeKind.Dynamic:
298case TypeKind.FunctionPointer:
314return type.TypeKind == TypeKind.Class;
320return type.TypeKind == TypeKind.Struct;
336return type.TypeKind == TypeKind.Dynamic;
342return type.TypeKind == TypeKind.TypeParameter;
348return type.TypeKind == TypeKind.Array;
354return type.TypeKind == TypeKind.Array && ((ArrayTypeSymbol)type).IsSZArray;
359return type.TypeKind == TypeKind.FunctionPointer;
366case TypeKind.Pointer:
367case TypeKind.FunctionPointer:
506return type.TypeKind == TypeKind.Delegate;
622case TypeKind.Class:
623case TypeKind.Struct:
624case TypeKind.Interface:
625case TypeKind.Enum:
626case TypeKind.Delegate:
627case TypeKind.Submission:
697case TypeKind.Class:
698case TypeKind.Struct:
699case TypeKind.Interface:
700case TypeKind.Enum:
701case TypeKind.Delegate:
716case TypeKind.Submission:
755case TypeKind.Dynamic:
756case TypeKind.TypeParameter:
757case TypeKind.Submission:
758case TypeKind.Enum:
761case TypeKind.Error:
762case TypeKind.Class:
763case TypeKind.Struct:
764case TypeKind.Interface:
765case TypeKind.Delegate:
833case TypeKind.Array:
837case TypeKind.Pointer:
841case TypeKind.FunctionPointer:
1076if (ReferenceEquals(parent2.OriginalDefinition, parent1OriginalDefinition) || parent1OriginalDefinition.TypeKind == TypeKind.Submission && parent2.TypeKind == TypeKind.Submission)
1116(type, parameter, unused) => type.TypeKind == TypeKind.TypeParameter && (parameter is null || TypeSymbol.Equals(type, parameter, TypeCompareKind.ConsiderEverything2));
1127(type, parameterContainer, unused) => type.TypeKind == TypeKind.TypeParameter && (object)type.ContainingSymbol == (object)parameterContainer;
1136(type, parameters, unused) => type.TypeKind == TypeKind.TypeParameter && parameters.Contains((TypeParameterSymbol)type);
1145(type, _, _) => type.TypeKind == TypeKind.TypeParameter && type.ContainingSymbol is MethodSymbol;
1156private static readonly Func<TypeSymbol, object?, bool, bool> s_containsDynamicPredicate = (type, unused1, unused2) => type.TypeKind == TypeKind.Dynamic;
1194type.VisitType((TypeSymbol t, object? _, bool _) => t.TypeKind is TypeKind.Pointer or TypeKind.FunctionPointer, null) is object;
1222internal static TypeKind GetNonErrorTypeKindGuess(this TypeSymbol type)
1397case TypeKind.Struct:
1400case TypeKind.Array:
1401case TypeKind.Class:
1402case TypeKind.Delegate:
1403case TypeKind.Dynamic:
1404case TypeKind.Error:
1405case TypeKind.Interface:
1406case TypeKind.Pointer:
1407case TypeKind.FunctionPointer:
1410case TypeKind.Enum:
1413case TypeKind.TypeParameter:
1416case TypeKind.Submission:
1443case TypeKind.Pointer:
1444case TypeKind.FunctionPointer:
1446case TypeKind.Array:
1578return type.IsReferenceType && type.TypeKind != TypeKind.TypeParameter;
1586return type.IsValueType && type.TypeKind != TypeKind.TypeParameter;
1912if (taskType.TypeKind == TypeKind.Error)
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ExpressionCompiler.UnitTests (13)
GenerateMember\GenerateParameterizedMember\AbstractGenerateConversionService.cs (2)
26protected abstract bool TryInitializeImplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn);
27protected abstract bool TryInitializeExplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn);
Binding\Binder_Lookup.vb (35)
16Imports TypeKind = Microsoft.CodeAnalysis.TypeKind
580Case TypeKind.Class, TypeKind.Module, TypeKind.Structure, TypeKind.Delegate, TypeKind.Array, TypeKind.Enum
583Case TypeKind.Submission
586Case TypeKind.Interface
589Case TypeKind.TypeParameter
592Case TypeKind.Error
606Case TypeKind.Class, TypeKind.Structure, TypeKind.Delegate, TypeKind.Array, TypeKind.Enum
609Case TypeKind.Module
612Case TypeKind.Submission
615Case TypeKind.Interface
618Case TypeKind.TypeParameter
621Case TypeKind.Error
931Case TypeKind.Class, TypeKind.Module, TypeKind.Structure
936Case TypeKind.Interface
941Case TypeKind.TypeParameter
1092Case TypeKind.Class, TypeKind.Module, TypeKind.Structure
1104Case TypeKind.Interface
1116Case TypeKind.TypeParameter
1697Case TypeKind.Interface
1710Case TypeKind.TypeParameter
1964(container.TypeKind = TypeKind.Class OrElse container.TypeKind = TypeKind.Structure) AndAlso
Compilation\ClsComplianceChecker.vb (26)
186If symbol.TypeKind = TypeKind.Delegate Then
340ElseIf symbol.TypeKind = TypeKind.Enum Then
439If type.TypeKind = TypeKind.Delegate AndAlso type.IsImplicitlyDeclared AndAlso TryCast(type, NamedTypeSymbol)?.AssociatedSymbol Is symbol Then
591Case TypeKind.Array
593Case TypeKind.Error, TypeKind.TypeParameter
595Case TypeKind.Class, TypeKind.Structure, TypeKind.Interface, TypeKind.Delegate, TypeKind.Enum, TypeKind.Submission, TypeKind.Module
617Case TypeKind.Array
619Case TypeKind.Error, TypeKind.TypeParameter
621Case TypeKind.Class, TypeKind.Structure, TypeKind.Interface, TypeKind.Delegate, TypeKind.Enum, TypeKind.Submission, TypeKind.Module
636If type.TypeKind = TypeKind.Error Then
892Dim typeKind As TypeKind = xType.TypeKind
897If typeKind = TypeKind.Array Then
Symbols\Source\SourceNamedTypeSymbol.vb (39)
17Imports TypeKind = Microsoft.CodeAnalysis.TypeKind
240If TypeKind = TypeKind.Delegate Then
268ElseIf TypeKind = TypeKind.Enum Then
1110Case TypeKind.TypeParameter
1114Case TypeKind.Interface, TypeKind.Enum, TypeKind.Delegate, TypeKind.Structure, TypeKind.Module, TypeKind.Array ' array can't really occur
1118Case TypeKind.Error, TypeKind.Unknown
1121Case TypeKind.Class
1181Case TypeKind.TypeParameter
1185Case TypeKind.Unknown
1188Case TypeKind.Interface, TypeKind.Error
1232Case TypeKind.TypeParameter
1236Case TypeKind.Unknown
1239Case TypeKind.Interface, TypeKind.Error
1375Case TypeKind.Submission
1381Case TypeKind.Class
1384Case TypeKind.Interface
1387Case TypeKind.Enum
1390Case TypeKind.Structure
1393Case TypeKind.Delegate
1396Case TypeKind.Module
1498Debug.Assert(Me.TypeKind <> TypeKind.Interface)
1500If TypeKind = TypeKind.Enum Then
1503ElseIf TypeKind = TypeKind.Delegate Then
2178Case TypeKind.Class
2205Case TypeKind.Interface
2225Case TypeKind.Module
2260Dim defaultAutoLayoutSize = If(Me.TypeKind = TypeKind.Structure, 1, 0)
2391If Me.TypeKind = TypeKind.Module Then
2441If Me.TypeKind = TypeKind.Structure Then
2484If Me.TypeKind = TypeKind.Module Then
2609If Me.TypeKind = TypeKind.Class AndAlso Not Me.IsGenericType Then
Symbols\TypeSymbolExtensions.vb (46)
118Return type.TypeKind = TypeKind.Enum
140Return type.TypeKind = TypeKind.Class
146Return type.TypeKind = TypeKind.Structure
152Return type.TypeKind = TypeKind.Module
233Return type.TypeKind = TypeKind.Delegate
410Case TypeKind.Array, TypeKind.Delegate, TypeKind.Enum, TypeKind.Structure, TypeKind.Module
412Case TypeKind.Interface, TypeKind.TypeParameter, TypeKind.Unknown
414Case TypeKind.Error, TypeKind.Class, TypeKind.Submission
635Case TypeKind.Array
637Case TypeKind.TypeParameter
735fieldType.TypeKind = TypeKind.Enum
746If type.TypeKind = TypeKind.TypeParameter Then
761Return (type.TypeKind = TypeKind.TypeParameter) AndAlso
774Return (type.TypeKind = TypeKind.TypeParameter) AndAlso
790Private ReadOnly s_isTypeParameterFunc As Func(Of TypeSymbol, Object, Boolean) = Function(type, arg) (type.TypeKind = TypeKind.TypeParameter)
830Case TypeKind.Class,
831TypeKind.Struct,
832TypeKind.Interface,
833TypeKind.Enum,
834TypeKind.Delegate
845Case TypeKind.Submission
855Case TypeKind.Dynamic,
856TypeKind.TypeParameter,
857TypeKind.Submission,
858TypeKind.Enum,
859TypeKind.Module
863Case TypeKind.Class,
864TypeKind.Struct,
865TypeKind.Interface,
866TypeKind.Delegate,
867TypeKind.Error
883Case TypeKind.Array
1060If type.TypeKind = TypeKind.Class Then
1066If typeArgument.TypeKind = TypeKind.Delegate Then
1082If type.TypeKind = TypeKind.Delegate Then
1096If type.TypeKind = TypeKind.Delegate Then
1131If type.TypeKind = TypeKind.TypeParameter Then
1139If type.TypeKind = TypeKind.TypeParameter Then
Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator.ExpressionCompiler.UnitTests (2)