@@ -623,7 +623,7 @@ LogicalResult Parser::convertExpressionTo(
623623 return diag;
624624 };
625625
626- if (auto exprOpType = exprType. dyn_cast <ast::OperationType>())
626+ if (auto exprOpType = dyn_cast<ast::OperationType>(exprType ))
627627 return convertOpExpressionTo (expr, exprOpType, type, emitConvertError);
628628
629629 // FIXME: Decide how to allow/support converting a single result to multiple,
@@ -638,7 +638,7 @@ LogicalResult Parser::convertExpressionTo(
638638 return success ();
639639
640640 // Handle tuple types.
641- if (auto exprTupleType = exprType. dyn_cast <ast::TupleType>())
641+ if (auto exprTupleType = dyn_cast<ast::TupleType>(exprType ))
642642 return convertTupleExpressionTo (expr, exprTupleType, type, emitConvertError,
643643 noteAttachFn);
644644
@@ -650,7 +650,7 @@ LogicalResult Parser::convertOpExpressionTo(
650650 function_ref<ast::InFlightDiagnostic()> emitErrorFn) {
651651 // Two operation types are compatible if they have the same name, or if the
652652 // expected type is more general.
653- if (auto opType = type. dyn_cast <ast::OperationType>()) {
653+ if (auto opType = dyn_cast<ast::OperationType>(type )) {
654654 if (opType.getName ())
655655 return emitErrorFn ();
656656 return success ();
@@ -702,7 +702,7 @@ LogicalResult Parser::convertTupleExpressionTo(
702702 function_ref<ast::InFlightDiagnostic()> emitErrorFn,
703703 function_ref<void(ast::Diagnostic &diag)> noteAttachFn) {
704704 // Handle conversions between tuples.
705- if (auto tupleType = type. dyn_cast <ast::TupleType>()) {
705+ if (auto tupleType = dyn_cast<ast::TupleType>(type )) {
706706 if (tupleType.size () != exprType.size ())
707707 return emitErrorFn ();
708708
@@ -2568,7 +2568,7 @@ Parser::createVariableDecl(StringRef name, SMRange loc, ast::Expr *initializer,
25682568 }
25692569
25702570 // Constraint types cannot be used when defining variables.
2571- if (type. isa <ast::ConstraintType, ast::RewriteType>()) {
2571+ if (isa<ast::ConstraintType, ast::RewriteType>(type )) {
25722572 return emitError (
25732573 loc, llvm::formatv (" unable to define variable of `{0}` type" , type));
25742574 }
@@ -2782,7 +2782,7 @@ Parser::createMemberAccessExpr(ast::Expr *parentExpr, StringRef name,
27822782FailureOr<ast::Type> Parser::validateMemberAccess (ast::Expr *parentExpr,
27832783 StringRef name, SMRange loc) {
27842784 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 )) {
27862786 if (name == ast::AllResultsMemberAccessExpr::getMemberName ())
27872787 return valueRangeTy;
27882788
@@ -2808,7 +2808,7 @@ FailureOr<ast::Type> Parser::validateMemberAccess(ast::Expr *parentExpr,
28082808 // operations. It returns a single value.
28092809 return valueTy;
28102810 }
2811- } else if (auto tupleType = parentType. dyn_cast <ast::TupleType>()) {
2811+ } else if (auto tupleType = dyn_cast<ast::TupleType>(parentType )) {
28122812 // Handle indexed results.
28132813 unsigned index = 0 ;
28142814 if (llvm::isDigit (name[0 ]) && !name.getAsInteger (/* Radix=*/ 10 , index) &&
@@ -2845,7 +2845,7 @@ FailureOr<ast::OperationExpr *> Parser::createOperationExpr(
28452845 for (ast::NamedAttributeDecl *attr : attributes) {
28462846 // Check for an attribute type, or a type awaiting resolution.
28472847 ast::Type attrType = attr->getValue ()->getType ();
2848- if (!attrType. isa <ast::AttributeType>()) {
2848+ if (!isa<ast::AttributeType>(attrType )) {
28492849 return emitError (
28502850 attr->getValue ()->getLoc (),
28512851 llvm::formatv (" expected `Attr` expression, but got `{0}`" , attrType));
@@ -3024,7 +3024,7 @@ LogicalResult Parser::validateOperationOperandsOrResults(
30243024 // ValueRange. This situations arises quite often with nested operation
30253025 // expressions: `op<my_dialect.foo>(op<my_dialect.bar>)`
30263026 if (singleTy == valueTy) {
3027- if (valueExprType. isa <ast::OperationType>()) {
3027+ if (isa<ast::OperationType>(valueExprType )) {
30283028 valueExpr = convertOpToValue (valueExpr);
30293029 continue ;
30303030 }
@@ -3048,7 +3048,7 @@ Parser::createTupleExpr(SMRange loc, ArrayRef<ast::Expr *> elements,
30483048 ArrayRef<StringRef> elementNames) {
30493049 for (const ast::Expr *element : elements) {
30503050 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 )) {
30523052 return emitError (
30533053 element->getLoc (),
30543054 llvm::formatv (" unable to build a tuple with `{0}` element" , eleTy));
@@ -3064,7 +3064,7 @@ FailureOr<ast::EraseStmt *> Parser::createEraseStmt(SMRange loc,
30643064 ast::Expr *rootOp) {
30653065 // Check that root is an Operation.
30663066 ast::Type rootType = rootOp->getType ();
3067- if (!rootType. isa <ast::OperationType>())
3067+ if (!isa<ast::OperationType>(rootType ))
30683068 return emitError (rootOp->getLoc (), " expected `Op` expression" );
30693069
30703070 return ast::EraseStmt::create (ctx, loc, rootOp);
@@ -3075,7 +3075,7 @@ Parser::createReplaceStmt(SMRange loc, ast::Expr *rootOp,
30753075 MutableArrayRef<ast::Expr *> replValues) {
30763076 // Check that root is an Operation.
30773077 ast::Type rootType = rootOp->getType ();
3078- if (!rootType. isa <ast::OperationType>()) {
3078+ if (!isa<ast::OperationType>(rootType )) {
30793079 return emitError (
30803080 rootOp->getLoc (),
30813081 llvm::formatv (" expected `Op` expression, but got `{0}`" , rootType));
@@ -3088,7 +3088,7 @@ Parser::createReplaceStmt(SMRange loc, ast::Expr *rootOp,
30883088 ast::Type replType = replExpr->getType ();
30893089
30903090 // Check that replExpr is an Operation, Value, or ValueRange.
3091- if (replType. isa <ast::OperationType>()) {
3091+ if (isa<ast::OperationType>(replType )) {
30923092 if (shouldConvertOpToValues)
30933093 replExpr = convertOpToValue (replExpr);
30943094 continue ;
@@ -3110,7 +3110,7 @@ Parser::createRewriteStmt(SMRange loc, ast::Expr *rootOp,
31103110 ast::CompoundStmt *rewriteBody) {
31113111 // Check that root is an Operation.
31123112 ast::Type rootType = rootOp->getType ();
3113- if (!rootType. isa <ast::OperationType>()) {
3113+ if (!isa<ast::OperationType>(rootType )) {
31143114 return emitError (
31153115 rootOp->getLoc (),
31163116 llvm::formatv (" expected `Op` expression, but got `{0}`" , rootType));
@@ -3125,9 +3125,9 @@ Parser::createRewriteStmt(SMRange loc, ast::Expr *rootOp,
31253125
31263126LogicalResult Parser::codeCompleteMemberAccess (ast::Expr *parentExpr) {
31273127 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 ))
31293129 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 ))
31313131 codeCompleteContext->codeCompleteTupleMemberAccess (tupleType);
31323132 return failure ();
31333133}
0 commit comments