@@ -623,7 +623,7 @@ LogicalResult Parser::convertExpressionTo(
623
623
return diag;
624
624
};
625
625
626
- if (auto exprOpType = exprType. dyn_cast <ast::OperationType>())
626
+ if (auto exprOpType = dyn_cast<ast::OperationType>(exprType ))
627
627
return convertOpExpressionTo (expr, exprOpType, type, emitConvertError);
628
628
629
629
// FIXME: Decide how to allow/support converting a single result to multiple,
@@ -638,7 +638,7 @@ LogicalResult Parser::convertExpressionTo(
638
638
return success ();
639
639
640
640
// Handle tuple types.
641
- if (auto exprTupleType = exprType. dyn_cast <ast::TupleType>())
641
+ if (auto exprTupleType = dyn_cast<ast::TupleType>(exprType ))
642
642
return convertTupleExpressionTo (expr, exprTupleType, type, emitConvertError,
643
643
noteAttachFn);
644
644
@@ -650,7 +650,7 @@ LogicalResult Parser::convertOpExpressionTo(
650
650
function_ref<ast::InFlightDiagnostic()> emitErrorFn) {
651
651
// Two operation types are compatible if they have the same name, or if the
652
652
// expected type is more general.
653
- if (auto opType = type. dyn_cast <ast::OperationType>()) {
653
+ if (auto opType = dyn_cast<ast::OperationType>(type )) {
654
654
if (opType.getName ())
655
655
return emitErrorFn ();
656
656
return success ();
@@ -702,7 +702,7 @@ LogicalResult Parser::convertTupleExpressionTo(
702
702
function_ref<ast::InFlightDiagnostic()> emitErrorFn,
703
703
function_ref<void(ast::Diagnostic &diag)> noteAttachFn) {
704
704
// Handle conversions between tuples.
705
- if (auto tupleType = type. dyn_cast <ast::TupleType>()) {
705
+ if (auto tupleType = dyn_cast<ast::TupleType>(type )) {
706
706
if (tupleType.size () != exprType.size ())
707
707
return emitErrorFn ();
708
708
@@ -2568,7 +2568,7 @@ Parser::createVariableDecl(StringRef name, SMRange loc, ast::Expr *initializer,
2568
2568
}
2569
2569
2570
2570
// Constraint types cannot be used when defining variables.
2571
- if (type. isa <ast::ConstraintType, ast::RewriteType>()) {
2571
+ if (isa<ast::ConstraintType, ast::RewriteType>(type )) {
2572
2572
return emitError (
2573
2573
loc, llvm::formatv (" unable to define variable of `{0}` type" , type));
2574
2574
}
@@ -2782,7 +2782,7 @@ Parser::createMemberAccessExpr(ast::Expr *parentExpr, StringRef name,
2782
2782
FailureOr<ast::Type> Parser::validateMemberAccess (ast::Expr *parentExpr,
2783
2783
StringRef name, SMRange loc) {
2784
2784
ast::Type parentType = parentExpr->getType ();
2785
- if (ast::OperationType opType = parentType. dyn_cast <ast::OperationType>()) {
2785
+ if (ast::OperationType opType = dyn_cast<ast::OperationType>(parentType )) {
2786
2786
if (name == ast::AllResultsMemberAccessExpr::getMemberName ())
2787
2787
return valueRangeTy;
2788
2788
@@ -2808,7 +2808,7 @@ FailureOr<ast::Type> Parser::validateMemberAccess(ast::Expr *parentExpr,
2808
2808
// operations. It returns a single value.
2809
2809
return valueTy;
2810
2810
}
2811
- } else if (auto tupleType = parentType. dyn_cast <ast::TupleType>()) {
2811
+ } else if (auto tupleType = dyn_cast<ast::TupleType>(parentType )) {
2812
2812
// Handle indexed results.
2813
2813
unsigned index = 0 ;
2814
2814
if (llvm::isDigit (name[0 ]) && !name.getAsInteger (/* Radix=*/ 10 , index) &&
@@ -2845,7 +2845,7 @@ FailureOr<ast::OperationExpr *> Parser::createOperationExpr(
2845
2845
for (ast::NamedAttributeDecl *attr : attributes) {
2846
2846
// Check for an attribute type, or a type awaiting resolution.
2847
2847
ast::Type attrType = attr->getValue ()->getType ();
2848
- if (!attrType. isa <ast::AttributeType>()) {
2848
+ if (!isa<ast::AttributeType>(attrType )) {
2849
2849
return emitError (
2850
2850
attr->getValue ()->getLoc (),
2851
2851
llvm::formatv (" expected `Attr` expression, but got `{0}`" , attrType));
@@ -3024,7 +3024,7 @@ LogicalResult Parser::validateOperationOperandsOrResults(
3024
3024
// ValueRange. This situations arises quite often with nested operation
3025
3025
// expressions: `op<my_dialect.foo>(op<my_dialect.bar>)`
3026
3026
if (singleTy == valueTy) {
3027
- if (valueExprType. isa <ast::OperationType>()) {
3027
+ if (isa<ast::OperationType>(valueExprType )) {
3028
3028
valueExpr = convertOpToValue (valueExpr);
3029
3029
continue ;
3030
3030
}
@@ -3048,7 +3048,7 @@ Parser::createTupleExpr(SMRange loc, ArrayRef<ast::Expr *> elements,
3048
3048
ArrayRef<StringRef> elementNames) {
3049
3049
for (const ast::Expr *element : elements) {
3050
3050
ast::Type eleTy = element->getType ();
3051
- if (eleTy. isa <ast::ConstraintType, ast::RewriteType, ast::TupleType>()) {
3051
+ if (isa<ast::ConstraintType, ast::RewriteType, ast::TupleType>(eleTy )) {
3052
3052
return emitError (
3053
3053
element->getLoc (),
3054
3054
llvm::formatv (" unable to build a tuple with `{0}` element" , eleTy));
@@ -3064,7 +3064,7 @@ FailureOr<ast::EraseStmt *> Parser::createEraseStmt(SMRange loc,
3064
3064
ast::Expr *rootOp) {
3065
3065
// Check that root is an Operation.
3066
3066
ast::Type rootType = rootOp->getType ();
3067
- if (!rootType. isa <ast::OperationType>())
3067
+ if (!isa<ast::OperationType>(rootType ))
3068
3068
return emitError (rootOp->getLoc (), " expected `Op` expression" );
3069
3069
3070
3070
return ast::EraseStmt::create (ctx, loc, rootOp);
@@ -3075,7 +3075,7 @@ Parser::createReplaceStmt(SMRange loc, ast::Expr *rootOp,
3075
3075
MutableArrayRef<ast::Expr *> replValues) {
3076
3076
// Check that root is an Operation.
3077
3077
ast::Type rootType = rootOp->getType ();
3078
- if (!rootType. isa <ast::OperationType>()) {
3078
+ if (!isa<ast::OperationType>(rootType )) {
3079
3079
return emitError (
3080
3080
rootOp->getLoc (),
3081
3081
llvm::formatv (" expected `Op` expression, but got `{0}`" , rootType));
@@ -3088,7 +3088,7 @@ Parser::createReplaceStmt(SMRange loc, ast::Expr *rootOp,
3088
3088
ast::Type replType = replExpr->getType ();
3089
3089
3090
3090
// Check that replExpr is an Operation, Value, or ValueRange.
3091
- if (replType. isa <ast::OperationType>()) {
3091
+ if (isa<ast::OperationType>(replType )) {
3092
3092
if (shouldConvertOpToValues)
3093
3093
replExpr = convertOpToValue (replExpr);
3094
3094
continue ;
@@ -3110,7 +3110,7 @@ Parser::createRewriteStmt(SMRange loc, ast::Expr *rootOp,
3110
3110
ast::CompoundStmt *rewriteBody) {
3111
3111
// Check that root is an Operation.
3112
3112
ast::Type rootType = rootOp->getType ();
3113
- if (!rootType. isa <ast::OperationType>()) {
3113
+ if (!isa<ast::OperationType>(rootType )) {
3114
3114
return emitError (
3115
3115
rootOp->getLoc (),
3116
3116
llvm::formatv (" expected `Op` expression, but got `{0}`" , rootType));
@@ -3125,9 +3125,9 @@ Parser::createRewriteStmt(SMRange loc, ast::Expr *rootOp,
3125
3125
3126
3126
LogicalResult Parser::codeCompleteMemberAccess (ast::Expr *parentExpr) {
3127
3127
ast::Type parentType = parentExpr->getType ();
3128
- if (ast::OperationType opType = parentType. dyn_cast <ast::OperationType>())
3128
+ if (ast::OperationType opType = dyn_cast<ast::OperationType>(parentType ))
3129
3129
codeCompleteContext->codeCompleteOperationMemberAccess (opType);
3130
- else if (ast::TupleType tupleType = parentType. dyn_cast <ast::TupleType>())
3130
+ else if (ast::TupleType tupleType = dyn_cast<ast::TupleType>(parentType ))
3131
3131
codeCompleteContext->codeCompleteTupleMemberAccess (tupleType);
3132
3132
return failure ();
3133
3133
}
0 commit comments