Skip to content

Commit ca0292d

Browse files
weberlojroesch
authored andcommitted
[Relay] Add ADTs to text format (#3863)
* Getting closer to having ADT defs * ADT defs working probly * Match parsing basipally done * came to earth in a silver chrome UFO * match finished? * All tests but newest are passing * ADT constructors work now cleanup? * Cleanup round 1 * Cleanup round 2 * Cleanup round 3 * Cleanup round 4 * Cleanup round 6 * Cleanup round 7 * Lil grammar fix * Remove ANTLR Java files * Lint roller * Lint roller * Address feedback * Test completeness in match test * Remove unused imports * Lint roller * Switch to Rust-style ADT syntax * Lil fix * Add dummy `extern type` handler * Add type arg to test * Update prelude semantic version * Repair test * Fix graph var handling in match * Revert 's/graph_equal/is_unifiable' change
1 parent a103c4e commit ca0292d

File tree

14 files changed

+3059
-1458
lines changed

14 files changed

+3059
-1458
lines changed

include/tvm/relay/adt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ class MatchNode : public ExprNode {
264264
/*! \brief The match node clauses. */
265265
tvm::Array<Clause> clauses;
266266

267-
/*! \brief Should this match be complete (cover all cases)?
267+
/*! \brief Should this match be complete (cover all cases)?
268268
* If yes, the type checker will generate an error if there are any missing cases.
269269
*/
270270
bool complete;

include/tvm/relay/module.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ class ModuleNode : public RelayNode {
164164
*/
165165
TVM_DLL TypeData LookupDef(const std::string& var) const;
166166

167+
/*!
168+
* \brief Check if a global type definition exists
169+
* \param var The name of the global type definition.
170+
* \return Whether the definition exists.
171+
*/
172+
TVM_DLL bool HasDef(const std::string& var) const;
173+
167174
/*!
168175
* \brief Look up a constructor by its tag.
169176
* \param tag The tag for the constructor.

0 commit comments

Comments
 (0)