Bogus error "Duplicate definition of value" from F # compiler

The F # compiler sometimes rejects my code with a compile-time error of the form Duplicate definition of value fooindicating the definition as follows:

let foo = ref 0

although this is not a duplicate definition, because there are no other definitions in the entire file foo. Why is this happening?

+5
source share
1 answer

This happens when you also define a function get_foo:

let get_foo() = !foo

because the definition foocreates a property that implements its own method get_foo, so a conflict arises. The F # compiler gets confused by this and generates a false "redefinition error".

Microsoft, , (VS11) F #.

+8

All Articles