Can SRTP use internal members?

Viewed 60

I know that the implementation of inline code can't use internal/private code. However, it also seems, surprisingly to me, that I can't even pass internal types to inlined functions using SRTP (statically resolved type parameters).

Consider this:

type internal A = { A: int }

let inline f (x: ^a) =
  (^a: (member A: _) x)

let a = { A = 0 }

let x = f a

It fails with a compile error on the last a:

enter image description here

Removing internal from the definition of A fixes the error.

Is this intentional? Is there any way to make this work while keeping A internal, apart from copying to an anonymous record (e.g. replacing a with {| a with __ = () |})?

0 Answers
Related