Skip to content

Instantly share code, notes, and snippets.

@dsyme
Created June 8, 2020 12:13
Show Gist options
  • Save dsyme/9606cd38002295eb7ff1f28c3155df80 to your computer and use it in GitHub Desktop.
Save dsyme/9606cd38002295eb7ff1f28c3155df80 to your computer and use it in GitHub Desktop.
namespace FSharpBug9201
module CreateLockup =
//let inline castInternal< ^a, ^b when (^a or ^b) : (static member createFrom : ^a -> ^b)> (v: ^a): ^b =
// ((^a or ^b) : (static member createFrom : ^a -> ^b) v)
//let inline cast x: TestItemSeq =
// castInternal x
/// This code seem excessive, but is needed to cause VS IDE to spin forever, stop showing tooltips and coloring,
/// and lock on "unloading project" when you close the IDE.
let ofObj (someObj: obj)=
match someObj with
| :? TestItemSeq as x -> TestItemSeq.createFrom x |> Some
| :? option<TestItemSeq> as x -> TestItemSeq.createFrom x |> Some
| :? list<TestItemSeq> as sq -> TestItemSeq.createFrom sq |> Some
| :? array<TestItemSeq> as sq -> TestItemSeq.createFrom sq |> Some
| :? seq<TestItemSeq> as sq -> TestItemSeq.createFrom sq |> Some
// empty
| :? unit -> Some TestItemSeq.Empty
// TestItem
| :? TestItem as item -> Some(Singleton item)
| :? option<TestItem> as item -> TestItemSeq.createFrom item |> Some
| :? list<TestItem> as sq -> TestItemSeq.createFrom sq |> Some
| :? array<TestItem> as sq -> TestItemSeq.createFrom sq |> Some
| :? seq<TestItem> as sq -> TestItemSeq.createFrom sq |> Some
| :? INode as node -> TestItemSeq.createFrom (node |> TestNode.fromNode) |> Some // also IElement etc
| :? option<INode> as node -> TestItemSeq.createFrom (node |> Option.map TestNode.fromNode) |> Some // also IElement etc
| :? seq<INode> as node -> TestItemSeq.createFrom (node |> Seq.map TestNode.fromNode) |> Some // also IElement etc
// native-to-Xxx
| :? int64 as item -> TestItemSeq.createFrom item |> Some
| :? option<int64> as item -> TestItemSeq.createFrom item |> Some
| :? array<int64> as item -> TestItemSeq.createFrom item |> Some
| :? seq<int64> as item -> TestItemSeq.createFrom item |> Some
| :? decimal as item -> TestItemSeq.createFrom item |> Some
| :? option<decimal> as item -> TestItemSeq.createFrom item |> Some
| :? array<decimal> as item -> TestItemSeq.createFrom item |> Some
| :? seq<decimal> as item -> TestItemSeq.createFrom item |> Some
| :? float as item -> TestItemSeq.createFrom item |> Some
| :? option<float> as item -> TestItemSeq.createFrom item |> Some
| :? array<float> as item -> TestItemSeq.createFrom item |> Some
| :? seq<float> as item -> TestItemSeq.createFrom item |> Some
| :? float32 as item -> TestItemSeq.createFrom item |> Some
| :? option<float32> as item -> TestItemSeq.createFrom item |> Some
| :? array<float32> as item -> TestItemSeq.createFrom item |> Some
| :? seq<float32> as item -> TestItemSeq.createFrom item |> Some
| :? bool as item -> TestItemSeq.createFrom item |> Some
| :? option<bool> as item -> TestItemSeq.createFrom item |> Some
| :? array<bool> as item -> TestItemSeq.createFrom item |> Some
| :? seq<bool> as item -> TestItemSeq.createFrom item |> Some
| :? TestAnyType as item -> TestItemSeq.createFrom item |> Some
| :? option<TestAnyType> as item -> TestItemSeq.createFrom item |> Some
| :? array<TestAnyType> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestAnyType> as item -> TestItemSeq.createFrom item |> Some
// TestAnyType subtypes
| :? TestAnyAtomicType as item -> TestItemSeq.createFrom item |> Some
| :? option<TestAnyAtomicType> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestAnyAtomicType> as item -> TestItemSeq.createFrom item |> Some
| :? TestFunction as item -> TestItemSeq.createFrom item |> Some
| :? option<TestFunction> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestFunction> as item -> TestItemSeq.createFrom item |> Some
| :? TestNode as item -> TestItemSeq.createFrom item |> Some
| :? option<TestNode> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestNode> as item -> TestItemSeq.createFrom item |> Some
| :? TestError as item -> TestItemSeq.createFrom item |> Some
| :? option<TestError> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestError> as item -> TestItemSeq.createFrom item |> Some
// TestAnyAtomicType subtypes
| :? TestNumeric as item -> TestItemSeq.createFrom item |> Some
| :? option<TestNumeric> as item -> TestItemSeq.createFrom item |> Some
| :? array<TestNumeric> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestNumeric> as item -> TestItemSeq.createFrom item |> Some
| :? TestString as item -> TestItemSeq.createFrom item |> Some
| :? option<TestString> as item -> TestItemSeq.createFrom item |> Some
| :? array<TestString> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestString> as item -> TestItemSeq.createFrom item |> Some
| :? TestQName as item -> TestItemSeq.createFrom item |> Some
| :? option<TestQName> as item -> TestItemSeq.createFrom item |> Some
| :? array<TestQName> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestQName> as item -> TestItemSeq.createFrom item |> Some
| :? TestDuration as item -> TestItemSeq.createFrom item |> Some
| :? option<TestDuration> as item -> TestItemSeq.createFrom item |> Some
| :? array<TestDuration> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestDuration> as item -> TestItemSeq.createFrom item |> Some
| :? InternalDuration as item -> TestItemSeq.createFrom item |> Some
| :? option<InternalDuration> as item -> TestItemSeq.createFrom item |> Some
| :? array<InternalDuration> as item -> TestItemSeq.createFrom item |> Some
| :? seq<InternalDuration> as item -> TestItemSeq.createFrom item |> Some
| :? TestDateTime as item -> TestItemSeq.createFrom item |> Some
| :? option<TestDateTime> as item -> TestItemSeq.createFrom item |> Some
| :? array<TestDateTime> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestDateTime> as item -> TestItemSeq.createFrom item |> Some
| :? TestDateTimeStamp as item -> TestItemSeq.createFrom item |> Some
| :? option<TestDateTimeStamp> as item -> TestItemSeq.createFrom item |> Some
| :? array<TestDateTimeStamp> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestDateTimeStamp> as item -> TestItemSeq.createFrom item |> Some
| :? InternalDateTime as item -> TestItemSeq.createFrom item |> Some
| :? option<InternalDateTime> as item -> TestItemSeq.createFrom item |> Some
| :? array<InternalDateTime> as item -> TestItemSeq.createFrom item |> Some
| :? seq<InternalDateTime> as item -> TestItemSeq.createFrom item |> Some
| :? TestUntypedAtomic as item -> TestItemSeq.createFrom item |> Some
| :? option<TestUntypedAtomic> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestUntypedAtomic> as item -> TestItemSeq.createFrom item |> Some
// TestDateTime subtypes
| :? TestDate as item -> TestItemSeq.createFrom item |> Some
| :? option<TestDate> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestDate> as item -> TestItemSeq.createFrom item |> Some
| :? TestTime as item -> TestItemSeq.createFrom item |> Some
| :? option<TestTime> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestTime> as item -> TestItemSeq.createFrom item |> Some
| :? TestGYear as item -> TestItemSeq.createFrom item |> Some
| :? option<TestGYear> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestGYear> as item -> TestItemSeq.createFrom item |> Some
| :? TestGYearMonth as item -> TestItemSeq.createFrom item |> Some
| :? option<TestGYearMonth> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestGYearMonth> as item -> TestItemSeq.createFrom item |> Some
| :? TestGMonth as item -> TestItemSeq.createFrom item |> Some
| :? option<TestGMonth> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestGMonth> as item -> TestItemSeq.createFrom item |> Some
| :? TestGMonthDay as item -> TestItemSeq.createFrom item |> Some
| :? option<TestGMonthDay> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestGMonthDay> as item -> TestItemSeq.createFrom item |> Some
| :? TestGDay as item -> TestItemSeq.createFrom item |> Some
| :? option<TestGDay> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestGDay> as item -> TestItemSeq.createFrom item |> Some
// TestDuration subtypes
| :? TestYearMonthDuration as item -> TestItemSeq.createFrom item |> Some
| :? option<TestYearMonthDuration> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestYearMonthDuration> as item -> TestItemSeq.createFrom item |> Some
| :? TestDayTimeDuration as item -> TestItemSeq.createFrom item |> Some
| :? option<TestDayTimeDuration> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestDayTimeDuration> as item -> TestItemSeq.createFrom item |> Some
// TestBinary and subtypes
| :? TestBinary as item -> TestItemSeq.createFrom item |> Some
| :? option<TestBinary> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestBinary> as item -> TestItemSeq.createFrom item |> Some
| :? TestHexBinary as item -> TestItemSeq.createFrom item |> Some
| :? option<TestHexBinary> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestHexBinary> as item -> TestItemSeq.createFrom item |> Some
| :? TestBase64Binary as item -> TestItemSeq.createFrom item |> Some
| :? option<TestBase64Binary> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestBase64Binary> as item -> TestItemSeq.createFrom item |> Some
// TestFunction subtypes
| :? SomeTestRecord as item -> TestItemSeq.createFrom item |> Some
| :? option<SomeTestRecord> as item -> TestItemSeq.createFrom item |> Some
| :? seq<SomeTestRecord> as item -> TestItemSeq.createFrom item |> Some
| :? TestMapItem as item -> TestItemSeq.createFrom item |> Some
| :? option<TestMapItem> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestMapItem> as item -> TestItemSeq.createFrom item |> Some
// TestNode subtypes
| :? TestDocument as item -> TestItemSeq.createFrom item |> Some
| :? option<TestDocument> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestDocument> as item -> TestItemSeq.createFrom item |> Some
| :? TestElement as item -> TestItemSeq.createFrom item |> Some
| :? option<TestElement> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestElement> as item -> TestItemSeq.createFrom item |> Some
| :? TestAttribute as item -> TestItemSeq.createFrom item |> Some
| :? option<TestAttribute> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestAttribute> as item -> TestItemSeq.createFrom item |> Some
| :? TestComment as item -> TestItemSeq.createFrom item |> Some
| :? option<TestComment> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestComment> as item -> TestItemSeq.createFrom item |> Some
| :? TestPI as item -> TestItemSeq.createFrom item |> Some
| :? option<TestPI> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestPI> as item -> TestItemSeq.createFrom item |> Some
| :? TestNamespace as item -> TestItemSeq.createFrom item |> Some
| :? option<TestNamespace> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestNamespace> as item -> TestItemSeq.createFrom item |> Some
| :? TestText as item -> TestItemSeq.createFrom item |> Some
| :? option<TestText> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestText> as item -> TestItemSeq.createFrom item |> Some
| :? string as item -> TestItemSeq.createFrom item |> Some
| :? option<string> as item -> TestItemSeq.createFrom item |> Some
| :? seq<string> as item -> TestItemSeq.createFrom item |> Some
| :? TestNormalizedString as item -> TestItemSeq.createFrom item |> Some
| :? option<TestNormalizedString> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestNormalizedString> as item -> TestItemSeq.createFrom item |> Some
| :? TestAnyURI as item -> TestItemSeq.createFrom item |> Some
| :? option<TestAnyURI> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestAnyURI> as item -> TestItemSeq.createFrom item |> Some
| :? TestNOTATION as item -> TestItemSeq.createFrom item |> Some
| :? option<TestNOTATION> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestNOTATION> as item -> TestItemSeq.createFrom item |> Some
| :? TestToken as item -> TestItemSeq.createFrom item |> Some
| :? option<TestToken> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestToken> as item -> TestItemSeq.createFrom item |> Some
| :? TestLanguage as item -> TestItemSeq.createFrom item |> Some
| :? option<TestLanguage> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestLanguage> as item -> TestItemSeq.createFrom item |> Some
| :? TestNMTOKEN as item -> TestItemSeq.createFrom item |> Some
| :? option<TestNMTOKEN> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestNMTOKEN> as item -> TestItemSeq.createFrom item |> Some
| :? TestName as item -> TestItemSeq.createFrom item |> Some
| :? option<TestName> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestName> as item -> TestItemSeq.createFrom item |> Some
| :? TestNCName as item -> TestItemSeq.createFrom item |> Some
| :? option<TestNCName> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestNCName> as item -> TestItemSeq.createFrom item |> Some
| :? TestID as item -> TestItemSeq.createFrom item |> Some
| :? option<TestID> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestID> as item -> TestItemSeq.createFrom item |> Some
| :? TestIDREF as item -> TestItemSeq.createFrom item |> Some
| :? option<TestIDREF> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestIDREF> as item -> TestItemSeq.createFrom item |> Some
| :? TestENTITY as item -> TestItemSeq.createFrom item |> Some
| :? option<TestENTITY> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestENTITY> as item -> TestItemSeq.createFrom item |> Some
// list types
| :? TestNMTOKENS as item -> TestItemSeq.createFrom item |> Some
| :? option<TestNMTOKENS> as item -> TestItemSeq.createFrom item |> Some
| :? TestIDREFS as item -> TestItemSeq.createFrom item |> Some
| :? option<TestIDREFS> as item -> TestItemSeq.createFrom item |> Some
| :? TestENTITIES as item -> TestItemSeq.createFrom item |> Some
| :? option<TestENTITIES> as item -> TestItemSeq.createFrom item |> Some
// other numeric types
| :? TestByte as item -> TestItemSeq.createFrom item |> Some
| :? option<TestByte> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestByte> as item -> TestItemSeq.createFrom item |> Some
| :? TestUnsignedByte as item -> TestItemSeq.createFrom item |> Some
| :? option<TestUnsignedByte> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestUnsignedByte> as item -> TestItemSeq.createFrom item |> Some
| :? TestShort as item -> TestItemSeq.createFrom item |> Some
| :? option<TestShort> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestShort> as item -> TestItemSeq.createFrom item |> Some
| :? TestUnsignedShort as item -> TestItemSeq.createFrom item |> Some
| :? option<TestUnsignedShort> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestUnsignedShort> as item -> TestItemSeq.createFrom item |> Some
| :? TestInt as item -> TestItemSeq.createFrom item |> Some
| :? option<TestInt> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestInt> as item -> TestItemSeq.createFrom item |> Some
| :? TestUnsignedInt as item -> TestItemSeq.createFrom item |> Some
| :? option<TestUnsignedInt> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestUnsignedInt> as item -> TestItemSeq.createFrom item |> Some
| :? TestLong as item -> TestItemSeq.createFrom item |> Some
| :? option<TestLong> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestLong> as item -> TestItemSeq.createFrom item |> Some
| :? TestUnsignedLong as item -> TestItemSeq.createFrom item |> Some
| :? option<TestUnsignedLong> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestUnsignedLong> as item -> TestItemSeq.createFrom item |> Some
| :? TestPositiveInteger as item -> TestItemSeq.createFrom item |> Some
| :? option<TestPositiveInteger> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestPositiveInteger> as item -> TestItemSeq.createFrom item |> Some
| :? TestNegativeInteger as item -> TestItemSeq.createFrom item |> Some
| :? option<TestNegativeInteger> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestNegativeInteger> as item -> TestItemSeq.createFrom item |> Some
| :? TestNonNegativeInteger as item -> TestItemSeq.createFrom item |> Some
| :? option<TestNonNegativeInteger> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestNonNegativeInteger> as item -> TestItemSeq.createFrom item |> Some
| :? TestNonPositiveInteger as item -> TestItemSeq.createFrom item |> Some
| :? option<TestNonPositiveInteger> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestNonPositiveInteger> as item -> TestItemSeq.createFrom item |> Some
// The following types actually unwrap
| :? TestInteger as item -> TestItemSeq.createFrom item |> Some
| :? option<TestInteger> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestInteger> as item -> TestItemSeq.createFrom item |> Some
| :? TestDouble as item -> TestItemSeq.createFrom item |> Some
| :? option<TestDouble> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestDouble> as item -> TestItemSeq.createFrom item |> Some
| :? TestFloat as item -> TestItemSeq.createFrom item |> Some
| :? option<TestFloat> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestFloat> as item -> TestItemSeq.createFrom item |> Some
| :? TestDecimal as item -> TestItemSeq.createFrom item |> Some
| :? option<TestDecimal> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestDecimal> as item -> TestItemSeq.createFrom item |> Some
| :? TestBoolean as item -> TestItemSeq.createFrom item |> Some
| :? option<TestBoolean> as item -> TestItemSeq.createFrom item |> Some
| :? seq<TestBoolean> as item -> TestItemSeq.createFrom item |> Some
// other native-to-TestItemSeq numeric types
| :? sbyte as item -> TestItemSeq.createFrom item |> Some
| :? option<sbyte> as item -> TestItemSeq.createFrom item |> Some
| :? seq<sbyte> as item -> TestItemSeq.createFrom item |> Some
| :? byte as item -> TestItemSeq.createFrom item |> Some
| :? option<byte> as item -> TestItemSeq.createFrom item |> Some
| :? seq<byte> as item -> TestItemSeq.createFrom item |> Some
| :? int16 as item -> TestItemSeq.createFrom item |> Some
| :? option<int16> as item -> TestItemSeq.createFrom item |> Some
| :? seq<int16> as item -> TestItemSeq.createFrom item |> Some
| :? uint16 as item -> TestItemSeq.createFrom item |> Some
| :? option<uint16> as item -> TestItemSeq.createFrom item |> Some
| :? seq<uint16> as item -> TestItemSeq.createFrom item |> Some
| :? int32 as item -> TestItemSeq.createFrom item |> Some
| :? option<int32> as item -> TestItemSeq.createFrom item |> Some
| :? seq<int32> as item -> TestItemSeq.createFrom item |> Some
| :? uint32 as item -> TestItemSeq.createFrom item |> Some
| :? option<uint32> as item -> TestItemSeq.createFrom item |> Some
| :? seq<uint32> as item -> TestItemSeq.createFrom item |> Some
| :? uint64 as item -> TestItemSeq.createFrom item |> Some
| :? option<uint64> as item -> TestItemSeq.createFrom item |> Some
| :? seq<uint64> as item -> TestItemSeq.createFrom item |> Some
| _ -> None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment