Semantic Diff

#8728 Resolve FFI externals during type checking

1 commit, rendered from its record.

Summary

RangeCommitsChangelogAreasJS output changesFormatsFailed checks
4e11b25c68710759cf66690b89598b83d2a33fad..pr-87281๐Ÿ  Internalfrontendtypecheckersyntaxgentypetests0ast cmt0

Changelog draft

๐Ÿ  Internal
  • Keep resolved FFI specifications out of the parsetree, which now holds an external's primitive string as written. #8728

4e11b25c68710759cf66690b89598b83d2a33fad..pr-8728

0527e039c ยท Christoph Knittel ยท Oct 16, 2026 ยท #8728 discussion โ†—

Resolve FFI externals in the type checker, not the parsetree

๐Ÿ  Internalfrontendtypecheckersyntaxgentypetests

pval_prim is the primitive string as written, with its location. The frontend still checks each FFI external, but Typedecl gets its spec through Primitive.resolve_external, so the parsetree no longer depends on External_ffi_types.

๐Ÿ  InternalKeep resolved FFI specifications out of the parsetree, which now holds an external's primitive string as written. #8728

Review

No effect
Formatting: unchangedEditor: unchanged
Output
unchangedgenerated JS of the test suites is byte-identical
Formats
astcmt
PPX
unchangedan external's primitive string reaches v0 as before
Errors
none, the new fixture follows the warning_<NN> naming convention
Tests
syntax tests/syntax_tests/data/+ ast-mapping/Externals.res
super_errors tests/build_tests/+ super_errors/fixtures/warning_101_external_arg_attribute.res
ounit tests/ounit_tests/~ ounit_ast_mapper0_tests.ml~ ounit_string_literal_tests.ml
43 files ยท +480 โˆ’402 ยท changelog 1 ยท lambda 1 ยท compiler 1 ยท frontend 13 ยท gentype 1 ยท typechecker 17 ยท syntax 3 ยท tests 6
Achanges/resolve-ffi-externals.internal.md+1โˆ’0
Mcompiler/core/lam_compile_external_call.ml+1โˆ’1
Mcompiler/ext/config.ml+3โˆ’3
Mcompiler/frontend/ast_attributes.ml+4โˆ’5
Mcompiler/frontend/ast_attributes.mli+1โˆ’1
Mcompiler/frontend/ast_exp_handle_external.ml+4โˆ’7
Mcompiler/frontend/ast_external.ml+93โˆ’65
Mcompiler/frontend/ast_external.mli+10โˆ’0
Mcompiler/frontend/ast_external_mk.ml+40โˆ’17
Mcompiler/frontend/ast_external_mk.mli+19โˆ’7
Mcompiler/frontend/ast_external_process.ml+24โˆ’29
Mcompiler/frontend/ast_external_process.mli+12โˆ’13
Mcompiler/frontend/bs_ast_invariant.ml+21โˆ’25
Mcompiler/frontend/bs_ast_invariant.mli+15โˆ’2
Mcompiler/frontend/bs_builtin_ppx.ml+38โˆ’132
Mcompiler/frontend/ppx_entry.ml+4โˆ’2
Mcompiler/gentype/translation.ml+2โˆ’3
Mcompiler/ml/ast_helper.mli+1โˆ’1
Mcompiler/ml/ast_iterator.ml+2โˆ’3
Mcompiler/ml/ast_mapper.ml+1โˆ’1
Mcompiler/ml/ast_mapper_from0.ml+3โˆ’1
Mcompiler/ml/ast_mapper_to0.ml+1โˆ’8
Mcompiler/ml/external_ffi_types.ml+1โˆ’1
Mcompiler/ml/external_ffi_types.mli+1โˆ’1
Mcompiler/ml/outcometree.ml+7โˆ’1
Mcompiler/ml/parsetree.ml+6โˆ’13
Mcompiler/ml/pprintast.ml+1โˆ’6
Mcompiler/ml/primitive.ml+18โˆ’15
Mcompiler/ml/primitive.mli+20โˆ’2
Mcompiler/ml/printast.ml+1โˆ’5
Mcompiler/ml/printtyped.ml+1โˆ’5
Mcompiler/ml/typedecl.ml+23โˆ’9
Mcompiler/ml/typedtree.ml+1โˆ’1
Mcompiler/ml/typedtree.mli+1โˆ’1
Mcompiler/syntax/src/res_core.ml+2โˆ’1
Mcompiler/syntax/src/res_outcome_printer.ml+5โˆ’5
Mcompiler/syntax/src/res_printer.ml+2โˆ’4
Atests/build_tests/super_errors/expected/warning_101_external_arg_attribute.res.expected+26โˆ’0
Atests/build_tests/super_errors/fixtures/warning_101_external_arg_attribute.res+3โˆ’0
Mtests/ounit_tests/ounit_ast_mapper0_tests.ml+32โˆ’3
Mtests/ounit_tests/ounit_string_literal_tests.ml+7โˆ’3
Atests/syntax_tests/data/ast-mapping/Externals.res+11โˆ’0
Atests/syntax_tests/data/ast-mapping/expected/Externals.res.txt+11โˆ’0
with Claude Opus 5.5