Simple toy Dialect error: ‘DenseElementsAttr’ has not been declared

Hi, I build a simple dialect from toy language. With follow .td code

include "mlir/IR/OpBase.td"
include "mlir/IR/FunctionInterfaces.td"
include "mlir/IR/SymbolInterfaces.td"
include "mlir/Interfaces/SideEffectInterfaces.td"

def Toy_Dialect : Dialect {
    let name = "toy";
    let summary = "The Toy Dialect.";
    let description = [{
        The `toy` dialect is for testing and demonstrating.
    }];
    let cppNamespace = "::buddy::toy";
}

class Toy_Op<string mnemonic, list<Trait> traits = []> :
    Op<Toy_Dialect, mnemonic, traits>;

def ConstantOp : Toy_Op<"constant",  [NoSideEffect]> {
  let summary = "constant";
  let description = [{
    Constant operation turns a literal into an SSA value. The data is attached
    to the operation as an attribute. For example:

    ```mlir
      %0 = toy.constant dense<[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]>
                        : tensor<2x3xf64>
    ```
  }];

  let arguments = (ins F64ElementsAttr:$value);
  let results = (outs F64Tensor);
  let hasCustomAssemblyFormat = 1;

  let builders = [
    // Build a constant with a given constant tensor value.
    OpBuilder<(ins "DenseElementsAttr":$value), [{
      build($_builder, $_state, value.getType(), value);
    }]>,

    // Build a constant with a given constant floating-point value.
    OpBuilder<(ins "double":$value)>
  ];

  let hasVerifier = 1;
}

WIth error

ToyOps.h.inc:87:86: error: ‘DenseElementsAttr’ has not been declared
   static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, DenseElementsAttr value);

how to debug?

I change DenseElementsAttr to ::mlir::DenseElementsAttr and build success. Confused.

The inc files generated are not standalone/ODS doesn’t know where they’ll be included C++ side. Using fully qualified names there is best in general, but we also had some instances where the inc file was included inside a specific namespace and that was how the user expected to use it. Aim for the former here as that will be least surprising in general.