It is shown in the following that testing with non-nested generic type declarations against our implementation is currently possible. Please leave a comment if you have doubt over the test result.
class AnotherClass<T> {
private testPrivateMember: T;
constructor(intro: T) {
this.testPrivateMember = intro;
}
public testPrivateInPublic(): T {
return this.testPrivateMember;
}
}
let typicalGeneric = new AnotherClass<number>(100);
; ModuleID = 'genericType.ts'
source_filename = "genericType.ts"
%AnotherClass = type { double }
define void @main(...) {
%typicalGeneric = alloca %AnotherClass, align 8
call void (%AnotherClass*, double, ...) @AnotherClass_Constructor(%AnotherClass* %typicalGeneric, double 1.000000e+02)
ret void
}
define void @AnotherClass_Constructor(%AnotherClass* %this, double %intro, ...) {
%1 = alloca double, align 8
store double %intro, double* %1, align 8
%2 = getelementptr inbounds %AnotherClass, %AnotherClass* %this, i32 0, i32 0
%3 = load double, double* %1, align 8
store double %3, double* %2, align 8
ret void
}
define double @AnotherClass_testPrivateInPublic(%AnotherClass* %this, ...) {
%1 = getelementptr inbounds %AnotherClass, %AnotherClass* %this, i32 0, i32 0
%2 = load double, double* %1, align 8
ret double %2
}