Skip to content

Commit

Permalink
Fixed Ourpalm#664
Browse files Browse the repository at this point in the history
  • Loading branch information
liiir1985 committed Mar 24, 2022
1 parent 634b289 commit 9489e8d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ILRuntime/Runtime/Intepreter/ILIntepreter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3375,6 +3375,10 @@ public object Run(ILMethod method, object instance, object[] p)
{
//Nothing to do with primitive types
}
else if (objRef->ObjectType == ObjectTypes.ValueTypeObjectReference)
{
//Nothing to do with ValueTypeReference
}
else
throw new InvalidCastException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4043,6 +4043,10 @@ public unsafe partial class ILIntepreter
{
//Nothing to do with primitive types
}
else if (objRef->ObjectType == ObjectTypes.ValueTypeObjectReference)
{
//Nothing to do with ValueTypeReference
}
else
throw new InvalidCastException();
}
Expand Down
7 changes: 7 additions & 0 deletions TestCases/SimpleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ public static void NullableTest()
Console.WriteLine(val.Value.ToString());
}

public static void NullableTest2()
{
int? val = null;
if (val.HasValue)
Console.WriteLine(val.Value.ToString());
}

static void foo4() { }
static Action act1 = null;
class Test4
Expand Down
18 changes: 18 additions & 0 deletions TestCases/Structs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -425,5 +425,23 @@ public static void StructTest14()
List<NestedStruct> lst = new List<NestedStruct>();
lst.Add(new NestedStruct(new Vector3(1, 2, 3)));
}

class EventArgs
{
public object[] args;
}
public static void StructTest15()
{
EventArgs arg = new EventArgs();
arg.args = new object[] { new Vector3() };

if(arg.args[0] is Vector3)
{
Vector3 a = (Vector3)arg.args[0];
Console.WriteLine(a.ToString());
}
}


}
}

0 comments on commit 9489e8d

Please sign in to comment.