Beef icon indicating copy to clipboard operation
Beef copied to clipboard

Compiler Error - Cannot find typealias

Open jayrulez opened this issue 1 year ago • 1 comments

This block of code reproduces the issue with an extension of Dictionary:

using System.Collections;

class MyBuffer{

}

struct MyBufferState{

}

namespace System.Collections{
	extension Dictionary<TKey, TValue>{
		public typealias Iterator = TValue*;
	}
}

typealias Hash<TKey, TValue> = Dictionary<TKey, TValue>;

class MyTest{
	public typealias BufferIterator = Hash<MyBuffer, MyBufferState>.Iterator;
}

Iterator cannot be found on this line: public typealias BufferIterator = Hash<MyBuffer, MyBufferState>.Iterator;

jayrulez avatar Apr 05 '23 19:04 jayrulez

This should have a similar issue but it works:

class MyClass<T> {

	}

	extension MyClass<T>{
		public typealias TPointer = T*;
	}

	typealias MyClassAlias<T> = MyClass<T>;

	static{

		public typealias IntClassPointer = MyClassAlias<int>.TPointer;

		public static void Test(){
			MyClass<int>.TPointer x = null;
			MyClassAlias<int>.TPointer y = null;
		}
	}

jayrulez avatar Apr 05 '23 19:04 jayrulez