Uncomment a bit of a test

This commit is contained in:
Smaug123
2025-06-22 19:28:42 +01:00
parent 91f5376e8a
commit e6d56510fd
11 changed files with 201 additions and 91 deletions

View File

@@ -519,6 +519,12 @@ type UnaryMetadataTokenIlOp =
| Call
| Calli
| Callvirt
/// Attempts to cast an object passed by reference to the specified class.
/// If the class of the object on the top of the stack does not implement the new class
/// (assuming the new class is an interface)
/// and is not a derived class of the new class then an InvalidCastException is thrown.
/// If the object reference is a null reference, castclass succeeds
/// and returns the new object as a null reference.
| Castclass
| Newobj
| Newarr

View File

@@ -46,6 +46,13 @@ type TypeMethodSignature<'Types> =
[<RequireQualifiedAccess>]
module TypeMethodSignature =
let sigsEqual<'T> (equal : 'T -> 'T -> bool) (s1 : TypeMethodSignature<'T>) (s2 : TypeMethodSignature<'T>) : bool =
s1.GenericParameterCount = s2.GenericParameterCount
&& s1.ParameterTypes.Length = s2.ParameterTypes.Length
&& equal s1.ReturnType s2.ReturnType
&& List.zip s1.ParameterTypes s2.ParameterTypes
|> List.forall (fun (x, y) -> equal x y)
let make<'T> (p : MethodSignature<'T>) : TypeMethodSignature<'T> =
{
Header = ComparableSignatureHeader.Make p.Header
@@ -170,6 +177,30 @@ type TypeDefn =
[<RequireQualifiedAccess>]
module TypeDefn =
let rec equals
(t1TypeGenerics : TypeDefn ImmutableArray)
(t1MethodGenerics : TypeDefn ImmutableArray)
(t2TypeGenerics : TypeDefn ImmutableArray)
(t2MethodGenerics : TypeDefn ImmutableArray)
(t1 : TypeDefn)
(t2 : TypeDefn)
: bool
=
match t1, t2 with
| TypeDefn.GenericTypeParameter i, j ->
equals t1TypeGenerics t1MethodGenerics t2TypeGenerics t2MethodGenerics t1TypeGenerics.[i] j
| TypeDefn.GenericMethodParameter i, j ->
equals t1TypeGenerics t1MethodGenerics t2TypeGenerics t2MethodGenerics t1MethodGenerics.[i] j
| i, TypeDefn.GenericTypeParameter j ->
equals t1TypeGenerics t1MethodGenerics t2TypeGenerics t2MethodGenerics i t2TypeGenerics.[j]
| i, TypeDefn.GenericMethodParameter j ->
equals t1TypeGenerics t1MethodGenerics t2TypeGenerics t2MethodGenerics i t2MethodGenerics.[j]
| TypeDefn.PrimitiveType x, TypeDefn.PrimitiveType y -> x = y
| TypeDefn.Array (x, shapeX), TypeDefn.Array (y, shapeY) ->
shapeX = shapeY
&& equals t1TypeGenerics t1MethodGenerics t2TypeGenerics t2TypeGenerics x y
| t1, t2 -> failwith $"TODO: {t1} = {t2}"
let isManaged (typeDefn : TypeDefn) : bool =
match typeDefn with
| TypeDefn.PrimitiveType primitiveType -> failwith "todo"

View File

@@ -92,6 +92,8 @@ type TypeInfoCrate =
abstract ToString : unit -> string
abstract BaseType : BaseTypeInfo option
abstract Assembly : AssemblyName
abstract Namespace : string
abstract Name : string
[<RequireQualifiedAccess>]
module TypeInfoCrate =
@@ -108,6 +110,10 @@ module TypeInfoCrate =
member this.BaseType = t.BaseType
member this.Assembly = t.Assembly
member this.Namespace = t.Namespace
member this.Name = t.Name
}
type BaseClassTypes<'corelib> =