HomePhabricator

[mlir][Python] Add casting constructor to Type and Attribute.

Authored by stellaraccident on May 2 2021, 3:15 PM.

Description

[mlir][Python] Add casting constructor to Type and Attribute.

  • This makes them consistent with custom types/attributes, whose constructors will do a type checked conversion. Of course, the base classes can represent everything so never error.
  • More importantly, this makes it possible to subclass Type and Attribute out of tree in sensible ways.

Differential Revision: https://reviews.llvm.org/D101734