Index: src/AST/SymbolTable.cpp
===================================================================
--- src/AST/SymbolTable.cpp	(revision 0c327cee778443a440104253db33557cee4d2a92)
+++ src/AST/SymbolTable.cpp	(revision 8315947b914ae5bb9508eeafa64f85f406f80c05)
@@ -419,14 +419,32 @@
 void SymbolTable::addWith( const std::vector< ptr<Expr> > & withExprs, const Decl * withStmt ) {
 	for ( const Expr * expr : withExprs ) {
-		if ( ! expr->result ) continue;
-		const Type * resTy = expr->result->stripReferences();
-		auto aggrType = dynamic_cast< const BaseInstType * >( resTy );
-		assertf( aggrType, "WithStmt expr has non-aggregate type: %s",
-			toString( expr->result ).c_str() );
-		const AggregateDecl * aggr = aggrType->aggr();
-		assertf( aggr, "WithStmt has null aggregate from type: %s",
-			toString( expr->result ).c_str() );
-
-		addMembers( aggr, expr, OnConflict::deleteWith( withStmt ) );
+		if ( expr->result ) {
+			const Type * resTy = expr->result->stripReferences();
+			auto aggrType = dynamic_cast< const BaseInstType * >( resTy );
+			assertf( aggrType, "WithStmt expr has non-aggregate type: %s",
+				toString( expr->result ).c_str() );
+			const AggregateDecl * aggr = aggrType->aggr();
+			assertf( aggr, "WithStmt has null aggregate from type: %s",
+				toString( expr->result ).c_str() );
+
+			addMembers( aggr, expr, OnConflict::deleteWith( withStmt ) );
+		} else {
+			auto typeExpr = dynamic_cast< const ast::TypeExpr *>( expr );
+			if ( !typeExpr ) continue;
+			auto declEnumInst = typeExpr->type.as<ast::EnumInstType>();
+			// assertf( declEnumInst,  "WithStmt expr unsupprot type expression: %s",
+			// 	toString( typeExpr->type ).c_str());
+			if ( !declEnumInst ) continue;
+			
+			const EnumDecl * aggr = declEnumInst->aggr();
+			// assertf( aggr, "WithStmt has null aggregate from type: %s",
+			// 	toString( typeExpr ).c_str() );
+			// addMembers( aggr, expr, OnConflict::deleteWith( withStmt ) );
+			if ( !aggr ) {
+				aggr = lookupEnum( declEnumInst->name );
+				assert( aggr );
+			}
+			addMembers( aggr, expr, OnConflict::deleteWith( withStmt ) );
+		}
 	}
 }
@@ -800,5 +818,6 @@
 		if ( auto rty = dynamic_cast<const BaseInstType *>( t ) ) {
 			if ( ! dynamic_cast<const StructInstType *>(rty)
-				&& ! dynamic_cast<const UnionInstType *>(rty) ) continue;
+				&& ! dynamic_cast<const UnionInstType *>(rty)
+				&& ! dynamic_cast<const EnumInstType *>(rty) ) continue;
 			ResolvExpr::Cost cost = ResolvExpr::Cost::zero;
 			ast::ptr<ast::TypeSubstitution> tmp = expr->env;
