Index: src/ResolvExpr/EraseWith.cpp
===================================================================
--- src/ResolvExpr/EraseWith.cpp	(revision 72b518fc0f393f86bf6bb43b0dd79189e24e9cf3)
+++ src/ResolvExpr/EraseWith.cpp	(revision 72b518fc0f393f86bf6bb43b0dd79189e24e9cf3)
@@ -0,0 +1,46 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// EraseWith.cpp -- After resolution, erase all with constructs.
+//
+// Author           : Andrew Beach
+// Created On       : Sun Oct  8  9:42:00 2023
+// Last Modified By : Andrew Beach
+// Last Modified On : Sun Oct  8 10:03:00 2023
+// Update Count     : 0
+//
+
+#include "EraseWith.hpp"
+
+#include "AST/Decl.hpp"
+#include "AST/Pass.hpp"
+#include "AST/Stmt.hpp"
+
+namespace ResolvExpr {
+
+namespace {
+
+struct WithEraser {
+	ast::FunctionDecl const * postvisit( ast::FunctionDecl const * decl ) {
+		if ( decl->withExprs.empty() ) return decl;
+		auto mutDecl = mutate( decl );
+		mutDecl->withExprs.clear();
+		return mutDecl;
+	}
+
+	ast::Stmt const * postvisit( ast::DeclStmt const * stmt ) {
+		if ( auto decl = stmt->decl.as<ast::WithStmt>() ) return decl->stmt;
+		return stmt;
+	}
+};
+
+} // namespace
+
+void eraseWith( ast::TranslationUnit & translationUnit ) {
+	ast::Pass<WithEraser>::run( translationUnit );
+}
+
+} // namespace ResolvExpr
Index: src/ResolvExpr/EraseWith.hpp
===================================================================
--- src/ResolvExpr/EraseWith.hpp	(revision 72b518fc0f393f86bf6bb43b0dd79189e24e9cf3)
+++ src/ResolvExpr/EraseWith.hpp	(revision 72b518fc0f393f86bf6bb43b0dd79189e24e9cf3)
@@ -0,0 +1,29 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// EraseWith.hpp -- After resolution, erase all with constructs.
+//
+// Author           : Andrew Beach
+// Created On       : Sun Oct  8  9:36:00 2023
+// Last Modified By : Andrew Beach
+// Last Modified On : Sun Oct  8  9:47:00 2023
+// Update Count     : 0
+//
+
+#pragma once
+
+namespace ast {
+	class TranslationUnit;
+}
+
+namespace ResolvExpr {
+
+void eraseWith( ast::TranslationUnit & translationUnit );
+/// Remove withExprs from functions and any WithStmt nodes.
+/// This must be done after all resolution that needs to see the names from
+/// a with. We put it after the last pass to use WithSymbolTable.
+
+}
Index: src/ResolvExpr/module.mk
===================================================================
--- src/ResolvExpr/module.mk	(revision c7616dd57b3796b571bd770e6fa558a361be598a)
+++ src/ResolvExpr/module.mk	(revision 72b518fc0f393f86bf6bb43b0dd79189e24e9cf3)
@@ -72,5 +72,7 @@
 	ResolvExpr/AlternativePrinter.h \
 	ResolvExpr/CandidatePrinter.cpp \
-	ResolvExpr/CandidatePrinter.hpp
+	ResolvExpr/CandidatePrinter.hpp \
+	ResolvExpr/EraseWith.cpp \
+	ResolvExpr/EraseWith.hpp
 
 SRCDEMANGLE += $(SRC_RESOLVEXPR)
