@@ -11940,7 +11940,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1194011940 return containerObjectType;
1194111941 }
1194211942 }
11943- const type = widenTypeInferredFromInitializer(declaration, checkDeclarationInitializer(declaration, checkMode));
11943+ const initType = checkDeclarationInitializer(declaration, checkMode);
11944+ const type = widenTypeInferredFromInitializer(declaration, initType);
11945+ // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
11946+ if (isPropertyDeclaration(declaration) && declaration.name && isIdentifier(declaration.name) && declaration.name.text === "D") { console.log("getTypeForVariableLikeDeclaration D: initType=", typeToString(initType), "widenedType=", typeToString(type), "checkMode=", checkMode); }
1194411947 return addOptionality(type, isProperty, isOptional);
1194511948 }
1194611949
@@ -12449,7 +12452,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1244912452 // binding pattern [x, s = ""]. Because the contextual type is a tuple type, the resulting type of [1, "one"] is the
1245012453 // tuple type [number, string]. Thus, the type inferred for 'x' is number and the type inferred for 's' is string.
1245112454 function getWidenedTypeForVariableLikeDeclaration(declaration: ParameterDeclaration | PropertyDeclaration | PropertySignature | VariableDeclaration | BindingElement | JSDocPropertyLikeTag, reportErrors?: boolean): Type {
12452- return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true, CheckMode.Normal), declaration, reportErrors);
12455+ const innerType = getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true, CheckMode.Normal);
12456+ const result = widenTypeForVariableLikeDeclaration(innerType, declaration, reportErrors);
12457+ // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
12458+ if (isPropertyDeclaration(declaration)) { console.log("getWidenedTypeForVariableLikeDeclaration PropertyDecl: declName=", isIdentifier(declaration.name) ? declaration.name.text : "?", "innerType=", innerType ? typeToString(innerType) : "undefined", "result=", typeToString(result)); }
12459+ return result;
1245312460 }
1245412461
1245512462 function getTypeFromImportAttributes(node: ImportAttributes): Type {
@@ -12546,8 +12553,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1254612553 if (!links.type && !isParameterOfContextSensitiveSignature(symbol)) {
1254712554 links.type = type;
1254812555 }
12556+ // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
12557+ if ((symbol.escapedName as string) === "D" && symbol.valueDeclaration && isPropertyDeclaration(symbol.valueDeclaration)) { console.log("D getTypeOfVar (computed):", typeToString(type), "links.type:", links.type ? typeToString(links.type) : "none", new Error().stack?.split('\n').slice(1,6).join(' | ')); }
1254912558 return type;
1255012559 }
12560+ // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
12561+ if ((symbol.escapedName as string) === "D" && symbol.valueDeclaration && isPropertyDeclaration(symbol.valueDeclaration)) { console.log("D getTypeOfVar (cached):", typeToString(links.type), new Error().stack?.split('\n').slice(1,6).join(' | ')); }
1255112562 return links.type;
1255212563 }
1255312564
@@ -12648,6 +12659,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1264812659 || isJSDocPropertyLikeTag(declaration)
1264912660 ) {
1265012661 type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
12662+ // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
12663+ if (isPropertyDeclaration(declaration) && declaration.name && (declaration.name as any).text === "D") { console.log("D property type =", typeToString(type)); }
1265112664 }
1265212665 // getTypeOfSymbol dispatches some JS merges incorrectly because their symbol flags are not mutually exclusive.
1265312666 // Re-dispatch based on valueDeclaration.kind instead.
@@ -12964,6 +12977,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1296412977 return getTypeOfReverseMappedSymbol(symbol as ReverseMappedSymbol);
1296512978 }
1296612979 if (symbol.flags & (SymbolFlags.Variable | SymbolFlags.Property)) {
12980+ // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
12981+ if ((symbol.escapedName as string) === "D" && symbol.valueDeclaration && isPropertyDeclaration(symbol.valueDeclaration)) { const t = getTypeOfVariableOrParameterOrProperty(symbol); console.log("getTypeOfSymbol D (Variable|Property):", typeToString(t), "checkFlags:", checkFlags); return t; }
1296712982 return getTypeOfVariableOrParameterOrProperty(symbol);
1296812983 }
1296912984 if (symbol.flags & (SymbolFlags.Function | SymbolFlags.Method | SymbolFlags.Class | SymbolFlags.Enum | SymbolFlags.ValueModule)) {
@@ -34998,6 +35013,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3499835013 }
3499935014
3500035015 propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writeOnly || isWriteOnlyAccess(node) ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop);
35016+ // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
35017+ if (isPropertyDeclaration(prop?.valueDeclaration) && isPropertyAccessExpression(node) && node.expression.kind === SyntaxKind.ThisKeyword) { console.log("checkPropAccess: prop=", symbolToString(prop), "propType=", typeToString(propType), "checkFlags=", getCheckFlags(prop)); }
3500135018 }
3500235019
3500335020 return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
@@ -35047,6 +35064,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3504735064 return getFlowTypeOfProperty(node, prop);
3504835065 }
3504935066 propType = getNarrowableTypeForReference(propType, node, checkMode);
35067+ // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
35068+ if (prop && (prop.name as string) === "D") { console.log("getFlowTypeOfAccessExpression: propType =", typeToString(propType)); }
3505035069 // If strict null checks and strict property initialization checks are enabled, if we have
3505135070 // a this.xxx property access, if the property is an instance property without an initializer,
3505235071 // and if we are in a constructor of the same class as the property declaration, assume that
@@ -35072,6 +35091,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3507235091 assumeUninitialized = true;
3507335092 }
3507435093 const flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
35094+ // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
35095+ if (prop && (prop.name as string) === "D") { console.log("getFlowTypeOfAccessExpression: flowType =", typeToString(flowType)); }
3507535096 if (assumeUninitialized && !containsUndefinedType(propType) && containsUndefinedType(flowType)) {
3507635097 error(errorNode, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop!)); // TODO: GH#18217
3507735098 // Return the declared type to reduce follow-on errors
@@ -41374,6 +41395,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4137441395 const type = getQuickTypeOfExpression(initializer) || (contextualType ?
4137541396 checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || CheckMode.Normal) :
4137641397 checkExpressionCached(initializer, checkMode));
41398+ // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
41399+ if (isPropertyDeclaration(declaration)) { console.log("checkDeclarationInitializer PropertyDecl: checkMode=", checkMode, "initKind=", initializer.kind, "type=", typeToString(type)); }
4137741400 if (isParameter(isBindingElement(declaration) ? walkUpBindingElementsAndPatterns(declaration) : declaration)) {
4137841401 if (declaration.name.kind === SyntaxKind.ObjectBindingPattern && isObjectLiteralType(type)) {
4137941402 return padObjectLiteralType(type as ObjectType, declaration.name);
@@ -46630,6 +46653,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4663046653 let hasDuplicateDefaultClause = false;
4663146654
4663246655 const expressionType = checkExpression(node.expression);
46656+ // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
46657+ console.log("checkSwitchStatement: expressionType =", typeToString(expressionType), "nodeExprKind=", node.expression.kind, "isPAE=", isPropertyAccessExpression(node.expression));
4663346658
4663446659 forEach(node.caseBlock.clauses, clause => {
4663546660 // Grammar check for duplicate default clauses, skip if we already report duplicate default clause
0 commit comments