Skip to content

Commit 112186f

Browse files
committed
Fix printing of types for imported functions
Previously, the printer incorrectly reconstructed imported functions' types from their signatures instead of printing their types directly. This could cause the printer to print uses of types that were never defined and did not exist in the module. Fix the bug by printing imported functions' heap types directly.
1 parent 0d3c2ee commit 112186f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/passes/Print.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2846,7 +2846,7 @@ void PrintSExpression::visitImportedFunction(Function* curr) {
28462846
lastPrintedLocation = {0, 0, 0};
28472847
o << '(';
28482848
emitImportHeader(curr);
2849-
handleSignature(curr->getSig(), curr->name);
2849+
handleSignature(curr->type, curr->name);
28502850
o << ')';
28512851
o << maybeNewLine;
28522852
}

test/lit/passes/signature-refining.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@
918918

919919
;; CHECK: (type $8 (func (param funcref) (result (ref $C))))
920920

921-
;; CHECK: (import "binaryen-intrinsics" "call.without.effects" (func $no.side.effects (type $func.0) (param funcref) (result (ref null $A))))
921+
;; CHECK: (import "binaryen-intrinsics" "call.without.effects" (func $no.side.effects (type $6) (param funcref) (result (ref null $A))))
922922
(import "binaryen-intrinsics" "call.without.effects" (func $no.side.effects
923923
(param funcref)
924924
(result (ref null $A))

0 commit comments

Comments
 (0)