mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Merge pull request #29959 from Microsoft/noResolvedTypeOverwrite
Never overwrite resolved types of symbols
This commit is contained in:
commit
071708f8a7
@ -5425,7 +5425,16 @@ namespace ts {
|
||||
|
||||
function getTypeOfVariableOrParameterOrProperty(symbol: Symbol): Type {
|
||||
const links = getSymbolLinks(symbol);
|
||||
return links.type || (links.type = getTypeOfVariableOrParameterOrPropertyWorker(symbol));
|
||||
if (!links.type) {
|
||||
const type = getTypeOfVariableOrParameterOrPropertyWorker(symbol);
|
||||
// For a contextually typed parameter it is possible that a type has already
|
||||
// been assigned (in assignTypeToParameterAndFixTypeParameters), and we want
|
||||
// to preserve this type.
|
||||
if (!links.type) {
|
||||
links.type = type;
|
||||
}
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
|
||||
function getTypeOfVariableOrParameterOrPropertyWorker(symbol: Symbol) {
|
||||
@ -5469,7 +5478,7 @@ namespace ts {
|
||||
if (symbol.flags & SymbolFlags.ValueModule) {
|
||||
return getTypeOfFuncClassEnumModule(symbol);
|
||||
}
|
||||
return errorType;
|
||||
return reportCircularityError(symbol);
|
||||
}
|
||||
let type: Type | undefined;
|
||||
if (isInJSFile(declaration) &&
|
||||
@ -5528,7 +5537,7 @@ namespace ts {
|
||||
if (symbol.flags & SymbolFlags.ValueModule) {
|
||||
return getTypeOfFuncClassEnumModule(symbol);
|
||||
}
|
||||
type = reportCircularityError(symbol);
|
||||
return reportCircularityError(symbol);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
@ -4,11 +4,11 @@ export class StackOverflowTest {
|
||||
|
||||
constructor () {
|
||||
this.testStackOverflow = this.testStackOverflow.bind(this)
|
||||
>this.testStackOverflow = this.testStackOverflow.bind(this) : error
|
||||
>this.testStackOverflow = this.testStackOverflow.bind(this) : any
|
||||
>this.testStackOverflow : any
|
||||
>this : this
|
||||
>testStackOverflow : any
|
||||
>this.testStackOverflow.bind(this) : error
|
||||
>this.testStackOverflow.bind(this) : any
|
||||
>this.testStackOverflow.bind : any
|
||||
>this.testStackOverflow : any
|
||||
>this : this
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts ===
|
||||
for (var of of of) { }
|
||||
>of : any
|
||||
>of : error
|
||||
>of : any
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts ===
|
||||
for (var of in of) { }
|
||||
>of : any
|
||||
>of : error
|
||||
>of : any
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts ===
|
||||
for (var of of of) { }
|
||||
>of : any
|
||||
>of : error
|
||||
>of : any
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts ===
|
||||
for (var of in of) { }
|
||||
>of : any
|
||||
>of : error
|
||||
>of : any
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ salt.pepper = function() {}
|
||||
|
||||
var cobalt = new cobalt.pitch();
|
||||
>cobalt : any
|
||||
>new cobalt.pitch() : error
|
||||
>new cobalt.pitch() : any
|
||||
>cobalt.pitch : any
|
||||
>cobalt : any
|
||||
>pitch : any
|
||||
|
||||
@ -14,7 +14,7 @@ import self = require("recursiveExportAssignmentAndFindAliasedType7_moduleD");
|
||||
|
||||
var selfVar = self;
|
||||
>selfVar : any
|
||||
>self : error
|
||||
>self : any
|
||||
|
||||
export = selfVar;
|
||||
>selfVar : any
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user