obj["getData"]("text/plain").Stop warning 20 on calls of open JS object methods
๐ Bug fixtypecheckertests
Calling a method read from an open JS object type, such as obj["getData"]("text/plain") with obj: {..}, no longer reports warning 20 "this argument will not be used by the function". The method's type is a fresh type variable, which the warning took as a sign that the function never returns, but the call passes its arguments to the JS method. Calls whose function is a fresh type variable for other reasons, such as failwith("x")(1), still warn.
Example ReScript
@get external clipboardData: string => {..} = "clipboardData"let text = clipboardData("event")["getData"]("text/plain")
Diagnostic output
Before: Warning number 20 on "text/plain": this argument will not be used by the function. After: no warning.
๐ Bug fixFix warning 20 ("this argument will not be used by the function") firing on calls of methods of open JS object types, such as
- No effect
- Output: unchangedFormatting: unchangedFormats: nonePPX: unchangedEditor: unchanged
- Tests
- super_errors
tests/build_tests/+ super_errors/fixtures/unused_argument_object_method.res+ super_errors/expected/unused_argument_object_method.res.expected
- Changelog fragment changes/object-method-unused-argument.fix.md
- No committed generated JS changes
4 files ยท +30 โ1 ยท changelog 1 ยท typechecker 1 ยท tests 2
| A | changes/object-method-unused-argument.fix.md | +1 | โ0 |
| M | compiler/ml/typecore.ml | +12 | โ1 |
| A | tests/build_tests/super_errors/expected/unused_argument_object_method.res.expected | +10 | โ0 |
| A | tests/build_tests/super_errors/fixtures/unused_argument_object_method.res | +7 | โ0 |