Closed
Description
Examples run in the playground, with v11.1.0.
Consider the following snippet:
module M = {
type t = {
id: string,
value?: int,
}
}
open M
let value = [{id: "id"}]
Pasting this example code into the playground successfully compiles, but with a warning:
[W] Line 8, column 0:
unused open M.
Yet, if we remove this 'unused' open,
module M = {
type t = {
id: string,
value?: int,
}
}
let value = [{id: "id"}]
we get a compiler error (as expected by module scoping)
[E] Line 8, column 14:
The record field id can't be found.
Interestingly, the warning disappears if remove the value field:
module M = {
type t = {
id: string,
}
}
open M
let value = [{id: "id"}]
or pass a value for it:
module M = {
type t = {
id: string,
value?: int
}
}
open M
let value = [{id: "id", value: 1}]