mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
Propagate isRestParameter through symbol instantiation (#18087)
* Add repro from #17666 * Actually use repro from issue, propegate isRestParameter on instantiation
This commit is contained in:
@@ -8168,6 +8168,9 @@ namespace ts {
|
||||
if (symbol.valueDeclaration) {
|
||||
result.valueDeclaration = symbol.valueDeclaration;
|
||||
}
|
||||
if ((symbol as TransientSymbol).isRestParameter) {
|
||||
result.isRestParameter = (symbol as TransientSymbol).isRestParameter;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
42
tests/baselines/reference/superNoModifiersCrash.js
Normal file
42
tests/baselines/reference/superNoModifiersCrash.js
Normal file
@@ -0,0 +1,42 @@
|
||||
//// [File.js]
|
||||
class Parent {
|
||||
initialize() {
|
||||
super.initialize(...arguments)
|
||||
return this.asdf = ''
|
||||
}
|
||||
}
|
||||
|
||||
class Child extends Parent {
|
||||
initialize() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [File.js]
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var Parent = /** @class */ (function () {
|
||||
function Parent() {
|
||||
}
|
||||
Parent.prototype.initialize = function () {
|
||||
_super.prototype.initialize.apply(this, arguments);
|
||||
return this.asdf = '';
|
||||
};
|
||||
return Parent;
|
||||
}());
|
||||
var Child = /** @class */ (function (_super) {
|
||||
__extends(Child, _super);
|
||||
function Child() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Child.prototype.initialize = function () {
|
||||
};
|
||||
return Child;
|
||||
}(Parent));
|
||||
25
tests/baselines/reference/superNoModifiersCrash.symbols
Normal file
25
tests/baselines/reference/superNoModifiersCrash.symbols
Normal file
@@ -0,0 +1,25 @@
|
||||
=== tests/cases/compiler/File.js ===
|
||||
class Parent {
|
||||
>Parent : Symbol(Parent, Decl(File.js, 0, 0))
|
||||
|
||||
initialize() {
|
||||
>initialize : Symbol(Parent.initialize, Decl(File.js, 0, 14))
|
||||
|
||||
super.initialize(...arguments)
|
||||
>arguments : Symbol(arguments)
|
||||
|
||||
return this.asdf = ''
|
||||
>this.asdf : Symbol(Parent.asdf, Decl(File.js, 3, 14))
|
||||
>this : Symbol(Parent, Decl(File.js, 0, 0))
|
||||
>asdf : Symbol(Parent.asdf, Decl(File.js, 3, 14))
|
||||
}
|
||||
}
|
||||
|
||||
class Child extends Parent {
|
||||
>Child : Symbol(Child, Decl(File.js, 5, 3))
|
||||
>Parent : Symbol(Parent, Decl(File.js, 0, 0))
|
||||
|
||||
initialize() {
|
||||
>initialize : Symbol(Child.initialize, Decl(File.js, 7, 28))
|
||||
}
|
||||
}
|
||||
32
tests/baselines/reference/superNoModifiersCrash.types
Normal file
32
tests/baselines/reference/superNoModifiersCrash.types
Normal file
@@ -0,0 +1,32 @@
|
||||
=== tests/cases/compiler/File.js ===
|
||||
class Parent {
|
||||
>Parent : Parent
|
||||
|
||||
initialize() {
|
||||
>initialize : (...args: any[]) => string
|
||||
|
||||
super.initialize(...arguments)
|
||||
>super.initialize(...arguments) : any
|
||||
>super.initialize : any
|
||||
>super : any
|
||||
>initialize : any
|
||||
>...arguments : any
|
||||
>arguments : IArguments
|
||||
|
||||
return this.asdf = ''
|
||||
>this.asdf = '' : ""
|
||||
>this.asdf : string
|
||||
>this : this
|
||||
>asdf : string
|
||||
>'' : ""
|
||||
}
|
||||
}
|
||||
|
||||
class Child extends Parent {
|
||||
>Child : Child
|
||||
>Parent : Parent
|
||||
|
||||
initialize() {
|
||||
>initialize : () => void
|
||||
}
|
||||
}
|
||||
14
tests/cases/compiler/superNoModifiersCrash.ts
Normal file
14
tests/cases/compiler/superNoModifiersCrash.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// @allowjs: true
|
||||
// @outDir: ../
|
||||
// @filename: File.js
|
||||
class Parent {
|
||||
initialize() {
|
||||
super.initialize(...arguments)
|
||||
return this.asdf = ''
|
||||
}
|
||||
}
|
||||
|
||||
class Child extends Parent {
|
||||
initialize() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user