Revert six merged changes so the next commits re-apply them
Scaffolding for the examples, each later commit re-applying one change.
Semantic Diff
7 commits, drawn from their messages.
0308018d62161f515927225c44b78a665ad70a83..pr-8909Scaffolding for the examples, each later commit re-applying one change.
The signature arity mismatch error explained in a second sentence what its first sentence already states.
module M: { let f: (int, int) => int} = { let f = (x: int) => (y: int) => x + y}
Re-applies #8559 by @cristianoc for illustration.
module_sig_value_arity_mismatch fixtures in super_errors and Iface_value_arity_mismatch in super_errors_multi; this commit updates all five.The formatter deleted comments on dict pattern keys, inside empty dict patterns, in ...t and #...t patterns, and before the first or after the last row of a run of rows after a spread in a dict literal (#8820).
let f = d => switch d { | dict{"a" /* key */: b} => b | dict{/* empty */} => 0 | _ => 1 } let g = x => switch x { | .../* spread */ t => 0 | _ => 1 }
Re-applies #8850 by @cknitt for illustration.
A match on consecutive integers ending at 2147483647 compiled its upper bound as an exclusive comparison against 2147483648, which wraps to -2147483648 as a Lambda constant, so matching values fell through to the next case (#8716).
let top = x => switch x { | 2147483645 | 2147483646 | 2147483647 => true | _ => false }
Re-applies #8717 by @fhammerschmidt for illustration.
4294967295 and -1 are one value: a redundant one is reported as unused, and exhaustiveness diagnostics can change, as the updated intoverflow fixture shows.A match testing an optional field both for a value and for presence crashed the compiler or dropped a case (#8810), because the match compiler rewrote the field pattern Some(p) to p row by row, so one column mixed constants with None.
type r = {x?: int, y?: int} let f = (d: r) => switch d { | {x: 1} => 0 | {y: 2} => 0 | {x: ?None} => 1 | _ => 2 }
Fatal error: exception File "compiler/ml/matching.ml", line 1236, characters 9-15: Assertion failedtype r = {x?: int} let f = (d: r) => switch d { | {x: ?None} => 0 | {x: 1} => 1 | {x: ?Some(_)} => 2 }
f({x: 1}) returns 2f({x: 1}) returns 1Re-applies #8842 by @cknitt for illustration.
Some cost a nested-option check now? Only where a payload pattern needs it: a Some payload is read as is when every payload pattern of the division rejects the object that represents Some(None), and a presence test is dropped when the value test already sends undefined to the absent case.A character range pattern is expanded into one or-pattern alternative per character, and typing, the exhaustiveness and unused-case checks, default matrices and switch compilation each took time quadratic in the number of alternatives: a range over the CJK block ran out of memory (#8866).
let f = c => switch c { | '\u{100}' .. '\u{1100}' => 1 | _ => 0 }
(let (f/1001 = (function c/1002 (catch (catch (if (|| (>[int] c/1002 4352) (<[int] c/1002 256)) (exit 2) (exit 1)) with (2) 0) with (1) 1))) (makeblock module/exports f/1001))
/usr/bin/time -l bsc on the example, three runs/usr/bin/time -l bsc on the example, three runsRe-applies #8868 by @cknitt for illustration.
List.find. Groups, minima and int, char and string cells are now found by hashing, and the copy is skipped when nothing is renamed.tests/tests/src, the super_errors fixtures and the runtime.%raw, %ffi and %%raw with parsetree nodes%raw, %ffi and %%raw were extensions whose string payload the compiler recognized by name, with a constant Pconst_raw_source used only by them; #8624 moves extension-keyed language features to parsetree nodes. Through a PPX, a template payload lost its template marker, so its escapes were not decoded.
let f = %raw(`(a) => a`)%%raw("var x = 1")
Re-applies #8879 by @cknitt for illustration.
%raw, %ffi and %%raw extensions with the same v0 encoding as before; Ast_mapper_from0 reads them back into the nodes. The .cmi, .cmt and AST magic numbers are bumped.