From the documentation:
"In many object-oriented languages, upcasting is implicit; in F#, the rules are slightly different. Upcasting is applied automatically when you pass arguments to methods on an object type. However, for let-bound functions in a module, upcasting is not automatic, unless the parameter type is declared as a flexible type. For more information, see Flexible Types (F#)."
If you'd use the following syntax:
let (x:#UIElement) = new TextBlock()
your code would use a flexible type (indicated by the #
) and it would compile. However, now you would get a warning:
"This construct causes code to be less generic than indicated by its type annotations. The type variable implied by the use of a '#', '_' or other type annotation at or near 'c:\path\Program.fs' has been constrained to be type 'TextBlock'."