Index: src/AST/Decl.hpp
===================================================================
--- src/AST/Decl.hpp	(revision 312029a731fd1bf1cdd24d3e1d75abf51eb09d71)
+++ src/AST/Decl.hpp	(revision aeb5d0df40d6c1725a4d281a07385c12b9694732)
@@ -10,6 +10,6 @@
 // Created On       : Thu May 9 10:00:00 2019
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Dec 11 08:20:20 2019
-// Update Count     : 16
+// Last Modified On : Fri Dec 13 17:38:33 2019
+// Update Count     : 29
 //
 
@@ -20,4 +20,5 @@
 #include <unordered_map>
 #include <vector>
+#include <algorithm>
 
 #include "FunctionSpec.hpp"
@@ -27,7 +28,7 @@
 #include "ParseNode.hpp"
 #include "StorageClasses.hpp"
-#include "TypeVar.hpp"
 #include "Visitor.hpp"
-#include "Parser/ParseNode.h"  // for DeclarationNode::Aggregate
+#include "Common/utility.h"
+#include "Common/SemanticError.h"						// error_str
 
 // Must be included in *all* AST classes; should be #undef'd at the end of the file
@@ -125,5 +126,5 @@
 	std::vector< ptr<Expr> > withExprs;
 
-	FunctionDecl( const CodeLocation & loc, const std::string &name, FunctionType * type,
+	FunctionDecl( const CodeLocation & loc, const std::string & name, FunctionType * type,
 		CompoundStmt * stmts, Storage::Classes storage = {}, Linkage::Spec linkage = Linkage::C,
 		std::vector<ptr<Attribute>>&& attrs = {}, Function::Specs fs = {})
@@ -136,5 +137,5 @@
 	bool has_body() const { return stmts; }
 
-	const DeclWithType * accept( Visitor &v ) const override { return v.visit( this ); }
+	const DeclWithType * accept( Visitor & v ) const override { return v.visit( this ); }
 private:
 	FunctionDecl * clone() const override { return new FunctionDecl( *this ); }
@@ -163,6 +164,8 @@
 /// Cforall type variable: `dtype T`
 class TypeDecl final : public NamedTypeDecl {
-public:
-	TypeVar::Kind kind;
+  public:
+	enum Kind { Dtype, Otype, Ftype, Ttype, NUMBER_OF_KINDS };
+
+	Kind kind;
 	bool sized;
 	ptr<Type> init;
@@ -170,23 +173,21 @@
 	/// Data extracted from a type decl
 	struct Data {
-		TypeVar::Kind kind;
+		Kind kind;
 		bool isComplete;
 
-		Data() : kind( (TypeVar::Kind)-1 ), isComplete( false ) {}
+		Data() : kind( NUMBER_OF_KINDS ), isComplete( false ) {}
 		Data( const TypeDecl * d ) : kind( d->kind ), isComplete( d->sized ) {}
-		Data( TypeVar::Kind k, bool c ) : kind( k ), isComplete( c ) {}
+		Data( Kind k, bool c ) : kind( k ), isComplete( c ) {}
 		Data( const Data & d1, const Data & d2 )
-		: kind( d1.kind ), isComplete( d1.isComplete || d2.isComplete ) {}
-
-		bool operator== ( const Data & o ) const {
-			return kind == o.kind && isComplete == o.isComplete;
-		}
-		bool operator!= ( const Data & o ) const { return !(*this == o); }
+			: kind( d1.kind ), isComplete( d1.isComplete || d2.isComplete ) {}
+
+		bool operator==( const Data & o ) const { return kind == o.kind && isComplete == o.isComplete; }
+		bool operator!=( const Data & o ) const { return !(*this == o); }
 	};
 
-	TypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, Type* b,
-		TypeVar::Kind k, bool s, Type* i = nullptr )
-	: NamedTypeDecl( loc, name, storage, b ), kind( k ), sized( k == TypeVar::Ttype || s ),
-	  init( i ) {}
+	TypeDecl( const CodeLocation & loc, const std::string & name, Storage::Classes storage, Type * b,
+			  Kind k, bool s, Type * i = nullptr )
+		: NamedTypeDecl( loc, name, storage, b ), kind( k ), sized( k == Ttype || s ),
+		init( i ) {}
 
 	const char * typeString() const override;
@@ -198,5 +199,5 @@
 
 	const Decl * accept( Visitor & v ) const override { return v.visit( this ); }
-private:
+  private:
 	TypeDecl * clone() const override { return new TypeDecl{ *this }; }
 	MUTATE_FRIEND
@@ -343,10 +344,10 @@
 	ptr<AsmStmt> stmt;
 
-	AsmDecl( const CodeLocation & loc, AsmStmt *stmt )
+	AsmDecl( const CodeLocation & loc, AsmStmt * stmt )
 	: Decl( loc, "", {}, {} ), stmt(stmt) {}
 
-	const AsmDecl * accept( Visitor &v ) const override { return v.visit( this ); }
-private:
-	AsmDecl *clone() const override { return new AsmDecl( *this ); }
+	const AsmDecl * accept( Visitor & v ) const override { return v.visit( this ); }
+private:
+	AsmDecl * clone() const override { return new AsmDecl( *this ); }
 	MUTATE_FRIEND
 };
@@ -360,5 +361,5 @@
 	: Decl( loc, "", {}, {} ), cond( condition ), msg( msg ) {}
 
-	const StaticAssertDecl * accept( Visitor &v ) const override { return v.visit( this ); }
+	const StaticAssertDecl * accept( Visitor & v ) const override { return v.visit( this ); }
 private:
 	StaticAssertDecl * clone() const override { return new StaticAssertDecl( *this ); }
