Dmitry Sevastianov
Dmitry Sevastianov

Reputation: 401

How do I create type for array of ProvidedType?

How do I create type for array of ProvidedType? In other words, what is an alternative to MakeArrayType on generic Type class?

EDIT: The issue is that when I'm trying MakeArrayType, TP fails.

Here is an example to reproduce the error: https://gist.github.com/dsevastianov/46d1a8495c4af46a9875

Client fails with "The operation 'UnderlyingSystemType' on item 'Birch[]' should not be called on provided type, member or parameter"

Upvotes: 3

Views: 123

Answers (1)

kvb
kvb

Reputation: 55184

This is a bug in ProvidedTypes.fs. Just ensure that GetUnderlyingSystemType is implemented for the ProvidedSymbolType class. This seems to work fine:

override this.UnderlyingSystemType = 
    match kind with 
    | SymbolKind.SDArray
    | SymbolKind.Array _
    | SymbolKind.Pointer
    | SymbolKind.FSharpTypeAbbreviation _
    | SymbolKind.ByRef -> upcast this
    | SymbolKind.Generic gty -> gty.UnderlyingSystemType 

Upvotes: 2

Related Questions