I have a class called Panel (think glass glass) that implements IPane:
type IPane =
abstract PaneNumber : int with get, set
abstract Thickness : float<m> with get, set
abstract ComponentNumber : int with get, set
abstract Spectra : IGlassDataValues with get, set
...
type Pane(paneNumber, componentNumber, spectra, ...) =
let mutable p = paneNumber
let mutable n = componentNumber
let mutable s = spectra
...
interface IPane with
member this.PaneNumber
with get() = p
and set(value) = p <- value
member this.ComponentNumber
with get() = n
and set(value) = n <- value
member this.Spectra
with get() = s
and set(value) = s <- value
...
I create a list of panels (list of panels):
let p = [ p1; p2 ]
however, I need to pass this to the IPane list, as this is the type of parameter in another function. The following code throws an error:
let p = [ p1; p2 ] :> IPane list
'Type constraint mismatch. The type
Pane list
is not compatible with type
IPane list
The type 'IPane' does not match the type 'Pane'
This is confusing as the panel implements IPane. Simply moving the Panel list object as a parameter to the desired function also causes an error.
How to make a list of panels a list of IPane?
source
share