| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Iirc the check was there for situations like class Foo<T> {
bar<T>() { baz<T>(); } // here
}
function baz<U>() { ... }where contextual types of the method take precedence over the class's. Before I merge, can you confirm that this case isn't regressing? :) |
Sorry, something went wrong.
The result is OK, I add them into test. // override whatever is contextual with actual function type arguments
var signatureNode = prototype.functionTypeNode;
var typeParameterNodes = prototype.typeParameterNodes;
var numFunctionTypeArguments: i32;
if (typeArguments !== null && (numFunctionTypeArguments = typeArguments.length) > 0) {
assert(typeParameterNodes !== null && numFunctionTypeArguments == typeParameterNodes.length);
for (let i = 0; i < numFunctionTypeArguments; ++i) {
ctxTypes.set(
(<TypeParameterNode[]>typeParameterNodes)[i].name.text,
typeArguments[i]
);
}
} else {
assert(!typeParameterNodes || typeParameterNodes.length == 0);
}
They ctxtype process flow is like that:
So it seems like matching the expectations. function testfunc2166<T-1>(): void {
let a = new Test2166Ref1<string>();
// class generic should override non-related function generic(testfunc2166): T in fn is string
a.fn("11", 1);
}
class Test2166Ref1<T-2> {
fn<U>(a1: T, a2: U): void {
}
}
testfunc2166<i64>();
|
Sorry, something went wrong.
|
Makes sense, thanks. Good to now have a test case as well :) |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
⯈For class instance method, ctxtypes should use class generic type instead of context. So override is more reasonable.