60 references to ConstraintClauses
Microsoft.CodeAnalysis.CSharp (19)
Symbols\Source\SourceOrdinaryMethodSymbol.cs (6)
82ReportErrorIfHasConstraints(syntax.ConstraintClauses, diagnostics.DiagnosticBag); 165if (syntax.ConstraintClauses.Count > 0) 168syntax.ConstraintClauses[0].WhereKeyword, MessageID.IDS_OverrideWithConstraints, diagnostics); 171BindTypeParameterConstraintClauses(this, TypeParameters, syntax.TypeParameterList, syntax.ConstraintClauses, 1088syntax.ConstraintClauses, 1115syntax.ConstraintClauses);
Syntax.xml.Main.Generated.cs (1)
2059=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.ReturnType) ?? throw new ArgumentNullException("returnType"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), VisitList(node.ConstraintClauses), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken));
Syntax.xml.Syntax.Generated.cs (12)
12366if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) 12377public new MethodDeclarationSyntax WithAttributeLists(SyntaxList<AttributeListSyntax> attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 12379public new MethodDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 12380public MethodDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 12381public MethodDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, explicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 12382public MethodDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 12383public MethodDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 12385public new MethodDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 12388public new MethodDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, body, this.ExpressionBody, this.SemicolonToken); 12390public new MethodDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, expressionBody, this.SemicolonToken); 12392public new MethodDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, semicolonToken); 12405public MethodDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items));
Microsoft.CodeAnalysis.CSharp.Features (5)
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (1)
244constraintClauses: otherMethod.ConstraintClauses,
ConvertToExtension\ConvertToExtensionCodeRefactoringProvider.cs (3)
346if (extensionMethod.ConstraintClauses.Count == 0 || movedTypeParameterCount == 0) 347return extensionMethod.ConstraintClauses; 350return [.. extensionMethod.ConstraintClauses.Where(
Organizing\Organizers\MethodDeclarationOrganizer.cs (1)
37constraintClauses: syntax.ConstraintClauses,
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (6)
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (6)
1489symbol = LookupTypeParameterFromConstraintClause(model, methodDecl.ConstraintClauses[0], "T"); 1497symbol = LookupTypeParameterFromConstraintClause(model, methodDecl.ConstraintClauses[0], "U"); 1538symbol = LookupTypeParameterFromConstraintClause(model, methodDecl.ConstraintClauses[0], "U1"); 1540symbol = LookupTypeParameterFromConstraintClause(model, methodDecl.ConstraintClauses[0], "U2"); 1550symbol = LookupTypeParameterFromConstraintClause(model, methodDecl.ConstraintClauses[0], "U4"); 1552symbol = LookupTypeParameterFromConstraintClause(model, methodDecl.ConstraintClauses[0], "U3");
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (25)
Generated\Syntax.Test.xml.Generated.cs (2)
13432Assert.Equal(default, node.ConstraintClauses); 13436var newNode = node.WithAttributeLists(node.AttributeLists).WithModifiers(node.Modifiers).WithReturnType(node.ReturnType).WithExplicitInterfaceSpecifier(node.ExplicitInterfaceSpecifier).WithIdentifier(node.Identifier).WithTypeParameterList(node.TypeParameterList).WithParameterList(node.ParameterList).WithConstraintClauses(node.ConstraintClauses).WithBody(node.Body).WithExpressionBody(node.ExpressionBody).WithSemicolonToken(node.SemicolonToken);
Parsing\DeclarationParsingTests.cs (23)
2511Assert.Equal(0, ms.ConstraintClauses.Count); 2556Assert.Equal(0, ms.ConstraintClauses.Count); 2602Assert.Equal(0, ms.ConstraintClauses.Count); 2710Assert.Equal(0, ms.ConstraintClauses.Count); 2775Assert.Equal(0, ms.ConstraintClauses.Count); 2822Assert.Equal(0, ms.ConstraintClauses.Count); 2872Assert.Equal(0, ms.ConstraintClauses.Count); 3026Assert.Equal(0, ms.ConstraintClauses.Count); 3088Assert.Equal(0, ms.ConstraintClauses.Count); 3143Assert.Equal(0, ms.ConstraintClauses.Count); 3206Assert.Equal(0, ms.ConstraintClauses.Count); 3272Assert.Equal(0, ms.ConstraintClauses.Count); 3343Assert.Equal(0, ms.ConstraintClauses.Count); 3389Assert.Equal(0, ms.ConstraintClauses.Count); 3438Assert.Equal(1, ms.ConstraintClauses.Count); 3439Assert.NotEqual(default, ms.ConstraintClauses[0].WhereKeyword); 3440Assert.NotNull(ms.ConstraintClauses[0].Name); 3441Assert.Equal("b", ms.ConstraintClauses[0].Name.ToString()); 3442Assert.NotEqual(default, ms.ConstraintClauses[0].ColonToken); 3443Assert.False(ms.ConstraintClauses[0].ColonToken.IsMissing); 3444Assert.Equal(1, ms.ConstraintClauses[0].Constraints.Count); 3445Assert.Equal(SyntaxKind.TypeConstraint, ms.ConstraintClauses[0].Constraints[0].Kind()); 3446var typeBound = (TypeConstraintSyntax)ms.ConstraintClauses[0].Constraints[0];
Microsoft.CodeAnalysis.CSharp.Workspaces (5)
CodeGeneration\CSharpSyntaxGenerator.cs (5)
621if (method.ConstraintClauses.Count > 0) 623return RemoveNodes(method, method.ConstraintClauses); 1797if (method.ConstraintClauses.Count == 0) 1802method.ParameterList.GetTrailingTrivia().Add(SyntaxFactory.ElasticMarker).AddRange(method.ConstraintClauses.Last().GetTrailingTrivia()))); 1827MethodDeclarationSyntax method => method.WithConstraintClauses(WithTypeConstraints(method.ConstraintClauses, typeParameterName, kinds, isUnmanagedType, types)),