mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Improved handling of multiply-nested generic aliases
This commit is contained in:
parent
42883d1a95
commit
3c276968b3
2 changed files with 21 additions and 2 deletions
|
@ -3916,9 +3916,14 @@ int BfResolvedTypeSet::DoHash(BfTypeReference* typeRef, LookupContext* ctx, BfHa
|
|||
if (!ctx->mFailed)
|
||||
{
|
||||
auto resolvedType = ctx->mModule->ResolveTypeDef(elementTypeDef, typeAliasGenericArgs);
|
||||
if ((resolvedType != NULL) && (resolvedType->IsTypeAlias()))
|
||||
if (resolvedType != NULL)
|
||||
{
|
||||
auto underlyingType = resolvedType->GetUnderlyingType();
|
||||
auto underlyingType = resolvedType;
|
||||
while ((underlyingType != NULL) && (underlyingType->IsTypeAlias()))
|
||||
{
|
||||
ctx->mModule->PopulateType(underlyingType);
|
||||
underlyingType = underlyingType->GetUnderlyingType();
|
||||
}
|
||||
if (underlyingType == NULL)
|
||||
{
|
||||
ctx->mFailed = true;
|
||||
|
|
|
@ -7,6 +7,9 @@ namespace Tests
|
|||
{
|
||||
class Aliases
|
||||
{
|
||||
typealias IntrusivePtr<T> = T;
|
||||
typealias ConstPtr<T> = IntrusivePtr<T>;
|
||||
|
||||
class ClassA<T>
|
||||
{
|
||||
public typealias AliasA0 = int32;
|
||||
|
@ -49,6 +52,11 @@ namespace Tests
|
|||
ClassA<T>.AliasA8 arr2 = arr1;
|
||||
}
|
||||
|
||||
class MyClass
|
||||
{
|
||||
public int Member;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestBasics()
|
||||
{
|
||||
|
@ -71,6 +79,12 @@ namespace Tests
|
|||
ClassA<float>.AliasA6<double> v3 = t2;
|
||||
|
||||
ClassB<double>.MethodB0(scope List<(double a, float b, int c)>());
|
||||
|
||||
List<ConstPtr<MyClass>> myClasses = scope .();
|
||||
for(var item in myClasses)
|
||||
{
|
||||
item.Member = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue