Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning 5 and a typing error on local open #10939

Closed
hyphenrf opened this issue Jan 23, 2022 · 3 comments
Closed

Warning 5 and a typing error on local open #10939

hyphenrf opened this issue Jan 23, 2022 · 3 comments

Comments

@hyphenrf
Copy link

minimal example:

let rec product xs = (*(* uncomment me for a bug: *) let open Seq in *)
  match xs () with
  | Seq.Nil -> 1
  | Cons(0, _) -> 0
  | Cons(x, xs) -> x * product xs

I don't think this is normal behaviour?
Tested on 4.14, and trunk. Behaviour doesn't happen on 4.13.1

@hyphenrf
Copy link
Author

Here's the specific error:

File "test.ml", line 11, characters 23-33:
11 |   | Cons(x, xs) -> x * product xs
                            ^^^^^^^^^^
Warning 5 [ignored-partial-application]: this function application is partial,
maybe some arguments are missing.
File "test.ml", line 11, characters 23-33:
11 |   | Cons(x, xs) -> x * product xs
                            ^^^^^^^^^^
Error: This expression has type 'a Seq.t -> (int * 'a) Seq.t
       but an expression was expected of type int

@nojb
Copy link
Contributor

nojb commented Jan 23, 2022

This is not a bug, it is due to the introduction of Seq.product in 4.14 (see #10583).

@hyphenrf
Copy link
Author

hyphenrf commented Jan 23, 2022

oh of course, and the local open shadows the recursive call. My bad!

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

No branches or pull requests

2 participants