Add a typeName() method to each type for error printing purposes.
Test: compiles with mma
Change-Id: I1283c395440282fde1106ad47aa185bdeda75880
diff --git a/Type.cpp b/Type.cpp
index 924caed..e3825db 100644
--- a/Type.cpp
+++ b/Type.cpp
@@ -78,6 +78,10 @@
return false;
}
+std::string Type::typeName() const {
+ return "";
+}
+
const ScalarType *Type::resolveToScalarType() const {
return NULL;
}
@@ -431,8 +435,10 @@
TemplatedType::TemplatedType() : mElementType(nullptr) {
}
+
void TemplatedType::setElementType(Type *elementType) {
CHECK(mElementType == nullptr); // can only be set once.
+ CHECK(isCompatibleElementType(elementType));
mElementType = elementType;
}