This affects several places. Suppose we have the following:
public class Outer[of T]:
public class Inner[of U]:
pass
instance as Outer[of int].Inner[of string]
1. Parsing: The parser cannot even handle typereferences for this kind of things. The type reference "Outer[of int].Inner[of string]" cannot be correctly represented in the current AST model (it can be represented a a generic reference expression inside a method, but not as a type reference). The parser errors out on it.
2. Binding: What should Outer[of int].Inner be bound to? It can't be bound to the generic type definition Outer[of T].Inner, because then we'd lose the int type argument. It can't be bound to any constructed type because it's missing its second type argument. Do we need another transient IType implementation for half-constructed generic definitions?
3. Emitting: While Outer[of T].Inner[of U] is considered to have a generity of 1, it needs to be emitted as having a generity of 2: Outer`1.Inner`1<T, U>. The same goes for things like the non-generic nested type List[of T].Enumerator, which should actually be emitted as the generic type definition List`1.Enumerator<T>.
Avishay Lavie - 04/Jan/08 04:16 PM This affects several places. Suppose we have the following:
public class Outer[of T]:
public class Inner[of U]:
pass
instance as Outer[of int].Inner[of string]
1. Parsing: The parser cannot even handle typereferences for this kind of things. The type reference "Outer[of int].Inner[of string]" cannot be correctly represented in the current AST model (it can be represented a a generic reference expression inside a method, but not as a type reference). The parser errors out on it.
2. Binding: What should Outer[of int].Inner be bound to? It can't be bound to the generic type definition Outer[of T].Inner, because then we'd lose the int type argument. It can't be bound to any constructed type because it's missing its second type argument. Do we need another transient IType implementation for half-constructed generic definitions?
3. Emitting: While Outer[of T].Inner[of U] is considered to have a generity of 1, it needs to be emitted as having a generity of 2: Outer`1.Inner`1<T, U>. The same goes for things like the non-generic nested type List[of T].Enumerator, which should actually be emitted as the generic type definition List`1.Enumerator<T>.
1. Parsing: The parser cannot even handle typereferences for this kind of things. The type reference "Outer[of int].Inner[of string]" cannot be correctly represented in the current AST model (it can be represented a a generic reference expression inside a method, but not as a type reference). The parser errors out on it.
2. Binding: What should Outer[of int].Inner be bound to? It can't be bound to the generic type definition Outer[of T].Inner, because then we'd lose the int type argument. It can't be bound to any constructed type because it's missing its second type argument. Do we need another transient IType implementation for half-constructed generic definitions?
3. Emitting: While Outer[of T].Inner[of U] is considered to have a generity of 1, it needs to be emitted as having a generity of 2: Outer`1.Inner`1<T, U>. The same goes for things like the non-generic nested type List[of T].Enumerator, which should actually be emitted as the generic type definition List`1.Enumerator<T>.