Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2017-05-15 23:06:44 +0300
committerGitHub <noreply@github.com>2017-05-15 23:06:44 +0300
commit9aa607be455d6d3b013fdb8caaabda600d649fde (patch)
treee07a068dd27917c4793e018a22633f31015a025d /src/ILCompiler.TypeSystem
parent692b07d0946a9df4918199d4287ce957c3e81521 (diff)
Finish support for rank 1 mdarrays (#3610)
Three parts: 1. Update casting logic to allow casting SzArray to rank 1 MdArray (but not the other way around) 2. Update MdArray rank 1 methods to be able to operate on SzArrays 3. Update array creation path to emulate the behavior where allocating rank 1 MdArray with 0 lower bounds actually gives you an SzArray Third bullet point makes this the most annoying, because we can't reliably support `newobj instance void int32[0...]::.ctor(int32)` without hitting the type loader. I was also considering adding an optional field on Rank 1 MdArrays that lets you get to the SzArray's EEType from it. It might be better. Fixes #3331.
Diffstat (limited to 'src/ILCompiler.TypeSystem')
-rw-r--r--src/ILCompiler.TypeSystem/tests/CastingTests.cs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ILCompiler.TypeSystem/tests/CastingTests.cs b/src/ILCompiler.TypeSystem/tests/CastingTests.cs
index b2771234c..573bc1822 100644
--- a/src/ILCompiler.TypeSystem/tests/CastingTests.cs
+++ b/src/ILCompiler.TypeSystem/tests/CastingTests.cs
@@ -73,6 +73,7 @@ namespace TypeSystemTests
TypeDesc shortBasedEnumType = _testModule.GetType("Casting", "ShortBasedEnum");
Assert.True(intType.MakeArrayType().CanCastTo(uintType.MakeArrayType()));
+ Assert.True(intType.MakeArrayType().CanCastTo(uintType.MakeArrayType(1)));
Assert.False(intType.CanCastTo(uintType));
Assert.True(byteType.MakeArrayType().CanCastTo(sbyteType.MakeArrayType()));
@@ -121,7 +122,9 @@ namespace TypeSystemTests
TypeDesc stringSzArrayType = stringType.MakeArrayType();
TypeDesc objectSzArrayType = objectType.MakeArrayType();
- Assert.False(intSzArrayType.CanCastTo(intArray1Type));
+ Assert.True(intSzArrayType.CanCastTo(intArray1Type));
+ Assert.False(intArray1Type.CanCastTo(intSzArrayType));
+
Assert.False(intArray1Type.CanCastTo(intArray2Type));
Assert.True(intSzArrayType.CanCastTo(arrayType));