Skip to content

Turn some partial application warnings into hints#11338

Merged
lpw25 merged 2 commits intoocaml:trunkfrom
lpw25:make-partial-apply-hint
Jun 24, 2022
Merged

Turn some partial application warnings into hints#11338
lpw25 merged 2 commits intoocaml:trunkfrom
lpw25:make-partial-apply-hint

Conversation

@lpw25
Copy link
Copy Markdown
Contributor

@lpw25 lpw25 commented Jun 20, 2022

#9560 added some additional partial applications warnings when there is a type error. However, these would more naturally appear as a hint within the error message. This PR replaces those warnings with a hint.

@lpw25
Copy link
Copy Markdown
Contributor Author

lpw25 commented Jun 20, 2022

As shown in the tests, we go from:

Line 2, characters 10-15:
2 | let _ = g (f 1);;
              ^^^^^
Warning 5 [ignored-partial-application]: this function application is partial,
maybe some arguments are missing.
Line 2, characters 10-15:
2 | let _ = g (f 1);;
              ^^^^^
Error: This expression has type int -> int
       but an expression was expected of type int

to:

Line 2, characters 10-15:
2 | let _ = g (f 1);;
              ^^^^^
Error: This expression has type int -> int
       but an expression was expected of type int
  Hint: This function application is partial,
  maybe some arguments are missing.

Copy link
Copy Markdown
Contributor

@stedolan stedolan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a better way to do it than #9560. (Needs a Changes entry, though, or to be appended to 9560's)

@trefis
Copy link
Copy Markdown
Contributor

trefis commented Jun 21, 2022

Agreed, this is nicer.

@lpw25
Copy link
Copy Markdown
Contributor Author

lpw25 commented Jun 24, 2022

Changes entry added. I'll merge when the CI is green.

@lpw25 lpw25 merged commit 26e51ed into ocaml:trunk Jun 24, 2022
lukemaurer pushed a commit to lukemaurer/ocaml that referenced this pull request Jul 19, 2022
stedolan pushed a commit to stedolan/ocaml that referenced this pull request Sep 21, 2022
0b0aefb Turn some partial application warnings into hints (ocaml#11338) (ocaml#30)
2caa9ee Add [@tail] and [@nontail] annotations on applications to control tailcalls (ocaml#31)
9fb218a Update `promote` target to use the `one` machinery (ocaml#28)
b5ea912 Make empty types immediate
bc08236 Add failing test of an empty type being immediate
f2d439f Propagate escaping_context to Env locks to hint about errors (ocaml#25)
35569e1 Allow warning 68 to be controlled by attributes (ocaml#16)
28a6243 Allow type_argument to weaken return modes of expected function types (ocaml#24)
cdc728f Fix 'make alldepend' in otherlibs/dynlink
7807d18 make alldepend
2d6af2f Merge flambda-backend changes

git-subtree-dir: ocaml
git-subtree-split: 0b0aefb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants