From 27bf9b702e25668d27d382c2b2767743be8fbf06 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Fri, 15 Aug 2014 14:33:16 -0700 Subject: [PATCH] Accept type baselines --- tests/baselines/reference/2dArrays.types | 40 + ...FunctionWithTheSameNameAndCommonRoot.types | 33 + ...eAndAmbientWithSameNameAndCommonRoot.types | 59 + ...mbientClassWithSameNameAndCommonRoot.types | 53 + ...FunctionWithTheSameNameAndCommonRoot.types | 37 + ...AndNonExportedFunctionThatShareAName.types | 49 + ...iableAndNonExportedVarThatShareAName.types | 49 + ...ctionWithTypeIncompatibleWithIndexer.types | 3 + ...umAndModuleWithSameNameAndCommonRoot.types | 43 + ...ExtendsInterfaceWithInaccessibleType.types | 38 + ...assHeritageListMemberTypeAnnotations.types | 50 + ...cessibleTypeInIndexerTypeAnnotations.types | 28 + ...essibleTypeInTypeParameterConstraint.types | 60 + ...esInParameterAndReturnTypeAnnotation.types | 39 + ...ssibleTypesInParameterTypeAnnotation.types | 39 + ...ccessibleTypesInReturnTypeAnnotation.types | 39 + ...assHeritageListMemberTypeAnnotations.types | 58 + ...cessibleTypeInIndexerTypeAnnotations.types | 28 + ...essibleTypeInTypeParameterConstraint.types | 58 + ...hAccessibleTypesOnItsExportedMembers.types | 48 + ...cessibleTypesInMemberTypeAnnotations.types | 30 + ...peWithInaccessibleTypeAsTypeArgument.types | 22 + ...leWithAccessibleTypeInTypeAnnotation.types | 23 + ...WithInaccessibleTypeInTypeAnnotation.types | 40 + ...leWithSameNameAndDifferentCommonRoot.types | 54 + ...duleAndEnumWithSameNameAndCommonRoot.types | 43 + ...edAndNonExportedClassesOfTheSameName.types | 97 + ...ndNonExportedInterfacesOfTheSameName.types | 103 + ...AndNonExportedLocalVarsOfTheSameName.types | 125 + ...hWithExportedInterfacesOfTheSameName.types | 112 + ...EachWithExportedModulesOfTheSameName.types | 76 + ...ithTheSameNameAndDifferentCommonRoot.types | 78 + ...ulesWithTheSameNameAndSameCommonRoot.types | 122 + .../reference/acceptableAlias1.types | 17 + .../accessOverriddenBaseClassMember1.types | 52 + .../baselines/reference/accessorWithES5.types | 41 + ...addMoreCallSignaturesToBaseSignature.types | 24 + ...ddMoreCallSignaturesToBaseSignature2.types | 25 + .../additionOperatorWithAnyAndEveryType.types | 168 + ...peratorWithNullValueAndValidOperator.types | 107 + .../additionOperatorWithNumberAndEnum.types | 67 + ...ditionOperatorWithStringAndEveryType.types | 158 + ...orWithUndefinedValueAndValidOperator.types | 123 + .../reference/aliasInaccessibleModule.types | 11 + .../reference/aliasInaccessibleModule2.types | 20 + .../reference/aliasUsageInArray.types | 48 + .../aliasUsageInFunctionExpression.types | 49 + .../aliasUsageInGenericFunction.types | 63 + .../aliasUsageInIndexerOfClass.types | 57 + .../reference/aliasUsageInObjectLiteral.types | 62 + .../reference/aliasUsageInOrExpression.types | 83 + ...asUsageInTypeArgumentOfExtendsClause.types | 53 + .../reference/aliasUsageInVarAssignment.types | 44 + .../reference/aliasUsedAsNameValue.types | 34 + .../ambientClassDeclarationWithExtends.types | 8 + .../reference/ambientDeclarations.types | 168 + .../ambientEnumElementInitializer1.types | 7 + .../ambientEnumElementInitializer2.types | 8 + .../ambientEnumElementInitializer4.types | 7 + .../ambientEnumElementInitializer5.types | 8 + .../ambientEnumElementInitializer6.types | 11 + .../ambientExternalModuleReopen.types | 9 + ...lModuleWithInternalImportDeclaration.types | 33 + ...duleWithoutInternalImportDeclaration.types | 29 + .../baselines/reference/ambientFundule.types | 12 + .../reference/ambientModuleExports.types | 63 + ...oduleWithClassDeclarationWithExtends.types | 11 + .../baselines/reference/ambientModules.types | 14 + .../ambiguousCallsWhereReturnTypesAgree.types | 78 + .../ambiguousOverloadResolution.types | 34 + .../amdImportAsPrimaryExpression.types | 25 + .../amdImportNotAsPrimaryExpression.types | 82 + tests/baselines/reference/anonterface.types | 41 + .../reference/anyAsFunctionCall.types | 23 + .../anyAsReturnTypeForNewOnCall.types | 35 + .../anyAssignabilityInInheritance.types | 321 + .../reference/anyAssignableToEveryType.types | 156 + .../anyInferenceAnonymousFunctions.types | 93 + .../reference/anyIsAssignableToObject.types | 15 + .../reference/anyIsAssignableToVoid.types | 15 + tests/baselines/reference/anyPlusAny1.types | 16 + .../reference/anyPropertyAccess.types | 43 + tests/baselines/reference/argsInScope.types | 36 + tests/baselines/reference/arguments.types | 9 + ...argumentsUsedInObjectLiteralProperty.types | 23 + .../arithmeticOperatorWithAnyAndNumber.types | 437 + .../arithmeticOperatorWithEnum.types | 893 + ...peratorWithNullValueAndValidOperands.types | 450 + ...orWithUndefinedValueAndValidOperands.types | 530 + .../reference/arrayAssignmentTest6.types | 52 + tests/baselines/reference/arrayAugment.types | 25 + .../reference/arrayBestCommonTypes.types | 327 + tests/baselines/reference/arrayConcat2.types | 28 + .../baselines/reference/arrayConcatMap.types | 26 + .../reference/arrayConstructors1.types | 43 + tests/baselines/reference/arrayLiteral.types | 47 + tests/baselines/reference/arrayLiteral1.types | 5 + tests/baselines/reference/arrayLiteral2.types | 6 + .../arrayLiteralInNonVarArgParameter.types | 11 + .../reference/arrayLiteralTypeInference.types | 156 + .../reference/arrayLiteralWidened.types | 50 + ...ayLiteralWithMultipleBestCommonTypes.types | 79 + tests/baselines/reference/arrayLiterals.types | 150 + .../arrayLiteralsWithRecursiveGenerics.types | 83 + .../reference/arrayOfExportedClass.types | 40 + .../reference/arrayOfFunctionTypes3.types | 108 + ...ayTypeInSignatureOfInterfaceAndClass.types | 89 + tests/baselines/reference/arrayconcat.types | 123 + .../reference/arrowFunctionExpressions.types | 288 + .../arrowFunctionInExpressionStatement1.types | 4 + .../arrowFunctionInExpressionStatement2.types | 7 + .../asiAmbientFunctionDeclaration.types | 4 + tests/baselines/reference/asiArith.types | 79 + tests/baselines/reference/asiBreak.types | 3 + tests/baselines/reference/asiContinue.types | 3 + .../baselines/reference/asiInES6Classes.types | 32 + tests/baselines/reference/assign1.types | 22 + .../reference/assignEveryTypeToAny.types | 162 + ...ignToObjectTypeWithPrototypeProperty.types | 17 + .../reference/assignToPrototype1.types | 24 + .../reference/assignmentCompatForEnums.types | 31 + .../reference/assignmentCompatOnNew.types | 14 + .../assignmentCompatWithCallSignatures3.types | 565 + .../assignmentCompatWithCallSignatures5.types | 380 + .../assignmentCompatWithCallSignatures6.types | 273 + ...gnmentCompatWithConstructSignatures3.types | 565 + ...gnmentCompatWithConstructSignatures5.types | 380 + ...gnmentCompatWithConstructSignatures6.types | 273 + ...nmentCompatWithGenericCallSignatures.types | 27 + ...mentCompatWithGenericCallSignatures2.types | 44 + ...mentCompatWithGenericCallSignatures3.types | 53 + .../assignmentCompatWithObjectMembers2.types | 153 + .../assignmentCompatWithObjectMembers3.types | 157 + ...tCompatWithObjectMembersNumericNames.types | 145 + ...atWithWithGenericConstructSignatures.types | 3 + .../reference/assignmentCompatability1.types | 41 + .../reference/assignmentCompatability2.types | 40 + .../reference/assignmentCompatability3.types | 42 + .../reference/assignmentCompatability4.types | 41 + .../reference/assignmentCompatability5.types | 47 + .../reference/assignmentCompatability6.types | 46 + .../reference/assignmentCompatability7.types | 50 + .../reference/assignmentCompatability8.types | 46 + .../reference/assignmentCompatability9.types | 46 + ...tibilityForConstrainedTypeParameters.types | 25 + .../reference/assignmentLHSIsReference.types | 74 + tests/baselines/reference/augmentArray.types | 7 + ...entedTypeBracketAccessIndexSignature.types | 36 + ...mentedTypeBracketNamedPropertyAccess.types | 41 + .../reference/augmentedTypesClass3.types | 31 + .../augmentedTypesExternalModule1.types | 11 + .../reference/augmentedTypesModules3b.types | 51 + .../reference/augmentedTypesModules4.types | 54 + .../autoAsiForStaticsInClassDeclaration.types | 10 + .../reference/autonumberingInEnums.types | 14 + tests/baselines/reference/avoid.types | 50 + .../reference/badOverloadError.types | 11 + .../baselines/reference/badThisBinding.types | 44 + .../baseIndexSignatureResolution.types | 50 + .../reference/baseTypeAfterDerivedType.types | 35 + .../reference/baseTypeOrderChecking.types | 51 + ...stCommonTypeOfConditionalExpressions.types | 118 + .../bestCommonTypeReturnStatement.types | 36 + .../bestCommonTypeWithContextualTyping.types | 56 + ...bestCommonTypeWithOptionalProperties.types | 70 + .../reference/binaryArithmatic1.types | 5 + .../reference/binaryArithmatic2.types | 6 + tests/baselines/reference/bind2.types | 3 + .../binopAssignmentShouldHaveType.types | 48 + .../bitwiseNotOperatorWithBooleanType.types | 112 + .../bitwiseNotOperatorWithEnumType.types | 61 + .../bitwiseNotOperatorWithNumberType.types | 162 + .../bitwiseNotOperatorWithStringType.types | 158 + tests/baselines/reference/bom-utf16be.types | 4 + tests/baselines/reference/bom-utf16le.types | 4 + tests/baselines/reference/bom-utf8.types | 4 + .../reference/booleanPropertyAccess.types | 17 + ...meterConstrainedToOuterTypeParameter.types | 21 + ...GenericFunctionWithZeroTypeArguments.types | 126 + ...SignatureAssignabilityInInheritance2.types | 398 + ...SignatureAssignabilityInInheritance4.types | 281 + ...SignatureAssignabilityInInheritance5.types | 314 + ...SignatureAssignabilityInInheritance6.types | 209 + .../callSignatureFunctionOverload.types | 33 + ...allSignatureWithoutAnnotationsOrBody.types | 55 + ...WithoutReturnTypeAnnotationInference.types | 276 + ...SignaturesThatDifferOnlyByReturnType.types | 76 + ...ignaturesThatDifferOnlyByReturnType3.types | 33 + ...callSignaturesWithOptionalParameters.types | 196 + ...allSignaturesWithOptionalParameters2.types | 203 + .../reference/callbacksDontShareTypes.types | 110 + .../reference/captureThisInSuperCall.types | 25 + .../reference/castExpressionParentheses.types | 170 + .../reference/castNewObjectBug.types | 11 + .../baselines/reference/castParentheses.types | 68 + tests/baselines/reference/castTest.types | 129 + tests/baselines/reference/catch.types | 11 + tests/baselines/reference/cf.types | 138 + .../reference/chainedAssignment2.types | 31 + .../reference/chainedImportAlias.types | 24 + ...nedSpecializationToObjectTypeLiteral.types | 71 + .../reference/checkInterfaceBases.types | 27 + .../reference/circularImportAlias.types | 47 + .../classAppearsToHaveMembersOfObject.types | 32 + ...rationMergedInModuleWithContinuation.types | 24 + .../reference/classExtendingClass.types | 112 + .../classExtendingQualifiedName2.types | 14 + .../classImplementingInterfaceIndexer.types | 16 + .../reference/classImplementsClass1.types | 8 + .../reference/classImplementsClass3.types | 39 + .../classImplementsImportedInterface.types | 28 + tests/baselines/reference/classIndexer.types | 10 + ...ssMemberInitializerWithLamdaScoping5.types | 32 + .../classMethodWithKeywordName1.types | 7 + tests/baselines/reference/classOrder1.types | 24 + tests/baselines/reference/classOrder2.types | 36 + tests/baselines/reference/classOrderBug.types | 31 + .../reference/classSideInheritance2.types | 46 + .../reference/classWithEmptyBody.types | 59 + .../classWithNoConstructorOrBaseClass.types | 45 + ...lyPublicMembersEquivalentToInterface.types | 73 + ...yPublicMembersEquivalentToInterface2.types | 76 + .../reference/classWithPublicProperty.types | 89 + .../cloduleAcrossModuleDefinitions.types | 31 + .../reference/cloduleAndTypeParameters.types | 25 + tests/baselines/reference/cloduleTest1.types | 34 + .../cloduleWithRecursiveReference.types | 17 + .../reference/collisionArgumentsInType.types | 53 + .../collisionArgumentsInterfaceMembers.types | 63 + ...ionCodeGenEnumWithEnumMemberConflict.types | 11 + ...CodeGenModuleWithConstructorChildren.types | 48 + ...nCodeGenModuleWithEnumMemberConflict.types | 15 + ...ionCodeGenModuleWithFunctionChildren.types | 44 + ...CodeGenModuleWithMemberClassConflict.types | 40 + ...GenModuleWithMemberInterfaceConflict.types | 19 + ...isionCodeGenModuleWithMemberVariable.types | 17 + ...isionCodeGenModuleWithMethodChildren.types | 68 + ...isionCodeGenModuleWithModuleChildren.types | 93 + ...sionCodeGenModuleWithModuleReopening.types | 93 + ...lisionCodeGenModuleWithPrivateMember.types | 23 + ...llisionCodeGenModuleWithUnicodeNames.types | 18 + .../collisionExportsRequireAndAlias.types | 21 + .../collisionExportsRequireAndClass.types | 8 + .../collisionExportsRequireAndEnum.types | 19 + .../collisionExportsRequireAndFunction.types | 12 + .../collisionExportsRequireAndModule.types | 35 + ...xportsRequireAndUninstantiatedModule.types | 29 + .../collisionExportsRequireAndVar.types | 10 + .../collisionRestParameterInType.types | 27 + ...llisionRestParameterInterfaceMembers.types | 44 + .../baselines/reference/commaOperator1.types | 27 + .../commaOperatorOtherValidOperation.types | 59 + ...ommaOperatorWithSecondOperandAnyType.types | 164 + ...OperatorWithSecondOperandBooleanType.types | 158 + ...aOperatorWithSecondOperandNumberType.types | 158 + ...aOperatorWithSecondOperandObjectType.types | 169 + ...aOperatorWithSecondOperandStringType.types | 169 + .../commaOperatorsMultipleOperators.types | 136 + .../commentBeforeStaticMethod1.types | 13 + .../commentInEmptyParameterList1.types | 4 + .../reference/commentInMethodCall.types | 15 + .../reference/commentOnAmbientClass1.types | 10 + .../reference/commentOnAmbientVariable1.types | 9 + .../reference/commentOnAmbientVariable2.types | 13 + .../reference/commentOnClassMethod1.types | 11 + .../reference/commentOnElidedModule1.types | 10 + .../commentOnExpressionStatement1.types | 5 + .../reference/commentOnIfStatement1.types | 6 + .../reference/commentOnInterface1.types | 10 + ...tOnParenthesizedExpressionOpenParen1.types | 15 + .../reference/commentOnSignature1.types | 15 + .../commentOnSimpleArrowFunctionBody1.types | 19 + .../reference/commentOnStaticMember1.types | 9 + .../reference/commentsAtEndOfFile1.types | 6 + .../commentsBeforeFunctionExpression1.types | 13 + .../commentsBeforeVariableStatement1.types | 5 + tests/baselines/reference/commentsClass.types | 131 + .../reference/commentsClassMembers.types | 754 + .../reference/commentsCommentParsing.types | 255 + .../reference/commentsDottedModuleName.types | 12 + tests/baselines/reference/commentsEnums.types | 28 + .../reference/commentsExternalModules.types | 155 + .../reference/commentsFunction.types | 69 + .../reference/commentsInheritance.types | 319 + .../reference/commentsInterface.types | 276 + .../baselines/reference/commentsModules.types | 226 + .../commentsMultiModuleMultiFile.types | 62 + .../commentsMultiModuleSingleFile.types | 43 + .../commentsOnReturnStatement1.types | 15 + .../reference/commentsOnStaticMembers.types | 29 + .../reference/commentsOverloads.types | 436 + .../commentsPropertySignature1.types | 14 + .../baselines/reference/commentsVarDecl.types | 74 + .../commentsVariableStatement1.types | 6 + .../reference/commentsdoNotEmitComments.types | 153 + .../reference/commentsemitComments.types | 153 + .../commonJSImportAsPrimaryExpression.types | 25 + ...commonJSImportNotAsPrimaryExpression.types | 82 + ...mparisonOperatorWithIdenticalObjects.types | 847 + ...onOperatorWithIdenticalPrimitiveType.types | 351 + ...onOperatorWithIdenticalTypeParameter.types | 55 + ...omparisonOperatorWithOneOperandIsAny.types | 815 + ...mparisonOperatorWithOneOperandIsNull.types | 684 + ...sonOperatorWithOneOperandIsUndefined.types | 816 + ...isonOperatorWithSubtypeEnumAndNumber.types | 358 + ...atorWithSubtypeObjectOnCallSignature.types | 1236 ++ ...hSubtypeObjectOnConstructorSignature.types | 1023 ++ ...torWithSubtypeObjectOnIndexSignature.types | 444 + ...rWithSubtypeObjectOnOptionalProperty.types | 130 + ...nOperatorWithSubtypeObjectOnProperty.types | 271 + ...parisonOperatorWithTwoOperandsAreAny.types | 52 + .../reference/complexClassRelationships.types | 122 + .../reference/compositeGenericFunction.types | 28 + ...ndAdditionAssignmentLHSCanBeAssigned.types | 189 + ...ArithmeticAssignmentLHSCanBeAssigned.types | 99 + .../compoundAssignmentLHSIsReference.types | 124 + .../reference/compoundVarDecl1.types | 14 + tests/baselines/reference/concatError.types | 50 + .../reference/conditionalExpressions2.types | 44 + ...tionalOperatorConditionIsBooleanType.types | 230 + ...itionalOperatorConditionIsNumberType.types | 247 + ...itionalOperatorConditionIsObjectType.types | 296 + ...onditionalOperatorConditoinIsAnyType.types | 259 + ...itionalOperatorConditoinIsStringType.types | 245 + .../conditionalOperatorWithIdenticalBCT.types | 188 + ...eOverloadsCausedByOverloadResolution.types | 97 + .../conformanceFunctionOverloads.types | 25 + .../reference/constantOverloadFunction.types | 48 + ...raintCheckInGenericBaseTypeReference.types | 44 + ...straintPropagationThroughReturnTypes.types | 29 + .../constraintSatisfactionWithAny.types | 150 + ...onstraintSatisfactionWithEmptyObject.types | 107 + .../constraintsUsedInPrototypeProperty.types | 12 + ...SignatureAssignabilityInInheritance2.types | 398 + ...SignatureAssignabilityInInheritance4.types | 332 + ...SignatureAssignabilityInInheritance5.types | 314 + ...SignatureAssignabilityInInheritance6.types | 209 + ...ructSignaturesWithIdenticalOverloads.types | 158 + .../constructSignaturesWithOverloads.types | 159 + ...hOverloadsThatDifferOnlyByReturnType.types | 99 + ...nstructorArgWithGenericCallSignature.types | 46 + .../baselines/reference/constructorArgs.types | 32 + ...orFunctionTypeIsAssignableToBaseType.types | 38 + ...rFunctionTypeIsAssignableToBaseType2.types | 62 + .../constructorHasPrototypeProperty.types | 100 + ...uctorImplementationWithDefaultValues.types | 50 + .../reference/constructorOverloads2.types | 73 + ...uctorOverloadsWithOptionalParameters.types | 29 + .../constructorReturningAPrimitive.types | 36 + .../constructorStaticParamName.types | 10 + .../constructorTypeWithTypeParameters.types | 16 + .../constructorWithExpressionLessReturn.types | 41 + ...contextualSigInstantiationRestParams.types | 20 + .../contextualSignatureInstantiation1.types | 60 + .../contextualSignatureInstantiation2.types | 61 + .../contextualSignatureInstantiation3.types | 83 + ...meterConstrainedToOuterTypeParameter.types | 35 + ...lSignatureInstatiationContravariance.types | 48 + ...xtualSignatureInstatiationCovariance.types | 48 + .../reference/contextualTypeAny.types | 17 + .../contextualTypeAppliedToVarArgs.types | 52 + .../contextualTypeArrayReturnType.types | 57 + .../reference/contextualTyping1.types | 7 + .../reference/contextualTyping10.types | 11 + .../reference/contextualTyping12.types | 12 + .../reference/contextualTyping13.types | 8 + .../reference/contextualTyping14.types | 9 + .../reference/contextualTyping15.types | 7 + .../reference/contextualTyping16.types | 11 + .../reference/contextualTyping17.types | 12 + .../reference/contextualTyping18.types | 13 + .../reference/contextualTyping19.types | 15 + .../reference/contextualTyping2.types | 8 + .../reference/contextualTyping20.types | 16 + .../reference/contextualTyping22.types | 13 + .../reference/contextualTyping23.types | 10 + .../reference/contextualTyping25.types | 12 + .../reference/contextualTyping26.types | 12 + .../reference/contextualTyping27.types | 12 + .../reference/contextualTyping28.types | 8 + .../reference/contextualTyping29.types | 8 + .../reference/contextualTyping3.types | 8 + .../reference/contextualTyping31.types | 8 + .../reference/contextualTyping32.types | 11 + .../reference/contextualTyping34.types | 9 + .../reference/contextualTyping35.types | 9 + .../reference/contextualTyping36.types | 13 + .../reference/contextualTyping37.types | 10 + .../reference/contextualTyping38.types | 8 + .../reference/contextualTyping4.types | 9 + .../reference/contextualTyping40.types | 7 + .../reference/contextualTyping6.types | 10 + .../reference/contextualTyping7.types | 10 + .../reference/contextualTyping8.types | 10 + .../reference/contextualTyping9.types | 11 + .../contextualTypingArrayOfLambdas.types | 37 + ...textualTypingOfConditionalExpression.types | 55 + ...TypingOfLambdaWithMultipleSignatures.types | 25 + ...ypingOfLambdaWithMultipleSignatures2.types | 21 + ...ypingTwoInstancesOfSameTypeParameter.types | 24 + ...ingWithGenericAndNonGenericSignature.types | 55 + ...contextualTypingWithGenericSignature.types | 25 + .../contextuallyTypingOrOperator.types | 54 + .../contextuallyTypingOrOperator2.types | 32 + .../baselines/reference/convertKeywords.types | 6 + .../reference/convertKeywordsYes.types | 936 ++ tests/baselines/reference/covariance1.types | 47 + .../reference/crashInResolveInterface.types | 53 + .../crashInresolveReturnStatement.types | 42 + .../reference/cyclicModuleImport.types | 40 + tests/baselines/reference/debugger.types | 9 + tests/baselines/reference/debuggerEmit.types | 9 + .../reference/declFileAccessors.types | 160 + ...ternalModuleWithSingleExportedModule.types | 29 + .../reference/declFileCallSignatures.types | 117 + .../declFileClassWithIndexSignature.types | 8 + ...WithStaticMethodReturningConstructor.types | 12 + .../declFileConstructSignatures.types | 121 + .../reference/declFileConstructors.types | 176 + .../reference/declFileEnumUsedAsValue.types | 18 + tests/baselines/reference/declFileEnums.types | 78 + ...ExportAssignmentImportInternalModule.types | 58 + ...leExportAssignmentOfGenericInterface.types | 26 + .../reference/declFileExportImportChain.types | 43 + .../declFileExportImportChain2.types | 38 + ...lFileForClassWithMultipleBaseClasses.types | 54 + ...orClassWithPrivateOverloadedFunction.types | 17 + .../reference/declFileForExportedImport.types | 25 + ...clFileForFunctionTypeAsTypeParameter.types | 16 + ...FileForInterfaceWithOptionalFunction.types | 13 + .../declFileForInterfaceWithRestParams.types | 22 + .../reference/declFileForTypeParameters.types | 22 + .../reference/declFileForVarList.types | 12 + .../reference/declFileFunctions.types | 142 + ...GenericClassWithGenericExtendedClass.types | 38 + .../reference/declFileGenericType.types | 167 + .../reference/declFileGenericType2.types | 140 + ...FileImportModuleWithExportAssignment.types | 64 + ...FileImportedTypeUseInTypeArgPosition.types | 24 + .../reference/declFileIndexSignatures.types | 66 + .../reference/declFileInternalAliases.types | 34 + .../baselines/reference/declFileMethods.types | 447 + ...uleAssignmentInObjectLiteralProperty.types | 31 + .../declFileModuleContinuation.types | 22 + ...clFileModuleWithPropertyOfTypeModule.types | 13 + .../declFileOptionalInterfaceMethod.types | 9 + .../reference/declFileRegressionTests.types | 13 + ...tParametersOfFunctionAndFunctionType.types | 34 + .../reference/declFileTypeofClass.types | 39 + .../reference/declFileTypeofEnum.types | 41 + .../reference/declFileTypeofFunction.types | 88 + .../declFileTypeofInAnonymousType.types | 91 + .../reference/declFileTypeofModule.types | 32 + ...tingWithClassReferredByExtendsClause.types | 50 + ...lauseThatHasItsContainerNameConflict.types | 38 + ...lModuleNameConflictsInExtendsClause1.types | 28 + ...lModuleNameConflictsInExtendsClause2.types | 35 + ...lModuleNameConflictsInExtendsClause3.types | 36 + tests/baselines/reference/declInput-2.types | 74 + tests/baselines/reference/declInput3.types | 32 + tests/baselines/reference/declInput4.types | 47 + ...array-types-from-generic-array-usage.types | 5 + .../declarationEmit_nameConflicts.types | 149 + .../declarationEmit_nameConflicts2.types | 69 + .../declarationEmit_nameConflicts3.types | 77 + ...clarationEmit_nameConflictsWithAlias.types | 22 + .../reference/declareDottedExtend.types | 25 + .../reference/declareDottedModuleName.types | 21 + ...ernalModuleWithExportAssignedFundule.types | 41 + .../declareFileExportAssignment.types | 50 + ...signmentWithVarFromVariableStatement.types | 51 + .../reference/declaredExternalModule.types | 45 + ...edExternalModuleWithExportAssignment.types | 44 + .../decrementOperatorWithAnyOtherType.types | 191 + .../decrementOperatorWithEnumType.types | 30 + .../decrementOperatorWithNumberType.types | 137 + .../reference/defaultIndexProps1.types | 28 + .../reference/defaultIndexProps2.types | 29 + .../deleteOperatorWithBooleanType.types | 112 + .../deleteOperatorWithEnumType.types | 76 + .../deleteOperatorWithNumberType.types | 165 + .../deleteOperatorWithStringType.types | 161 + .../reference/dependencyViaImportAlias.types | 16 + .../baselines/reference/deprecatedBool.types | 7 + ...sIndexersWithAssignmentCompatibility.types | 34 + .../derivedClassOverridesWithoutSubtype.types | 46 + .../baselines/reference/derivedClasses.types | 91 + ...HiddenBaseCallViaSuperPropertyAccess.types | 60 + ...rivedTypeDoesNotRequireExtendsClause.types | 55 + ...denAtObjectLiteralPropertyAssignment.types | 30 + .../reference/doWhileBreakStatements.types | 42 + .../reference/doWhileContinueStatements.types | 42 + tests/baselines/reference/doWhileLoop.types | 5 + .../reference/dottedModuleName2.types | 76 + .../reference/dottedSymbolResolution1.types | 92 + .../reference/duplicateAnonymousInners1.types | 33 + .../duplicateAnonymousModuleClasses.types | 71 + .../duplicateConstructSignature.types | 7 + .../duplicateConstructSignature2.types | 13 + ...uplicateConstructorOverloadSignature.types | 13 + ...plicateConstructorOverloadSignature2.types | 16 + ...ShouldNotShortCircuitBaseTypeBinding.types | 3 + ...duplicateOverloadInTypeAugmentation1.types | 57 + .../reference/duplicateVarAndImport.types | 13 + .../duplicateVariableDeclaration1.types | 7 + .../reference/duplicateVariablesByScope.types | 60 + .../dynamicModuleTypecheckError.types | 19 + tests/baselines/reference/emitBOM.types | 6 + .../reference/emitCommentsOnlyFile.types | 30 + .../emitMemberAccessExpression.types | 43 + .../reference/emitPostComments.types | 32 + .../baselines/reference/emitPreComments.types | 33 + tests/baselines/reference/emptyEnum.types | 4 + tests/baselines/reference/emptyExpr.types | 5 + .../reference/emptyFile-declaration.types | 3 + .../reference/emptyFile-souremap.types | 3 + tests/baselines/reference/emptyFile.types | 3 + tests/baselines/reference/emptyIndexer.types | 29 + tests/baselines/reference/enumBasics.types | 221 + .../reference/enumCodeGenNewLines1.types | 14 + tests/baselines/reference/enumDecl1.types | 19 + .../reference/enumFromExternalModule.types | 18 + .../reference/enumIdentifierLiterals.types | 10 + tests/baselines/reference/enumIndexer.types | 38 + .../reference/enumMapBackIntoItself.types | 30 + tests/baselines/reference/enumMerging.types | 204 + .../reference/enumNegativeLiteral1.types | 11 + .../baselines/reference/enumNumbering1.types | 29 + .../baselines/reference/enumOperations.types | 62 + .../enumWithQuotedElementName1.types | 6 + .../enumWithQuotedElementName2.types | 6 + .../reference/enumWithUnicodeEscape1.types | 7 + .../enumsWithMultipleDeclarations3.types | 11 + tests/baselines/reference/es3-amd.types | 16 + .../reference/es3-declaration-amd.types | 16 + .../reference/es3-sourcemap-amd.types | 16 + tests/baselines/reference/es5-amd.types | 16 + .../reference/es5-declaration-amd.types | 16 + .../reference/es5-souremap-amd.types | 16 + .../reference/es6ClassSuperCodegenBug.types | 24 + tests/baselines/reference/es6ClassTest4.types | 31 + tests/baselines/reference/es6ClassTest5.types | 29 + tests/baselines/reference/es6ClassTest7.types | 15 + tests/baselines/reference/es6ClassTest8.types | 183 + .../reference/escapedIdentifiers.types | 297 + .../reference/everyTypeAssignableToAny.types | 214 + ...veryTypeWithAnnotationAndInitializer.types | 156 + .../reference/everyTypeWithInitializer.types | 135 + .../exportAssignClassAndModule.types | 38 + .../reference/exportAssignValueAndType.types | 33 + .../exportAssignedTypeAsTypeAnnotation.types | 23 + .../exportAssignmentCircularModules.types | 48 + .../reference/exportAssignmentClass.types | 23 + .../reference/exportAssignmentEnum.types | 39 + .../reference/exportAssignmentError.types | 15 + .../reference/exportAssignmentFunction.types | 16 + .../exportAssignmentGenericType.types | 27 + .../reference/exportAssignmentInterface.types | 25 + .../exportAssignmentInternalModule.types | 21 + .../exportAssignmentMergedInterface.types | 69 + .../exportAssignmentMergedModule.types | 62 + .../exportAssignmentOfGenericType1.types | 29 + .../exportAssignmentTopLevelClodule.types | 32 + .../exportAssignmentTopLevelEnumdule.types | 41 + .../exportAssignmentTopLevelFundule.types | 31 + .../exportAssignmentTopLevelIdentifier.types | 22 + .../reference/exportAssignmentVariable.types | 15 + ...nmentWithImportStatementPrivacyError.types | 57 + .../exportAssignmentWithPrivacyError.types | 43 + tests/baselines/reference/exportCodeGen.types | 111 + .../reference/exportEqualCallable.types | 19 + .../reference/exportEqualNamespaces.types | 32 + tests/baselines/reference/exportImport.types | 28 + .../reference/exportImportAlias.types | 175 + .../reference/exportImportAndClodule.types | 57 + .../reference/exportImportMultipleFiles.types | 31 + .../exportImportNonInstantiatedModule.types | 26 + .../exportImportNonInstantiatedModule2.types | 26 + .../reference/exportPrivateType.types | 70 + .../reference/exportVisibility.types | 18 + ...erfaceInaccessibleInCallbackInModule.types | 42 + .../reference/exportedVariable1.types | 15 + tests/baselines/reference/extBaseClass1.types | 36 + .../extendAndImplementTheSameBaseType.types | 46 + .../extendBaseClassBeforeItsDeclared.types | 9 + .../reference/extendBooleanInterface.types | 44 + .../reference/extendNumberInterface.types | 44 + .../reference/extendStringInterface.types | 44 + .../extendedInterfaceGenericType.types | 40 + ...ndingClassFromAliasAndUsageInIndexer.types | 83 + tests/baselines/reference/externFunc.types | 9 + .../reference/externModuleClobber.types | 39 + .../reference/externalModuleAssignToVar.types | 64 + .../externalModuleQualification.types | 29 + ...fImportDeclarationWithExportModifier.types | 14 + .../reference/externalModuleResolution.types | 19 + .../reference/externalModuleResolution2.types | 19 + tests/baselines/reference/fatArrowSelf.types | 64 + .../reference/fatArrowfunctionAsType.types | 22 + .../reference/fatarrowfunctions.types | 246 + ...functionsInFunctionParameterDefaults.types | 22 + .../fatarrowfunctionsInFunctions.types | 61 + .../fileReferencesWithNoExtensions.types | 32 + ...illInMissingTypeArgsOnConstructCalls.types | 15 + ...rameterInSignatureWithRestParameters.types | 13 + .../reference/forBreakStatements.types | 41 + .../reference/forContinueStatements.types | 41 + .../reference/forInBreakStatements.types | 70 + .../reference/forInContinueStatements.types | 70 + tests/baselines/reference/forInModule.types | 17 + .../baselines/reference/forInStatement1.types | 8 + .../baselines/reference/forInStatement3.types | 14 + .../baselines/reference/forInStatement5.types | 11 + .../baselines/reference/forInStatement6.types | 11 + tests/baselines/reference/forStatements.types | 155 + .../forStatementsMultipleValidDecl.types | 126 + tests/baselines/reference/funcdecl.types | 171 + .../reference/functionAssignmentError.types | 10 + tests/baselines/reference/functionCall1.types | 9 + tests/baselines/reference/functionCall2.types | 9 + tests/baselines/reference/functionCall3.types | 10 + tests/baselines/reference/functionCall4.types | 13 + tests/baselines/reference/functionCall5.types | 20 + .../functionConstraintSatisfaction.types | 256 + .../functionConstraintSatisfaction3.types | 163 + ...nWithArgumentOfTypeFunctionTypeArray.types | 12 + ...onExpressionAndLambdaMatchesFunction.types | 23 + .../functionExpressionReturningItself.types | 7 + .../reference/functionImplementations.types | 342 + .../functionInIfStatementInModule.types | 14 + .../baselines/reference/functionLiteral.types | 41 + .../functionLiteralForOverloads.types | 69 + .../functionLiteralForOverloads2.types | 78 + .../reference/functionLiterals.types | 244 + .../reference/functionMergedWithModule.types | 32 + .../reference/functionOnlyHasThrow.types | 8 + .../reference/functionOverloads10.types | 14 + .../reference/functionOverloads12.types | 10 + .../reference/functionOverloads13.types | 13 + .../reference/functionOverloads14.types | 15 + .../reference/functionOverloads15.types | 19 + .../reference/functionOverloads16.types | 17 + .../reference/functionOverloads21.types | 18 + .../reference/functionOverloads23.types | 16 + .../reference/functionOverloads24.types | 17 + .../reference/functionOverloads25.types | 17 + .../reference/functionOverloads26.types | 17 + .../reference/functionOverloads28.types | 19 + .../reference/functionOverloads30.types | 19 + .../reference/functionOverloads31.types | 19 + .../reference/functionOverloads32.types | 21 + .../reference/functionOverloads33.types | 19 + .../reference/functionOverloads35.types | 24 + .../reference/functionOverloads36.types | 24 + .../reference/functionOverloads38.types | 25 + .../reference/functionOverloads39.types | 25 + .../reference/functionOverloads42.types | 25 + .../reference/functionOverloads6.types | 16 + .../reference/functionOverloads7.types | 35 + .../reference/functionOverloads8.types | 12 + .../reference/functionOverloads9.types | 14 + .../functionOverloadsOnGenericArity1.types | 29 + .../functionOverloadsOnGenericArity2.types | 20 + ...nOverloadsRecursiveGenericReturnType.types | 49 + .../baselines/reference/functionReturn.types | 31 + .../reference/functionReturningItself.types | 7 + .../functionSubtypingOfVarArgs.types | 41 + .../functionSubtypingOfVarArgs2.types | 43 + tests/baselines/reference/functionType.types | 19 + ...thAnyReturnTypeAndNoReturnExpression.types | 13 + ...unctionWithMultipleReturnStatements2.types | 146 + ...ExportedClassIsUsedBeforeDeclaration.types | 26 + ...fFunctionWithoutReturnTypeAnnotation.types | 16 + .../funduleUsedAcrossFileBoundary.types | 39 + .../reference/generatedContextualTyping.types | 3705 +++++ .../generativeRecursionWithTypeOf.types | 28 + ...dNonGenericInterfaceWithTheSameName2.types | 54 + .../genericAndNonGenericOverload1.types | 24 + ...nericArgumentCallSigAssignmentCompat.types | 67 + tests/baselines/reference/genericArray0.types | 21 + tests/baselines/reference/genericArray1.types | 25 + .../genericArrayPropertyAssignment.types | 19 + .../genericBaseClassLiteralProperty.types | 36 + .../genericBaseClassLiteralProperty2.types | 44 + .../genericCallTypeArgumentInference.types | 366 + .../genericCallWithArrayLiteralArgs.types | 60 + ...WithConstraintsTypeArgumentInference.types | 488 + .../genericCallWithFixedArguments.types | 22 + ...enericCallWithFunctionTypedArguments.types | 173 + ...nericCallWithFunctionTypedArguments2.types | 161 + ...nericCallWithFunctionTypedArguments3.types | 56 + ...nericCallWithFunctionTypedArguments4.types | 66 + ...ricCallWithGenericSignatureArguments.types | 216 + ...icCallWithGenericSignatureArguments3.types | 202 + .../genericCallWithNonGenericArgs1.types | 10 + .../genericCallWithNonSymmetricSubtypes.types | 117 + .../genericCallWithObjectLiteralArgs.types | 50 + .../genericCallWithObjectTypeArgs.types | 68 + .../genericCallWithObjectTypeArgs2.types | 129 + ...CallWithObjectTypeArgsAndConstraints.types | 108 + ...allWithObjectTypeArgsAndConstraints2.types | 143 + ...ricCallWithObjectTypeArgsAndIndexers.types | 66 + ...lWithObjectTypeArgsAndNumericIndexer.types | 101 + ...llWithObjectTypeArgsAndStringIndexer.types | 104 + ...hOverloadedConstructorTypedArguments.types | 173 + ...WithOverloadedFunctionTypedArguments.types | 182 + .../genericCallbacksAndClassHierarchy.types | 83 + ...ingGenericInterfaceFromAnotherModule.types | 19 + ...heritsConstructorFromNonGenericClass.types | 16 + ...assPropertyInheritanceSpecialization.types | 254 + .../reference/genericClassStaticMethod.types | 21 + ...lassWithFunctionTypedMemberArguments.types | 297 + ...lassWithObjectTypeArgsAndConstraints.types | 240 + .../genericClassWithStaticFactory.types | 603 + .../baselines/reference/genericClasses0.types | 20 + .../baselines/reference/genericClasses1.types | 21 + .../baselines/reference/genericClasses2.types | 54 + .../baselines/reference/genericClasses3.types | 48 + .../baselines/reference/genericClasses4.types | 98 + .../reference/genericClassesInModule.types | 22 + .../reference/genericClassesInModule2.types | 63 + .../reference/genericCloduleInModule.types | 33 + .../genericConstraintDeclaration.types | 16 + ...ericConstraintOnExtendedBuiltinTypes.types | 65 + ...ricConstraintOnExtendedBuiltinTypes2.types | 65 + ...genericConstructSignatureInInterface.types | 19 + ...enericContextualTypingSpecialization.types | 16 + .../genericFunctionHasFreshTypeArgs.types | 21 + .../genericFunctionSpecializations1.types | 24 + .../reference/genericFunctions0.types | 13 + .../reference/genericFunctions1.types | 13 + .../reference/genericFunctions2.types | 28 + .../reference/genericFunctions3.types | 30 + ...ericFunctionsWithOptionalParameters1.types | 50 + ...ericFunctionsWithOptionalParameters3.types | 108 + .../reference/genericImplements.types | 60 + .../reference/genericInference1.types | 12 + .../reference/genericInference2.types | 102 + .../reference/genericInstanceOf.types | 31 + ...stantiationEquivalentToObjectLiteral.types | 68 + ...enericInterfaceFunctionTypeParameter.types | 21 + .../genericInterfaceImplementation.types | 42 + .../reference/genericInterfaceTypeCall.types | 60 + .../genericMethodOverspecialization.types | 93 + .../genericObjectLitReturnType.types | 33 + .../reference/genericOfACloduleType1.types | 46 + .../reference/genericOfACloduleType2.types | 50 + .../reference/genericOverloadSignatures.types | 101 + .../genericParameterAssignability1.types | 21 + .../reference/genericPrototypeProperty.types | 36 + .../reference/genericPrototypeProperty2.types | 39 + .../reference/genericPrototypeProperty3.types | 33 + ...cRecursiveImplicitConstructorErrors2.types | 68 + .../genericReversingTypeParameters.types | 51 + .../genericReversingTypeParameters2.types | 44 + .../genericSignatureInheritance.types | 14 + .../genericSignatureInheritance2.types | 20 + .../genericSpecializationToTypeLiteral1.types | 178 + .../reference/genericSpecializations1.types | 42 + .../genericStaticAnyTypeFunction.types | 40 + .../genericTypeArgumentInference1.types | 88 + .../reference/genericTypeAssertions3.types | 23 + .../genericTypeParameterEquivalence2.types | 228 + .../genericTypeWithCallableMembers.types | 38 + .../genericTypeWithCallableMembers2.types | 22 + .../genericTypeWithMultipleBases1.types | 49 + .../genericTypeWithMultipleBases2.types | 48 + .../genericTypeWithMultipleBases3.types | 49 + ...CallSignatureReturningSpecialization.types | 21 + .../genericWithCallSignatures1.types | 40 + ...nericWithIndexerOfTypeParameterType1.types | 34 + ...nericWithIndexerOfTypeParameterType2.types | 32 + tests/baselines/reference/generics0.types | 20 + .../reference/generics1NoError.types | 49 + .../reference/generics2NoError.types | 61 + tests/baselines/reference/generics3.types | 30 + .../reference/generics4NoError.types | 25 + .../genericsAndHigherOrderFunctions.types | 131 + .../genericsManyTypeParameters.types | 565 + .../reference/getterSetterNonAccessor.types | 48 + tests/baselines/reference/global.types | 25 + tests/baselines/reference/globalThis.types | 7 + .../reference/globalThisCapture.types | 18 + .../heterogeneousArrayLiterals.types | 548 + .../reference/hidingCallSignatures.types | 59 + .../reference/hidingConstructSignatures.types | 59 + .../reference/hidingIndexSignatures.types | 32 + tests/baselines/reference/icomparable.types | 34 + tests/baselines/reference/idInProp.types | 10 + .../reference/identicalCallSignatures.types | 61 + .../reference/identicalCallSignatures2.types | 23 + .../reference/identicalCallSignatures3.types | 33 + ...SignaturesWithTypeParametersSwitched.types | 21 + .../reference/ifDoWhileStatements.types | 381 + .../reference/illegalGenericWrapping1.types | 44 + .../reference/implementArrayInterface.types | 217 + .../implementInterfaceAnyMemberWithVoid.types | 19 + .../implicitAnyAnyReturningFunction.types | 41 + ...AnyDeclareFunctionWithoutFormalType2.types | 32 + .../reference/implicitAnyGenerics.types | 83 + .../reference/implicitAnyInCatch.types | 30 + .../reference/importAliasIdentifiers.types | 123 + .../reference/importAliasWithDottedName.types | 37 + ...mportAndVariableDeclarationConflict2.types | 23 + ...clWithExportModifierInAmbientContext.types | 19 + .../importDeclarationUsedAsTypeQuery.types | 17 + .../reference/importImportOnlyModule.types | 26 + .../reference/importInTypePosition.types | 49 + .../importOnAliasedIdentifiers.types | 33 + .../reference/importShadowsGlobalName.types | 19 + .../reference/importStatements.types | 93 + .../reference/importUsedInExtendsList1.types | 25 + .../import_reference-exported-alias.types | 48 + .../import_reference-to-type-alias.types | 39 + ...ferenecing-aliased-type-throug-array.types | 28 + ...referencing-an-imported-module-alias.types | 20 + .../importedModuleClassNameClash.types | 11 + .../reference/inOperatorWithFunction.types | 13 + .../reference/inOperatorWithGeneric.types | 16 + .../inOperatorWithValidOperands.types | 69 + .../incrementOperatorWithAnyOtherType.types | 191 + .../incrementOperatorWithEnumType.types | 30 + .../incrementOperatorWithNumberType.types | 137 + .../reference/indexClassByNumber.types | 16 + tests/baselines/reference/indexIntoEnum.types | 12 + .../indexSignaturesInferentialTyping.types | 47 + tests/baselines/reference/indexer.types | 31 + tests/baselines/reference/indexer2.types | 21 + tests/baselines/reference/indexer3.types | 13 + tests/baselines/reference/indexerA.types | 31 + .../indexerReturningTypeParameter1.types | 44 + .../reference/indexersInClassType.types | 49 + .../reference/inferSecondaryParameter.types | 37 + ...gumentsInSignatureWithRestParameters.types | 51 + .../inferentialTypingWithFunctionType.types | 26 + .../inferentialTypingWithFunctionType2.types | 20 + ...erentialTypingWithFunctionTypeNested.types | 30 + ...ngWithFunctionTypeSyntacticScenarios.types | 120 + ...inferentialTypingWithFunctionTypeZip.types | 46 + .../inferentiallyTypingAnEmptyArray.types | 30 + ...gTypeThroughInheritanceInstantiation.types | 25 + ...nfiniteExpansionThroughTypeInference.types | 30 + .../infinitelyExpandingBaseTypes1.types | 32 + .../infinitelyExpandingBaseTypes2.types | 30 + ...infinitelyExpandingTypeAssignability.types | 37 + .../reference/infinitelyExpandingTypes3.types | 55 + .../reference/infinitelyExpandingTypes4.types | 75 + .../reference/infinitelyExpandingTypes5.types | 49 + ...finitelyExpandingTypesNonGenericBase.types | 56 + .../infinitelyGenerativeInheritance1.types | 41 + ...eNamePrivatePropertiesFromSameOrigin.types | 23 + ...nheritanceMemberFuncOverridingMethod.types | 21 + ...anceMemberPropertyOverridingProperty.types | 15 + ...heritanceOfGenericConstructorMethod1.types | 36 + ...heritanceOfGenericConstructorMethod2.types | 55 + ...nheritanceStaticFuncOverridingMethod.types | 21 + ...aticFuncOverridingPropertyOfFuncType.types | 18 + ...icFunctionOverridingInstanceProperty.types | 22 + .../inheritanceStaticMembersCompatible.types | 17 + ...anceStaticPropertyOverridingProperty.types | 15 + ...ritedFunctionAssignmentCompatibility.types | 25 + .../inheritedGenericCallSignature.types | 51 + ...ndIndexSignaturesFromDifferentBases2.types | 22 + ...ritedOverloadedSpecializedSignatures.types | 90 + .../reference/initializersWidened.types | 10 + tests/baselines/reference/innerAliases2.types | 45 + .../reference/innerBoundLambdaEmit.types | 21 + tests/baselines/reference/innerExtern.types | 29 + tests/baselines/reference/innerFunc.types | 27 + .../baselines/reference/innerOverloads.types | 29 + .../innerTypeArgumentInference.types | 19 + .../innerTypeParameterShadowingOuterOne.types | 77 + ...innerTypeParameterShadowingOuterOne2.types | 90 + .../instanceAndStaticDeclarations1.types | 65 + .../instanceMemberInitialization.types | 34 + .../instanceOfInExternalModules.types | 22 + .../reference/instanceSubtypeCheck1.types | 24 + .../reference/instanceofOperatorWithAny.types | 10 + .../instanceofOperatorWithLHSIsObject.types | 40 + ...anceofOperatorWithLHSIsTypeParameter.types | 16 + ...ofOperatorWithRHSIsSubtypeOfFunction.types | 57 + ...ateGenericClassWithZeroTypeArguments.types | 36 + .../reference/instantiatedModule.types | 197 + ...instantiatedReturnTypeContravariance.types | 43 + .../interMixingModulesInterfaces0.types | 37 + .../interMixingModulesInterfaces1.types | 37 + .../interMixingModulesInterfaces2.types | 31 + .../interMixingModulesInterfaces3.types | 31 + .../interMixingModulesInterfaces4.types | 34 + .../interMixingModulesInterfaces5.types | 34 + tests/baselines/reference/interface0.types | 16 + .../reference/interfaceContextualType.types | 67 + .../reference/interfaceDeclaration5.types | 8 + .../reference/interfaceExtendsClass1.types | 39 + .../reference/interfaceInReopenedModule.types | 21 + .../reference/interfaceInheritance2.types | 19 + tests/baselines/reference/interfaceOnly.types | 11 + .../interfacePropertiesWithSameName1.types | 33 + .../reference/interfaceSubtyping.types | 18 + .../interfaceThatHidesBaseProperty.types | 22 + ...terfaceWithCallAndConstructSignature.types | 22 + ...CallSignaturesThatHidesBaseSignature.types | 26 + ...allSignaturesThatHidesBaseSignature2.types | 26 + ...ructSignaturesThatHidesBaseSignature.types | 26 + ...uctSignaturesThatHidesBaseSignature2.types | 26 + .../interfaceWithOptionalProperty.types | 8 + ...OverloadedCallAndConstructSignatures.types | 38 + .../interfaceWithPropertyOfEveryType.types | 164 + ...pecializedCallAndConstructSignatures.types | 42 + tests/baselines/reference/interfacedecl.types | 95 + .../reference/internalAliasClass.types | 23 + ...liasClassInsideLocalModuleWithExport.types | 51 + ...sClassInsideLocalModuleWithoutExport.types | 41 + ...sClassInsideTopLevelModuleWithExport.types | 34 + ...assInsideTopLevelModuleWithoutExport.types | 34 + .../reference/internalAliasEnum.types | 34 + ...AliasEnumInsideLocalModuleWithExport.types | 34 + ...asEnumInsideLocalModuleWithoutExport.types | 34 + ...asEnumInsideTopLevelModuleWithExport.types | 30 + ...numInsideTopLevelModuleWithoutExport.types | 30 + .../reference/internalAliasFunction.types | 31 + ...sFunctionInsideLocalModuleWithExport.types | 31 + ...nctionInsideLocalModuleWithoutExport.types | 31 + ...nctionInsideTopLevelModuleWithExport.types | 27 + ...ionInsideTopLevelModuleWithoutExport.types | 27 + .../internalAliasInitializedModule.types | 30 + ...zedModuleInsideLocalModuleWithExport.types | 30 + ...ModuleInsideLocalModuleWithoutExport.types | 30 + ...ModuleInsideTopLevelModuleWithExport.types | 27 + ...uleInsideTopLevelModuleWithoutExport.types | 27 + .../reference/internalAliasInterface.types | 22 + ...InterfaceInsideLocalModuleWithExport.types | 22 + ...erfaceInsideLocalModuleWithoutExport.types | 22 + ...erfaceInsideTopLevelModuleWithExport.types | 18 + ...aceInsideTopLevelModuleWithoutExport.types | 18 + .../internalAliasUninitializedModule.types | 35 + ...zedModuleInsideLocalModuleWithExport.types | 35 + ...ModuleInsideLocalModuleWithoutExport.types | 35 + ...ModuleInsideTopLevelModuleWithExport.types | 32 + ...uleInsideTopLevelModuleWithoutExport.types | 32 + .../reference/internalAliasVar.types | 21 + ...lAliasVarInsideLocalModuleWithExport.types | 21 + ...iasVarInsideLocalModuleWithoutExport.types | 21 + ...iasVarInsideTopLevelModuleWithExport.types | 18 + ...VarInsideTopLevelModuleWithoutExport.types | 18 + .../internalAliasWithDottedNameEmit.types | 20 + ...lassNotReferencingInstanceNoConflict.types | 26 + ...lassNotReferencingInstanceNoConflict.types | 23 + ...duleNotReferencingInstanceNoConflict.types | 20 + tests/baselines/reference/invalidSplice.types | 8 + .../invalidSwitchBreakStatement.types | 9 + .../reference/invalidTypeNames.types | 6 + .../reference/invalidUndefinedValues.types | 108 + tests/baselines/reference/ipromise2.types | 128 + tests/baselines/reference/ipromise3.types | 103 + tests/baselines/reference/ipromise4.types | 123 + tests/baselines/reference/isLiteral1.types | 4 + tests/baselines/reference/isLiteral2.types | 4 + tests/baselines/reference/keywordField.types | 27 + tests/baselines/reference/lambdaASIEmit.types | 20 + .../reference/lambdaExpression.types | 14 + tests/baselines/reference/libdtsFix.types | 8 + .../reference/library_ArraySlice.types | 26 + .../library_DatePrototypeProperties.types | 354 + .../library_ObjectPrototypeProperties.types | 59 + .../library_RegExpExecArraySlice.types | 24 + .../reference/library_StringSlice.types | 26 + tests/baselines/reference/listFailure.types | 127 + tests/baselines/reference/literals1.types | 46 + .../localAliasExportAssignment.types | 21 + .../localImportNameVsGlobalName.types | 46 + ...ocalVariablesReturnedFromCatchBlocks.types | 18 + .../logicalAndOperatorWithEveryType.types | 615 + ...logicalAndOperatorWithTypeParameters.types | 79 + .../logicalNotOperatorWithBooleanType.types | 112 + .../logicalNotOperatorWithEnumType.types | 71 + .../logicalNotOperatorWithNumberType.types | 165 + .../logicalNotOperatorWithStringType.types | 161 + ...gicalOrExpressionIsContextuallyTyped.types | 17 + ...alOrExpressionIsNotContextuallyTyped.types | 24 + .../logicalOrOperatorWithEveryType.types | 618 + .../logicalOrOperatorWithTypeParameters.types | 122 + tests/baselines/reference/m7Bugs.types | 67 + .../memberAccessMustUseModuleInstances.types | 26 + .../memberAccessOnConstructorType.types | 10 + .../memberFunctionsWithPublicOverloads.types | 142 + .../memberVariableDeclarations1.types | 85 + .../reference/mergeThreeInterfaces.types | 197 + .../reference/mergeThreeInterfaces2.types | 176 + .../reference/mergeTwoInterfaces.types | 142 + .../reference/mergeTwoInterfaces2.types | 120 + .../reference/mergedDeclarations1.types | 76 + .../reference/mergedDeclarations4.types | 63 + .../mergedEnumDeclarationCodeGen.types | 18 + .../mergedInterfaceFromMultipleFiles1.types | 63 + .../mergedInterfacesWithIndexers.types | 38 + .../mergedInterfacesWithMultipleBases.types | 121 + .../mergedInterfacesWithMultipleBases2.types | 171 + .../mergedInterfacesWithMultipleBases3.types | 85 + .../mergedModuleDeclarationCodeGen2.types | 24 + .../mergedModuleDeclarationCodeGen3.types | 23 + .../mergedModuleDeclarationCodeGen4.types | 40 + .../mergedModuleDeclarationCodeGen5.types | 54 + ...duleDeclarationWithSharedExportedVar.types | 16 + .../methodContainingLocalFunction.types | 147 + .../methodSignatureDeclarationEmit1.types | 17 + .../methodSignaturesWithOverloads2.types | 96 + .../mismatchedGenericArguments1.types | 41 + .../missingImportAfterModuleImport.types | 37 + tests/baselines/reference/missingSelf.types | 53 + .../reference/missingTypeArguments3.types | 172 + tests/baselines/reference/mixedExports.types | 38 + .../mixingFunctionAndAmbientModule1.types | 90 + .../reference/modFunctionCrash.types | 18 + tests/baselines/reference/modKeyword.types | 15 + .../moduleAliasAsFunctionArgument.types | 25 + .../reference/moduleAliasInterface.types | 121 + .../moduleAndInterfaceSharingName.types | 24 + .../moduleAndInterfaceSharingName3.types | 25 + .../moduleAndInterfaceSharingName4.types | 22 + .../reference/moduleCodeGenTest3.types | 11 + .../reference/moduleCodeGenTest5.types | 53 + .../reference/moduleCodegenTest4.types | 14 + .../reference/moduleIdentifiers.types | 23 + ...oduleImportedForTypeArgumentPosition.types | 20 + .../moduleMemberWithoutTypeAnnotation1.types | 116 + .../moduleMemberWithoutTypeAnnotation2.types | 36 + tests/baselines/reference/moduleMerge.types | 30 + tests/baselines/reference/moduleNoEmit.types | 7 + .../reference/moduleOuterQualification.types | 19 + .../reference/moduleRedifinitionErrors.types | 8 + .../moduleReopenedTypeOtherBlock.types | 20 + .../moduleReopenedTypeSameBlock.types | 18 + .../reference/moduleScopingBug.types | 41 + .../reference/moduleUnassignedVariable.types | 19 + .../moduleVariableArrayIndexer.types | 16 + .../baselines/reference/moduleVariables.types | 46 + .../reference/moduleVisibilityTest1.types | 175 + .../moduleWithStatementsOfEveryKind.types | 153 + .../reference/moduleWithTryStatement1.types | 14 + .../reference/multiCallOverloads.types | 46 + .../multiExtendsSplitInterfaces2.types | 59 + .../reference/multiModuleClodule1.types | 53 + .../reference/multiModuleFundule1.types | 35 + tests/baselines/reference/mutrec.types | 106 + .../mutuallyRecursiveGenericBaseTypes1.types | 40 + .../mutuallyRecursiveGenericBaseTypes2.types | 23 + tests/baselines/reference/nameCollision.types | 88 + .../nameCollisionsInPropertyAssignments.types | 12 + .../reference/nameDelimitedBySlashes.types | 15 + .../reference/nameWithRelativePaths.types | 48 + ...ionExpressionAssignedToClassProperty.types | 21 + .../namedFunctionExpressionCall.types | 39 + .../namedFunctionExpressionInModule.types | 18 + tests/baselines/reference/namespaces1.types | 25 + tests/baselines/reference/namespaces2.types | 24 + .../negateOperatorWithAnyOtherType.types | 189 + .../negateOperatorWithBooleanType.types | 105 + .../negateOperatorWithEnumType.types | 52 + .../negateOperatorWithNumberType.types | 148 + .../negateOperatorWithStringType.types | 144 + tests/baselines/reference/negativeZero.types | 5 + .../baselines/reference/nestedGenerics.types | 15 + .../reference/nestedIfStatement.types | 8 + tests/baselines/reference/nestedIndexer.types | 11 + ...stedInfinitelyExpandedRecursiveTypes.types | 40 + .../reference/nestedModulePrivateAccess.types | 15 + tests/baselines/reference/nestedModules.types | 83 + .../reference/nestedRecursiveLambda.types | 46 + tests/baselines/reference/nestedSelf.types | 27 + tests/baselines/reference/newArrays.types | 41 + ...meterConstrainedToOuterTypeParameter.types | 21 + .../reference/newOperatorConformance.types | 149 + tests/baselines/reference/noCatchBlock.types | 8 + ...lisionThisExpressionAndClassInGlobal.types | 9 + ...isExpressionAndLocalVarInConstructor.types | 71 + ...nThisExpressionAndLocalVarInFunction.types | 23 + ...ionThisExpressionAndLocalVarInLambda.types | 48 + ...ionThisExpressionAndLocalVarInMethod.types | 71 + ...nThisExpressionAndLocalVarInProperty.types | 67 + ...ollisionThisExpressionAndVarInGlobal.types | 9 + ...isExpressionInFunctionAndVarInGlobal.types | 23 + .../reference/noConstraintInReturnType1.types | 12 + ...PrivateMembersWithoutTypeAnnotations.types | 18 + ...yInContextuallyTypesFunctionParamter.types | 18 + tests/baselines/reference/noSelfOnVars.types | 14 + .../nominalSubtypeCheckOfTypeParameter.types | 61 + .../nominalSubtypeCheckOfTypeParameter2.types | 55 + ...nConflictingRecursiveBaseTypeMembers.types | 29 + ...ricClassExtendingGenericClassWithAny.types | 14 + .../reference/nonInstantiatedModule.types | 111 + tests/baselines/reference/null.types | 48 + .../reference/nullAssignableToEveryType.types | 131 + ...ullIsSubtypeOfEverythingButUndefined.types | 303 + tests/baselines/reference/numberAsInLHS.types | 5 + .../reference/numberAssignableToEnum.types | 22 + .../numberOnLeftSideOfInExpression.types | 12 + .../reference/numberPropertyAccess.types | 30 + .../reference/numericIndexerConstraint3.types | 26 + .../reference/numericIndexerConstraint4.types | 29 + .../reference/numericIndexingResults.types | 199 + .../reference/numericMethodName1.types | 7 + tests/baselines/reference/objectIndexer.types | 33 + .../reference/objectLitGetterSetter.types | 65 + .../baselines/reference/objectLiteral1.types | 7 + .../baselines/reference/objectLiteral2.types | 8 + .../objectLiteralArraySpecialization.types | 51 + .../objectLiteralDeclarationGeneration1.types | 5 + .../reference/objectLiteralIndexers.types | 54 + .../reference/objectLiteralWidened.types | 46 + .../reference/objectMembersOnTypes.types | 37 + .../objectTypeHidingMembersOfObject.types | 71 + .../reference/objectTypeLiteralSyntax.types | 20 + .../reference/objectTypePropertyAccess.types | 105 + ...CallSignatureAppearsToBeFunctionType.types | 46 + ...atureHidingMembersOfExtendedFunction.types | 115 + ...CallSignatureHidingMembersOfFunction.types | 82 + ...atureHidingMembersOfExtendedFunction.types | 112 + ...ructSignatureHidingMembersOfFunction.types | 79 + .../objectTypeWithNumericProperty.types | 123 + ...ctTypeWithStringNamedNumericProperty.types | 469 + ...ringNamedPropertyOfIllegalCharacters.types | 133 + .../reference/objectTypesIdentity.types | 280 + .../reference/objectTypesIdentity2.types | 205 + ...bjectTypesIdentityWithCallSignatures.types | 327 + ...jectTypesIdentityWithCallSignatures2.types | 329 + ...thCallSignaturesDifferingParamCounts.types | 331 + ...hCallSignaturesDifferingParamCounts2.types | 137 + ...ntityWithCallSignaturesWithOverloads.types | 381 + ...TypesIdentityWithConstructSignatures.types | 271 + ...ypesIdentityWithConstructSignatures2.types | 245 + ...structSignaturesDifferingParamCounts.types | 247 + ...pesIdentityWithGenericCallSignatures.types | 342 + ...esIdentityWithGenericCallSignatures2.types | 363 + ...CallSignaturesDifferingByConstraints.types | 365 + ...cCallSignaturesDifferingByReturnType.types | 340 + ...CallSignaturesDifferingByReturnType2.types | 368 + ...gnaturesDifferingTypeParameterCounts.types | 374 + ...naturesDifferingTypeParameterCounts2.types | 142 + ...ignaturesDifferingTypeParameterNames.types | 342 + ...hGenericCallSignaturesOptionalParams.types | 358 + ...GenericCallSignaturesOptionalParams2.types | 365 + ...GenericCallSignaturesOptionalParams3.types | 365 + ...ructSignaturesDifferingByConstraints.types | 261 + ...tructSignaturesDifferingByReturnType.types | 270 + ...ructSignaturesDifferingByReturnType2.types | 279 + ...gnaturesDifferingTypeParameterCounts.types | 277 + ...ignaturesDifferingTypeParameterNames.types | 246 + ...ricConstructSignaturesOptionalParams.types | 261 + ...icConstructSignaturesOptionalParams2.types | 271 + ...icConstructSignaturesOptionalParams3.types | 271 + ...ectTypesIdentityWithNumericIndexers1.types | 378 + ...ectTypesIdentityWithNumericIndexers2.types | 397 + ...ectTypesIdentityWithNumericIndexers3.types | 378 + .../objectTypesIdentityWithOptionality.types | 168 + .../objectTypesIdentityWithPrivates.types | 375 + .../objectTypesIdentityWithPrivates2.types | 119 + .../objectTypesIdentityWithPublics.types | 280 + ...bjectTypesIdentityWithStringIndexers.types | 378 + ...jectTypesIdentityWithStringIndexers2.types | 397 + .../optionalAccessorsInInterface1.types | 53 + .../optionalConstructorArgInSuper.types | 30 + .../reference/optionalParamInOverride.types | 16 + ...optionalParamReferencingOtherParams1.types | 15 + tests/baselines/reference/out-flag.types | 21 + tests/baselines/reference/overload2.types | 42 + ...adBindingAcrossDeclarationBoundaries.types | 121 + ...dBindingAcrossDeclarationBoundaries2.types | 124 + .../reference/overloadCallTest.types | 36 + tests/baselines/reference/overloadCrash.types | 40 + .../overloadEquivalenceWithStatics.types | 33 + .../overloadGenericFunctionWithRestArgs.types | 39 + .../overloadOnConstConstraintChecks1.types | 78 + .../overloadOnConstConstraintChecks2.types | 37 + .../overloadOnConstConstraintChecks3.types | 39 + .../overloadOnConstInheritance1.types | 25 + .../reference/overloadOnGenericArity.types | 16 + ...loadOnGenericClassAndNonGenericClass.types | 60 + .../overloadResolutionOverNonCTLambdas.types | 88 + ...overloadResolutionOverNonCTObjectLit.types | 67 + .../reference/overloadResolutionWithAny.types | 69 + tests/baselines/reference/overloadRet.types | 38 + .../reference/overloadReturnTypes.types | 62 + ...lbacksWithDifferingOptionalityOnArgs.types | 27 + ...overloadedStaticMethodSpecialization.types | 33 + .../overloadsAndTypeArgumentArity.types | 31 + ...terPropertyInitializerInInitializers.types | 9 + ...terPropertyReferencingOtherParameter.types | 10 + .../parameterReferencesOtherParameter1.types | 21 + .../parameterReferencesOtherParameter2.types | 21 + .../parametersWithNoAnnotationAreAny.types | 100 + .../baselines/reference/parseShortform.types | 34 + tests/baselines/reference/parser509677.types | 5 + tests/baselines/reference/parser537152.types | 10 + tests/baselines/reference/parser579071.types | 5 + tests/baselines/reference/parser596700.types | 5 + tests/baselines/reference/parser630933.types | 12 + tests/baselines/reference/parser642331.types | 8 + tests/baselines/reference/parser643728.types | 11 + .../baselines/reference/parser645086_3.types | 5 + .../baselines/reference/parser645086_4.types | 5 + tests/baselines/reference/parser645484.types | 7 + tests/baselines/reference/parser768531.types | 5 + .../parserAccessibilityAfterStatic11.types | 8 + .../parserAccessibilityAfterStatic14.types | 9 + .../parserAccessibilityAfterStatic2.types | 8 + .../parserAccessibilityAfterStatic3.types | 8 + .../parserAccessibilityAfterStatic4.types | 8 + .../parserAccessibilityAfterStatic5.types | 8 + .../reference/parserAccessors2.types | 8 + .../reference/parserAccessors4.types | 7 + .../parserArrayLiteralExpression1.types | 5 + .../parserArrayLiteralExpression10.types | 5 + .../parserArrayLiteralExpression11.types | 5 + .../parserArrayLiteralExpression12.types | 5 + .../parserArrayLiteralExpression13.types | 5 + .../parserArrayLiteralExpression14.types | 5 + .../parserArrayLiteralExpression15.types | 5 + .../parserArrayLiteralExpression2.types | 5 + .../parserArrayLiteralExpression3.types | 5 + .../parserArrayLiteralExpression4.types | 5 + .../parserArrayLiteralExpression5.types | 5 + .../parserArrayLiteralExpression6.types | 5 + .../parserArrayLiteralExpression7.types | 5 + .../parserArrayLiteralExpression8.types | 5 + .../parserArrayLiteralExpression9.types | 5 + .../reference/parserClassDeclaration16.types | 10 + .../reference/parserClassDeclaration17.types | 17 + .../reference/parserClassDeclaration19.types | 9 + .../reference/parserClassDeclaration20.types | 7 + .../reference/parserClassDeclaration23.types | 4 + .../reference/parserClassDeclaration26.types | 10 + .../reference/parserClassDeclaration7.d.types | 4 + ...arserClassDeclarationIndexSignature1.types | 7 + .../parserConstructorDeclaration1.types | 6 + .../reference/parserDebuggerStatement1.types | 3 + .../reference/parserDebuggerStatement2.types | 3 + .../reference/parserDoStatement2.types | 3 + .../reference/parserEmptyFile1.types | 3 + .../reference/parserEmptyStatement1.types | 7 + tests/baselines/reference/parserEnum6.types | 6 + tests/baselines/reference/parserEnum7.types | 6 + .../reference/parserEnumDeclaration1.types | 10 + .../reference/parserEnumDeclaration2.d.types | 4 + .../reference/parserEnumDeclaration3.types | 7 + .../reference/parserEnumDeclaration5.types | 16 + .../parserExportAsFunctionIdentifier.types | 19 + .../parserFunctionDeclaration1.d.types | 4 + .../parserFunctionDeclaration5.types | 7 + .../parserFunctionDeclaration8.types | 7 + .../parserFunctionPropertyAssignment1.types | 7 + .../parserFunctionPropertyAssignment2.types | 6 + .../parserFunctionPropertyAssignment3.types | 6 + .../parserFunctionPropertyAssignment4.types | 7 + .../reference/parserGenericClass1.types | 5 + .../reference/parserGenericClass2.types | 6 + .../reference/parserGenericConstraint1.types | 5 + .../parserGreaterThanTokenAmbiguity1.types | 4 + .../parserGreaterThanTokenAmbiguity10.types | 10 + .../parserGreaterThanTokenAmbiguity5.types | 10 + .../parserGreaterThanTokenAmbiguity6.types | 4 + .../parserIndexMemberDeclaration1.types | 7 + .../parserIndexMemberDeclaration2.types | 10 + .../parserIndexMemberDeclaration3.types | 10 + .../parserIndexMemberDeclaration4.types | 8 + .../parserInterfaceKeywordInEnum.types | 8 + .../parserInterfaceKeywordInEnum1.types | 10 + .../parserKeywordsAsIdentifierName1.types | 19 + .../parserMemberAccessorDeclaration4.types | 8 + .../parserMemberAccessorDeclaration5.types | 7 + .../parserMemberAccessorDeclaration6.types | 7 + .../reference/parserMethodSignature1.types | 7 + .../reference/parserMethodSignature10.types | 6 + .../reference/parserMethodSignature11.types | 7 + .../reference/parserMethodSignature12.types | 7 + .../reference/parserMethodSignature2.types | 7 + .../reference/parserMethodSignature3.types | 8 + .../reference/parserMethodSignature4.types | 8 + .../reference/parserMethodSignature5.types | 6 + .../reference/parserMethodSignature6.types | 6 + .../reference/parserMethodSignature7.types | 7 + .../reference/parserMethodSignature8.types | 7 + .../reference/parserMethodSignature9.types | 6 + .../parserModifierOnPropertySignature2.types | 11 + .../reference/parserModuleDeclaration11.types | 22 + .../reference/parserModuleDeclaration12.types | 5 + .../reference/parserModuleDeclaration2.types | 4 + .../parserModuleDeclaration3.d.types | 4 + .../reference/parserModuleDeclaration4.types | 12 + .../reference/parserModuleDeclaration6.types | 4 + .../reference/parserModuleDeclaration7.types | 5 + .../reference/parserModuleDeclaration8.types | 5 + .../reference/parserModuleDeclaration9.types | 6 + .../reference/parserObjectLiterals1.types | 7 + .../reference/parserObjectType1.types | 4 + .../reference/parserObjectType2.types | 5 + .../reference/parserObjectType3.types | 11 + .../reference/parserObjectType4.types | 11 + .../reference/parserPropertySignature1.types | 7 + .../reference/parserPropertySignature10.types | 6 + .../reference/parserPropertySignature11.types | 6 + .../reference/parserPropertySignature12.types | 6 + .../reference/parserPropertySignature2.types | 7 + .../reference/parserPropertySignature3.types | 7 + .../reference/parserPropertySignature4.types | 7 + .../reference/parserPropertySignature5.types | 6 + .../reference/parserPropertySignature6.types | 6 + .../reference/parserPropertySignature7.types | 6 + .../reference/parserPropertySignature8.types | 6 + .../reference/parserPropertySignature9.types | 6 + .../reference/parserReturnStatement3.types | 6 + .../reference/parserS7.6.1.1_A1.10.types | 16 + .../reference/parserSbp_7.9_A9_T3.types | 18 + .../reference/parserStrictMode16.types | 15 + .../parserSyntaxWalker.generated.types | 281 + .../reference/parserUnaryExpression6.types | 3 + .../baselines/reference/parserUnicode2.types | 4 + .../baselines/reference/parserUnicode3.types | 4 + .../parserUnicodeWhitespaceCharacter1.types | 4 + .../parserVariableDeclaration11.types | 5 + .../parserVariableDeclaration4.d.types | 4 + .../parserVariableDeclaration7.types | 5 + .../parserVariableDeclaration9.types | 4 + .../reference/parserVariableStatement1.types | 10 + .../reference/parserVariableStatement2.types | 10 + .../reference/parserVariableStatement3.types | 11 + .../reference/parserVariableStatement4.types | 11 + .../reference/parserVoidExpression1.types | 4 + .../reference/parserX_ArrowFunction4.types | 10 + ...r_breakInIterationOrSwitchStatement1.types | 5 + ...r_breakInIterationOrSwitchStatement2.types | 6 + ...r_breakInIterationOrSwitchStatement3.types | 5 + .../reference/parser_breakTarget1.types | 4 + .../reference/parser_breakTarget2.types | 6 + .../reference/parser_breakTarget3.types | 7 + .../reference/parser_breakTarget4.types | 7 + ...parser_continueInIterationStatement1.types | 5 + ...parser_continueInIterationStatement2.types | 6 + ...parser_continueInIterationStatement3.types | 5 + .../reference/parser_continueLabel.types | 10 + .../reference/parser_continueTarget2.types | 6 + .../reference/parser_continueTarget3.types | 7 + .../reference/parser_continueTarget4.types | 7 + .../reference/parser_duplicateLabel3.types | 11 + .../reference/parser_duplicateLabel4.types | 9 + .../parservoidInQualifiedName0.types | 4 + .../reference/partiallyAmbientClodule.types | 10 + .../reference/partiallyAmbientFundule.types | 10 + .../plusOperatorWithBooleanType.types | 105 + .../reference/plusOperatorWithEnumType.types | 57 + .../plusOperatorWithNumberType.types | 148 + .../plusOperatorWithStringType.types | 144 + ...ixIncrementAsOperandOfPlusExpression.types | 17 + .../prespecializedGenericMembers1.types | 50 + .../reference/primitiveTypeAsmoduleName.types | 4 + .../reference/primtiveTypesAreIdentical.types | 97 + ...ivacyCheckAnonymousFunctionParameter.types | 43 + ...vacyCheckAnonymousFunctionParameter2.types | 37 + ...ckOfInterfaceMethodWithTypeParameter.types | 19 + ...ssignmentOnExportedGenericInterface1.types | 22 + ...ssignmentOnExportedGenericInterface2.types | 28 + ...ModuleExportAssignmentOfGenericClass.types | 27 + ...meterReferenceInConstructorParameter.types | 28 + ...ivacyCheckTypeOfInvisibleModuleError.types | 17 + ...acyCheckTypeOfInvisibleModuleNoError.types | 16 + tests/baselines/reference/privacyClass.types | 246 + tests/baselines/reference/privacyFunc.types | 460 + .../baselines/reference/privacyGloClass.types | 112 + .../baselines/reference/privacyGloFunc.types | 1081 ++ .../reference/privacyGloInterface.types | 278 + tests/baselines/reference/privacyGloVar.types | 263 + .../reference/privacyInterface.types | 645 + ...calInternalReferenceImportWithExport.types | 537 + ...InternalReferenceImportWithoutExport.types | 537 + ...velInternalReferenceImportWithExport.types | 312 + ...InternalReferenceImportWithoutExport.types | 312 + .../privacyTypeParameterOfFunction.types | 303 + .../privacyTypeParametersOfClass.types | 104 + .../privacyTypeParametersOfInterface.types | 199 + tests/baselines/reference/privacyVar.types | 609 + .../reference/privateInstanceVisibility.types | 67 + .../privatePropertyUsingObjectType.types | 28 + .../baselines/reference/privateVisibles.types | 23 + .../baselines/reference/promiseChaining.types | 59 + .../baselines/reference/promiseIdentity.types | 89 + .../reference/promiseIdentityWithAny.types | 45 + .../promiseIdentityWithConstraints.types | 53 + tests/baselines/reference/promiseTest.types | 61 + .../reference/promiseTypeInference.types | 54 + tests/baselines/reference/promises.types | 31 + .../reference/promisesWithConstraints.types | 84 + .../propagationOfPromiseInitialization.types | 69 + tests/baselines/reference/properties.types | 18 + .../baselines/reference/propertyAccess6.types | 10 + .../baselines/reference/propertyAccess7.types | 10 + ...AccessOnTypeParameterWithConstraints.types | 142 + ...ccessOnTypeParameterWithConstraints2.types | 276 + ...essOnTypeParameterWithoutConstraints.types | 130 + .../propertyNameWithoutTypeAnnotation.types | 61 + .../propertyNamesOfReservedWords.types | 828 + .../propertyNamesWithStringLiteral.types | 53 + .../protoAsIndexInIndexExpression.types | 42 + .../baselines/reference/protoInIndexer.types | 11 + ...totypeInstantiatedWithBaseConstraint.types | 19 + .../prototypeOnConstructorFunctions.types | 26 + ...tions-entity-names-referencing-a-var.types | 24 + .../reference/quotedFunctionName1.types | 6 + .../reference/quotedFunctionName2.types | 6 + .../reference/quotedPropertyName1.types | 6 + .../reference/quotedPropertyName2.types | 6 + .../reference/quotedPropertyName3.types | 20 + .../reference/randomSemicolons1.types | 7 + .../reference/reboundBaseClassSymbol.types | 16 + tests/baselines/reference/rectype.types | 44 + tests/baselines/reference/recur1.types | 30 + .../recursiveBaseConstructorCreation1.types | 18 + .../recursiveBaseConstructorCreation2.types | 25 + ...nstantiationsWithDefaultConstructors.types | 23 + .../reference/recursiveCloduleReference.types | 20 + .../recursiveComplicatedClasses.types | 51 + ...eExportAssignmentAndFindAliasedType7.types | 43 + .../reference/recursiveFunctionTypes1.types | 10 + .../recursiveGenericMethodCall.types | 20 + ...cursiveGenericSignatureInstantiation.types | 13 + ...ursiveGenericSignatureInstantiation2.types | 3 + ...recursiveIdenticalOverloadResolution.types | 45 + .../reference/recursiveInference1.types | 23 + .../reference/recursiveInheritance2.types | 45 + .../reference/recursiveInitializer.types | 78 + tests/baselines/reference/recursiveMods.types | 52 + .../reference/recursiveObjectLiteral.types | 7 + .../reference/recursiveProperties.types | 23 + .../reference/recursiveReturns.types | 34 + ...pecializationOfExtendedTypeWithError.types | 15 + .../reference/recursiveTypeIdentity.types | 32 + ...ecursiveTypeParameterReferenceError1.types | 54 + ...ecursiveTypeParameterReferenceError2.types | 40 + ...elySpecializedConstructorDeclaration.types | 49 + .../redeclarationOfVarWithGenericType.types | 17 + .../regExpWithSlashInCharClass.types | 22 + .../reference/reorderProperties.types | 56 + .../reference/requireEmitSemicolon.types | 40 + .../reservedNameOnModuleImport.types | 13 + tests/baselines/reference/reservedWords.types | 51 + ...sDeclarationWhenInBaseTypeResolution.types | 13691 ++++++++++++++++ ...restParameterAssignmentCompatibility.types | 57 + .../restParameterNoTypeAnnotation.types | 14 + .../baselines/reference/restParameters.types | 25 + .../reference/returnStatement1.types | 18 + .../reference/returnStatements.types | 73 + .../returnTypeParameterWithModules.types | 80 + .../reference/reuseInnerModuleMember.types | 24 + ...seInferenceInContextualInstantiation.types | 19 + .../reversedRecusiveTypeInstantiation.types | 34 + .../reference/scannerES3NumericLiteral1.types | 3 + .../reference/scannerES3NumericLiteral2.types | 3 + .../reference/scannerES3NumericLiteral5.types | 3 + .../reference/scannerES3NumericLiteral7.types | 3 + .../reference/scannerNumericLiteral1.types | 3 + .../reference/scannerNumericLiteral5.types | 3 + .../reference/scannerNumericLiteral7.types | 3 + ...gLiteralWithContainingNullCharacter1.types | Bin 0 -> 147 bytes .../scannerUnicodeEscapeInKeyword1.types | 4 + .../scopeResolutionIdentifiers.types | 94 + .../baselines/reference/selfInCallback.types | 28 + tests/baselines/reference/selfInLambdas.types | 145 + tests/baselines/reference/separate1-2.types | 7 + ...sigantureIsSubTypeIfTheyAreIdentical.types | 24 + ...nParameterReferencedInObjectLiteral1.types | 18 + .../reference/sourceMap-Comment1.types | 3 + .../reference/sourceMap-EmptyFile1.types | 3 + .../sourceMap-FileWithComments.types | 85 + ...terfacePrecedingVariableDeclaration1.types | 8 + .../reference/sourceMap-NewLine1.types | 4 + .../reference/sourceMap-SemiColon1.types | 4 + .../reference/sourceMap-SingleSpace1.types | 3 + .../reference/sourceMap-SkippedNode.types | 7 + .../sourceMap-StringLiteralWithNewLine.types | 32 + .../reference/sourceMapValidationClass.types | 52 + ...alidationClassWithDefaultConstructor.types | 10 + ...tConstructorAndCapturedThisStatement.types | 14 + ...thDefaultConstructorAndExtendsClause.types | 15 + .../sourceMapValidationClasses.types | 119 + .../sourceMapValidationDebugger.types | 3 + .../reference/sourceMapValidationDo.types | 23 + .../sourceMapValidationExportAssignment.types | 10 + ...apValidationExportAssignmentCommonjs.types | 10 + ...urceMapValidationFunctionExpressions.types | 29 + ...ValidationFunctionPropertyAssignment.types | 7 + .../sourceMapValidationFunctions.types | 38 + .../reference/sourceMapValidationIfElse.types | 44 + .../reference/sourceMapValidationImport.types | 28 + .../sourceMapValidationLabeled.types | 5 + .../reference/sourceMapValidationModule.types | 30 + .../reference/sourceMapValidationSwitch.types | 54 + .../sourceMapValidationTryCatchFinally.types | 56 + .../sourceMapValidationVariables.types | 16 + .../reference/sourceMapValidationWhile.types | 20 + .../sourceMapValidationWithComments.types | 53 + .../sourcemapValidationDuplicateNames.types | 21 + .../reference/specializationError.types | 36 + .../specializationOfExportedClass.types | 17 + ...cializationsShouldNotAffectEachOther.types | 48 + .../reference/specializeVarArgs1.types | 43 + .../specializedInheritedConstructors1.types | 62 + .../specializedLambdaTypeArguments.types | 16 + .../specializedSignatureInInterface.types | 18 + ...reIsSubtypeOfNonSpecializedSignature.types | 243 + .../reference/staticAndMemberFunctions.types | 10 + ...staticAndNonStaticPropertiesSameName.types | 16 + .../baselines/reference/staticFactory1.types | 36 + tests/baselines/reference/staticGetter2.types | 16 + .../reference/staticInheritance.types | 39 + .../reference/staticInstanceResolution.types | 33 + .../reference/staticInstanceResolution2.types | 24 + .../reference/staticInstanceResolution3.types | 26 + .../staticInterfaceAssignmentCompat.types | 27 + .../staticMemberAccessOffDerivedType1.types | 22 + .../staticMemberInitialization.types | 19 + ...staticMemberWithStringAndNumberNames.types | 37 + ...thTypeParameterExtendsClauseDeclFile.types | 44 + ...taticPropertyAndFunctionWithSameName.types | 20 + .../staticPrototypePropertyOnClass.types | 43 + tests/baselines/reference/stradac.types | 18 + tests/baselines/reference/strictMode1.types | 9 + tests/baselines/reference/strictMode2.types | 8 + tests/baselines/reference/strictMode3.types | 20 + tests/baselines/reference/strictMode4.types | 7 + tests/baselines/reference/strictMode5.types | 40 + .../stringHasStringValuedNumericIndexer.types | 5 + .../reference/stringIndexingResults.types | 105 + ...ringLiteralObjectLiteralDeclaration1.types | 9 + ...ralPropertyNameWithLineContinuation1.types | 16 + .../reference/stringNamedPropertyAccess.types | 58 + .../reference/stringPropCodeGen.types | 33 + .../reference/stringPropertyAccess.types | 30 + tests/baselines/reference/structural1.types | 28 + ...structuralTypeInDeclareFileForModule.types | 10 + tests/baselines/reference/styleOptions.types | 16 + tests/baselines/reference/subtypesOfAny.types | 276 + .../reference/subtypingTransitivity.types | 53 + .../subtypingWithCallSignatures.types | 58 + .../subtypingWithCallSignatures2.types | 950 ++ .../subtypingWithCallSignatures3.types | 633 + .../subtypingWithCallSignatures4.types | 618 + .../subtypingWithConstructSignatures.types | 70 + .../subtypingWithConstructSignatures2.types | 886 + .../subtypingWithConstructSignatures3.types | 587 + .../subtypingWithConstructSignatures4.types | 581 + .../subtypingWithConstructSignatures5.types | 314 + .../subtypingWithConstructSignatures6.types | 209 + .../subtypingWithObjectMembers4.types | 64 + ...ubtypingWithObjectMembersOptionality.types | 160 + ...btypingWithObjectMembersOptionality3.types | 76 + ...btypingWithObjectMembersOptionality4.types | 76 + .../subtypingWithOptionalProperties.types | 40 + tests/baselines/reference/super2.types | 114 + .../reference/superAccessInFatArrow1.types | 42 + .../reference/superCallArgsMustMatch.types | 37 + ...FromClassThatDerivesFromGenericType1.types | 26 + ...FromClassThatDerivesFromGenericType2.types | 22 + tests/baselines/reference/superCalls.types | 57 + .../reference/superInCatchBlock1.types | 27 + .../superWithGenericSpecialization.types | 41 + .../reference/superWithGenerics.types | 26 + .../reference/switchBreakStatements.types | 59 + tests/baselines/reference/switchCases.types | 7 + .../reference/switchFallThroughs.types | 27 + .../reference/switchStatements.types | 152 + .../baselines/reference/targetTypeArgs.types | 81 + .../baselines/reference/targetTypeCalls.types | 39 + .../reference/targetTypeObjectLiteral.types | 35 + .../targetTypeObjectLiteralToAny.types | 36 + .../baselines/reference/targetTypeTest2.types | 28 + .../reference/targetTypingOnFunctions.types | 22 + .../ternaryExpressionSourceMap.types | 12 + .../reference/testContainerList.types | 13 + tests/baselines/reference/thisBinding2.types | 101 + tests/baselines/reference/thisCapture1.types | 41 + .../thisExpressionInIndexExpression.types | 11 + .../thisExpressionOfGenericObject.types | 16 + .../thisInGenericStaticMembers.types | 66 + .../reference/thisInInnerFunctions.types | 51 + .../thisInInstanceMemberInitializer.types | 21 + tests/baselines/reference/thisInLambda.types | 62 + .../reference/thisInModuleFunction1.types | 18 + .../reference/thisInObjectLiterals.types | 54 + .../thisInPropertyBoundDeclarations.types | 215 + .../reference/thisInStaticMethod1.types | 23 + ...rencedInFunctionInsideArrowFunction1.types | 23 + .../throwInEnclosingStatements.types | 107 + .../baselines/reference/throwStatements.types | 243 + .../reference/toStringOnPrimitives.types | 20 + ...umentsInGenericFunctionTypedArgument.types | 101 + tests/baselines/reference/topLevel.types | 93 + .../reference/topLevelAmbientModule.types | 18 + .../baselines/reference/topLevelExports.types | 18 + .../reference/topLevelFileModule.types | 25 + .../baselines/reference/topLevelLambda2.types | 13 + .../baselines/reference/topLevelLambda3.types | 8 + .../baselines/reference/topLevelLambda4.types | 8 + .../reference/trailingCommasES3.types | 47 + .../reference/trailingCommasES5.types | 47 + .../transitiveTypeArgumentInference1.types | 34 + .../baselines/reference/tryCatchFinally.types | 8 + tests/baselines/reference/tryStatements.types | 18 + ...rgedInterfacesWithDifferingOverloads.types | 163 + ...gedInterfacesWithDifferingOverloads2.types | 93 + ...notationBestCommonTypeInArrayLiteral.types | 65 + .../reference/typeArgInference.types | 111 + .../reference/typeArgInference2.types | 61 + .../reference/typeArgInferenceWithNull.types | 48 + .../reference/typeArgumentInference.types | 468 + .../typeArgumentInferenceOrdering.types | 41 + ...tInferenceWithConstraintAsCommonRoot.types | 40 + .../typeArgumentsInFunctionExpressions.types | 43 + ...ssionWithUndefinedCallResolutionData.types | 23 + ...peConstraintsWithConstructSignatures.types | 37 + .../typeInferenceConflictingCandidates.types | 21 + .../reference/typeInferenceFixEarly.types | 16 + .../typeInferenceReturnTypeCallback.types | 92 + .../typeInferenceWithTypeAnnotation.types | 17 + .../reference/typeLiteralCallback.types | 60 + .../baselines/reference/typeOfPrototype.types | 19 + .../baselines/reference/typeOfSuperCall.types | 15 + .../typeOfThisInFunctionExpression.types | 125 + .../typeOfThisInMemberFunctions.types | 71 + .../reference/typeOfThisInStaticMembers.types | 104 + .../typeParameterAndArgumentOfSameName1.types | 18 + .../typeParameterAsElementType.types | 14 + .../typeParameterAsTypeArgument.types | 62 + ...sTypeParameterConstraintTransitively.types | 130 + ...TypeParameterConstraintTransitively2.types | 123 + ...eterCompatibilityAccrossDeclarations.types | 72 + ...meterConstrainedToOuterTypeParameter.types | 32 + ...eterConstrainedToOuterTypeParameter2.types | 38 + ...ameterUsedAsTypeParameterConstraint3.types | 91 + ...peParametersAreIdenticalToThemselves.types | 328 + ...typeParametersAvailableInNestedScope.types | 76 + ...ypeParametersAvailableInNestedScope2.types | 36 + .../typeQueryWithReservedWords.types | 37 + .../baselines/reference/typeResolution.types | 392 + tests/baselines/reference/typeVal.types | 21 + .../typedGenericPrototypeMember.types | 19 + tests/baselines/reference/typeofClass2.types | 55 + tests/baselines/reference/typeofEnum.types | 20 + .../baselines/reference/typeofInterface.types | 27 + .../typeofModuleWithoutExports.types | 19 + .../typeofOperatorWithBooleanType.types | 160 + .../typeofOperatorWithEnumType.types | 88 + .../typeofOperatorWithNumberType.types | 214 + .../typeofOperatorWithStringType.types | 213 + .../baselines/reference/typeofUndefined.types | 9 + .../reference/typesWithOptionalProperty.types | 93 + .../typesWithSpecializedCallSignatures.types | 144 + ...esWithSpecializedConstructSignatures.types | 114 + tests/baselines/reference/unaryPlus.types | 37 + .../reference/uncaughtCompilerError1.types | 75 + .../undefinedArgumentInference.types | 26 + .../undefinedAssignableToEveryType.types | 152 + .../undefinedInferentialTyping.types | 19 + .../undefinedIsSubtypeOfEverything.types | 249 + .../reference/underscoreMapFirst.types | 151 + .../baselines/reference/underscoreTest1.types | 5326 ++++++ .../unexportedInstanceClassVariables.types | 24 + .../reference/unicodeIdentifierNames.types | 6 + .../untypedArgumentInLambdaExpression.types | 22 + .../reference/unusedImportDeclaration.types | 38 + ...oduleWithExportImportInValuePosition.types | 63 + .../reference/validBooleanAssignments.types | 22 + .../reference/validEnumAssignments.types | 100 + .../validMultipleVariableDeclarations.types | 134 + .../reference/validNumberAssignments.types | 37 + .../reference/validStringAssignments.types | 22 + .../reference/validUndefinedAssignments.types | 73 + .../reference/validUndefinedValues.types | 10 + .../reference/validUseOfThisInSuper.types | 22 + .../reference/validVoidAssignments.types | 25 + .../baselines/reference/validVoidValues.types | 13 + .../reference/varArgParamTypeCheck.types | 82 + .../reference/varArgsOnConstructorTypes.types | 70 + tests/baselines/reference/varAsID.types | 36 + .../varInFunctionInVarInitializer.types | 18 + tests/baselines/reference/vardecl.types | 257 + .../reference/variableDeclarator1.types | 15 + tests/baselines/reference/visSyntax.types | 17 + .../visibilityOfCrossModuleTypeUsage.types | 60 + .../baselines/reference/voidAsOperator.types | 15 + .../baselines/reference/voidConstructor.types | 4 + .../voidFunctionAssignmentCompat.types | 74 + tests/baselines/reference/voidOperator1.types | 13 + .../voidOperatorWithBooleanType.types | 112 + .../reference/voidOperatorWithEnumType.types | 76 + .../voidOperatorWithNumberType.types | 165 + .../voidOperatorWithStringType.types | 161 + .../reference/voidReturnLambdaValue.types | 17 + .../reference/whileBreakStatements.types | 46 + .../reference/whileContinueStatements.types | 57 + tests/baselines/reference/widenedTypes1.types | 36 + .../baselines/reference/withImportDecl.types | 93 + .../wrappedAndRecursiveConstraints.types | 50 + .../wrappedAndRecursiveConstraints3.types | 58 + 1702 files changed, 143213 insertions(+) create mode 100644 tests/baselines/reference/2dArrays.types create mode 100644 tests/baselines/reference/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot.types create mode 100644 tests/baselines/reference/AmbientModuleAndAmbientWithSameNameAndCommonRoot.types create mode 100644 tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.types create mode 100644 tests/baselines/reference/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot.types create mode 100644 tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.types create mode 100644 tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.types create mode 100644 tests/baselines/reference/ClassAndModuleThatMergeWithStringIndexerAndExportedFunctionWithTypeIncompatibleWithIndexer.types create mode 100644 tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.types create mode 100644 tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.types create mode 100644 tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.types create mode 100644 tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.types create mode 100644 tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.types create mode 100644 tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.types create mode 100644 tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.types create mode 100644 tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.types create mode 100644 tests/baselines/reference/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.types create mode 100644 tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.types create mode 100644 tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.types create mode 100644 tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.types create mode 100644 tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.types create mode 100644 tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.types create mode 100644 tests/baselines/reference/ExportVariableWithAccessibleTypeInTypeAnnotation.types create mode 100644 tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.types create mode 100644 tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.types create mode 100644 tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.types create mode 100644 tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.types create mode 100644 tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.types create mode 100644 tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.types create mode 100644 tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.types create mode 100644 tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.types create mode 100644 tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.types create mode 100644 tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.types create mode 100644 tests/baselines/reference/acceptableAlias1.types create mode 100644 tests/baselines/reference/accessOverriddenBaseClassMember1.types create mode 100644 tests/baselines/reference/accessorWithES5.types create mode 100644 tests/baselines/reference/addMoreCallSignaturesToBaseSignature.types create mode 100644 tests/baselines/reference/addMoreCallSignaturesToBaseSignature2.types create mode 100644 tests/baselines/reference/additionOperatorWithAnyAndEveryType.types create mode 100644 tests/baselines/reference/additionOperatorWithNullValueAndValidOperator.types create mode 100644 tests/baselines/reference/additionOperatorWithNumberAndEnum.types create mode 100644 tests/baselines/reference/additionOperatorWithStringAndEveryType.types create mode 100644 tests/baselines/reference/additionOperatorWithUndefinedValueAndValidOperator.types create mode 100644 tests/baselines/reference/aliasInaccessibleModule.types create mode 100644 tests/baselines/reference/aliasInaccessibleModule2.types create mode 100644 tests/baselines/reference/aliasUsageInArray.types create mode 100644 tests/baselines/reference/aliasUsageInFunctionExpression.types create mode 100644 tests/baselines/reference/aliasUsageInGenericFunction.types create mode 100644 tests/baselines/reference/aliasUsageInIndexerOfClass.types create mode 100644 tests/baselines/reference/aliasUsageInObjectLiteral.types create mode 100644 tests/baselines/reference/aliasUsageInOrExpression.types create mode 100644 tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.types create mode 100644 tests/baselines/reference/aliasUsageInVarAssignment.types create mode 100644 tests/baselines/reference/aliasUsedAsNameValue.types create mode 100644 tests/baselines/reference/ambientClassDeclarationWithExtends.types create mode 100644 tests/baselines/reference/ambientDeclarations.types create mode 100644 tests/baselines/reference/ambientEnumElementInitializer1.types create mode 100644 tests/baselines/reference/ambientEnumElementInitializer2.types create mode 100644 tests/baselines/reference/ambientEnumElementInitializer4.types create mode 100644 tests/baselines/reference/ambientEnumElementInitializer5.types create mode 100644 tests/baselines/reference/ambientEnumElementInitializer6.types create mode 100644 tests/baselines/reference/ambientExternalModuleReopen.types create mode 100644 tests/baselines/reference/ambientExternalModuleWithInternalImportDeclaration.types create mode 100644 tests/baselines/reference/ambientExternalModuleWithoutInternalImportDeclaration.types create mode 100644 tests/baselines/reference/ambientFundule.types create mode 100644 tests/baselines/reference/ambientModuleExports.types create mode 100644 tests/baselines/reference/ambientModuleWithClassDeclarationWithExtends.types create mode 100644 tests/baselines/reference/ambientModules.types create mode 100644 tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.types create mode 100644 tests/baselines/reference/ambiguousOverloadResolution.types create mode 100644 tests/baselines/reference/amdImportAsPrimaryExpression.types create mode 100644 tests/baselines/reference/amdImportNotAsPrimaryExpression.types create mode 100644 tests/baselines/reference/anonterface.types create mode 100644 tests/baselines/reference/anyAsFunctionCall.types create mode 100644 tests/baselines/reference/anyAsReturnTypeForNewOnCall.types create mode 100644 tests/baselines/reference/anyAssignabilityInInheritance.types create mode 100644 tests/baselines/reference/anyAssignableToEveryType.types create mode 100644 tests/baselines/reference/anyInferenceAnonymousFunctions.types create mode 100644 tests/baselines/reference/anyIsAssignableToObject.types create mode 100644 tests/baselines/reference/anyIsAssignableToVoid.types create mode 100644 tests/baselines/reference/anyPlusAny1.types create mode 100644 tests/baselines/reference/anyPropertyAccess.types create mode 100644 tests/baselines/reference/argsInScope.types create mode 100644 tests/baselines/reference/arguments.types create mode 100644 tests/baselines/reference/argumentsUsedInObjectLiteralProperty.types create mode 100644 tests/baselines/reference/arithmeticOperatorWithAnyAndNumber.types create mode 100644 tests/baselines/reference/arithmeticOperatorWithEnum.types create mode 100644 tests/baselines/reference/arithmeticOperatorWithNullValueAndValidOperands.types create mode 100644 tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndValidOperands.types create mode 100644 tests/baselines/reference/arrayAssignmentTest6.types create mode 100644 tests/baselines/reference/arrayAugment.types create mode 100644 tests/baselines/reference/arrayBestCommonTypes.types create mode 100644 tests/baselines/reference/arrayConcat2.types create mode 100644 tests/baselines/reference/arrayConcatMap.types create mode 100644 tests/baselines/reference/arrayConstructors1.types create mode 100644 tests/baselines/reference/arrayLiteral.types create mode 100644 tests/baselines/reference/arrayLiteral1.types create mode 100644 tests/baselines/reference/arrayLiteral2.types create mode 100644 tests/baselines/reference/arrayLiteralInNonVarArgParameter.types create mode 100644 tests/baselines/reference/arrayLiteralTypeInference.types create mode 100644 tests/baselines/reference/arrayLiteralWidened.types create mode 100644 tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types create mode 100644 tests/baselines/reference/arrayLiterals.types create mode 100644 tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types create mode 100644 tests/baselines/reference/arrayOfExportedClass.types create mode 100644 tests/baselines/reference/arrayOfFunctionTypes3.types create mode 100644 tests/baselines/reference/arrayTypeInSignatureOfInterfaceAndClass.types create mode 100644 tests/baselines/reference/arrayconcat.types create mode 100644 tests/baselines/reference/arrowFunctionExpressions.types create mode 100644 tests/baselines/reference/arrowFunctionInExpressionStatement1.types create mode 100644 tests/baselines/reference/arrowFunctionInExpressionStatement2.types create mode 100644 tests/baselines/reference/asiAmbientFunctionDeclaration.types create mode 100644 tests/baselines/reference/asiArith.types create mode 100644 tests/baselines/reference/asiBreak.types create mode 100644 tests/baselines/reference/asiContinue.types create mode 100644 tests/baselines/reference/asiInES6Classes.types create mode 100644 tests/baselines/reference/assign1.types create mode 100644 tests/baselines/reference/assignEveryTypeToAny.types create mode 100644 tests/baselines/reference/assignToObjectTypeWithPrototypeProperty.types create mode 100644 tests/baselines/reference/assignToPrototype1.types create mode 100644 tests/baselines/reference/assignmentCompatForEnums.types create mode 100644 tests/baselines/reference/assignmentCompatOnNew.types create mode 100644 tests/baselines/reference/assignmentCompatWithCallSignatures3.types create mode 100644 tests/baselines/reference/assignmentCompatWithCallSignatures5.types create mode 100644 tests/baselines/reference/assignmentCompatWithCallSignatures6.types create mode 100644 tests/baselines/reference/assignmentCompatWithConstructSignatures3.types create mode 100644 tests/baselines/reference/assignmentCompatWithConstructSignatures5.types create mode 100644 tests/baselines/reference/assignmentCompatWithConstructSignatures6.types create mode 100644 tests/baselines/reference/assignmentCompatWithGenericCallSignatures.types create mode 100644 tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.types create mode 100644 tests/baselines/reference/assignmentCompatWithGenericCallSignatures3.types create mode 100644 tests/baselines/reference/assignmentCompatWithObjectMembers2.types create mode 100644 tests/baselines/reference/assignmentCompatWithObjectMembers3.types create mode 100644 tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.types create mode 100644 tests/baselines/reference/assignmentCompatWithWithGenericConstructSignatures.types create mode 100644 tests/baselines/reference/assignmentCompatability1.types create mode 100644 tests/baselines/reference/assignmentCompatability2.types create mode 100644 tests/baselines/reference/assignmentCompatability3.types create mode 100644 tests/baselines/reference/assignmentCompatability4.types create mode 100644 tests/baselines/reference/assignmentCompatability5.types create mode 100644 tests/baselines/reference/assignmentCompatability6.types create mode 100644 tests/baselines/reference/assignmentCompatability7.types create mode 100644 tests/baselines/reference/assignmentCompatability8.types create mode 100644 tests/baselines/reference/assignmentCompatability9.types create mode 100644 tests/baselines/reference/assignmentCompatibilityForConstrainedTypeParameters.types create mode 100644 tests/baselines/reference/assignmentLHSIsReference.types create mode 100644 tests/baselines/reference/augmentArray.types create mode 100644 tests/baselines/reference/augmentedTypeBracketAccessIndexSignature.types create mode 100644 tests/baselines/reference/augmentedTypeBracketNamedPropertyAccess.types create mode 100644 tests/baselines/reference/augmentedTypesClass3.types create mode 100644 tests/baselines/reference/augmentedTypesExternalModule1.types create mode 100644 tests/baselines/reference/augmentedTypesModules3b.types create mode 100644 tests/baselines/reference/augmentedTypesModules4.types create mode 100644 tests/baselines/reference/autoAsiForStaticsInClassDeclaration.types create mode 100644 tests/baselines/reference/autonumberingInEnums.types create mode 100644 tests/baselines/reference/avoid.types create mode 100644 tests/baselines/reference/badOverloadError.types create mode 100644 tests/baselines/reference/badThisBinding.types create mode 100644 tests/baselines/reference/baseIndexSignatureResolution.types create mode 100644 tests/baselines/reference/baseTypeAfterDerivedType.types create mode 100644 tests/baselines/reference/baseTypeOrderChecking.types create mode 100644 tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types create mode 100644 tests/baselines/reference/bestCommonTypeReturnStatement.types create mode 100644 tests/baselines/reference/bestCommonTypeWithContextualTyping.types create mode 100644 tests/baselines/reference/bestCommonTypeWithOptionalProperties.types create mode 100644 tests/baselines/reference/binaryArithmatic1.types create mode 100644 tests/baselines/reference/binaryArithmatic2.types create mode 100644 tests/baselines/reference/bind2.types create mode 100644 tests/baselines/reference/binopAssignmentShouldHaveType.types create mode 100644 tests/baselines/reference/bitwiseNotOperatorWithBooleanType.types create mode 100644 tests/baselines/reference/bitwiseNotOperatorWithEnumType.types create mode 100644 tests/baselines/reference/bitwiseNotOperatorWithNumberType.types create mode 100644 tests/baselines/reference/bitwiseNotOperatorWithStringType.types create mode 100644 tests/baselines/reference/bom-utf16be.types create mode 100644 tests/baselines/reference/bom-utf16le.types create mode 100644 tests/baselines/reference/bom-utf8.types create mode 100644 tests/baselines/reference/booleanPropertyAccess.types create mode 100644 tests/baselines/reference/callExpressionWithTypeParameterConstrainedToOuterTypeParameter.types create mode 100644 tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.types create mode 100644 tests/baselines/reference/callSignatureAssignabilityInInheritance2.types create mode 100644 tests/baselines/reference/callSignatureAssignabilityInInheritance4.types create mode 100644 tests/baselines/reference/callSignatureAssignabilityInInheritance5.types create mode 100644 tests/baselines/reference/callSignatureAssignabilityInInheritance6.types create mode 100644 tests/baselines/reference/callSignatureFunctionOverload.types create mode 100644 tests/baselines/reference/callSignatureWithoutAnnotationsOrBody.types create mode 100644 tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.types create mode 100644 tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType.types create mode 100644 tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType3.types create mode 100644 tests/baselines/reference/callSignaturesWithOptionalParameters.types create mode 100644 tests/baselines/reference/callSignaturesWithOptionalParameters2.types create mode 100644 tests/baselines/reference/callbacksDontShareTypes.types create mode 100644 tests/baselines/reference/captureThisInSuperCall.types create mode 100644 tests/baselines/reference/castExpressionParentheses.types create mode 100644 tests/baselines/reference/castNewObjectBug.types create mode 100644 tests/baselines/reference/castParentheses.types create mode 100644 tests/baselines/reference/castTest.types create mode 100644 tests/baselines/reference/catch.types create mode 100644 tests/baselines/reference/cf.types create mode 100644 tests/baselines/reference/chainedAssignment2.types create mode 100644 tests/baselines/reference/chainedImportAlias.types create mode 100644 tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.types create mode 100644 tests/baselines/reference/checkInterfaceBases.types create mode 100644 tests/baselines/reference/circularImportAlias.types create mode 100644 tests/baselines/reference/classAppearsToHaveMembersOfObject.types create mode 100644 tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.types create mode 100644 tests/baselines/reference/classExtendingClass.types create mode 100644 tests/baselines/reference/classExtendingQualifiedName2.types create mode 100644 tests/baselines/reference/classImplementingInterfaceIndexer.types create mode 100644 tests/baselines/reference/classImplementsClass1.types create mode 100644 tests/baselines/reference/classImplementsClass3.types create mode 100644 tests/baselines/reference/classImplementsImportedInterface.types create mode 100644 tests/baselines/reference/classIndexer.types create mode 100644 tests/baselines/reference/classMemberInitializerWithLamdaScoping5.types create mode 100644 tests/baselines/reference/classMethodWithKeywordName1.types create mode 100644 tests/baselines/reference/classOrder1.types create mode 100644 tests/baselines/reference/classOrder2.types create mode 100644 tests/baselines/reference/classOrderBug.types create mode 100644 tests/baselines/reference/classSideInheritance2.types create mode 100644 tests/baselines/reference/classWithEmptyBody.types create mode 100644 tests/baselines/reference/classWithNoConstructorOrBaseClass.types create mode 100644 tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.types create mode 100644 tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.types create mode 100644 tests/baselines/reference/classWithPublicProperty.types create mode 100644 tests/baselines/reference/cloduleAcrossModuleDefinitions.types create mode 100644 tests/baselines/reference/cloduleAndTypeParameters.types create mode 100644 tests/baselines/reference/cloduleTest1.types create mode 100644 tests/baselines/reference/cloduleWithRecursiveReference.types create mode 100644 tests/baselines/reference/collisionArgumentsInType.types create mode 100644 tests/baselines/reference/collisionArgumentsInterfaceMembers.types create mode 100644 tests/baselines/reference/collisionCodeGenEnumWithEnumMemberConflict.types create mode 100644 tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.types create mode 100644 tests/baselines/reference/collisionCodeGenModuleWithEnumMemberConflict.types create mode 100644 tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.types create mode 100644 tests/baselines/reference/collisionCodeGenModuleWithMemberClassConflict.types create mode 100644 tests/baselines/reference/collisionCodeGenModuleWithMemberInterfaceConflict.types create mode 100644 tests/baselines/reference/collisionCodeGenModuleWithMemberVariable.types create mode 100644 tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.types create mode 100644 tests/baselines/reference/collisionCodeGenModuleWithModuleChildren.types create mode 100644 tests/baselines/reference/collisionCodeGenModuleWithModuleReopening.types create mode 100644 tests/baselines/reference/collisionCodeGenModuleWithPrivateMember.types create mode 100644 tests/baselines/reference/collisionCodeGenModuleWithUnicodeNames.types create mode 100644 tests/baselines/reference/collisionExportsRequireAndAlias.types create mode 100644 tests/baselines/reference/collisionExportsRequireAndClass.types create mode 100644 tests/baselines/reference/collisionExportsRequireAndEnum.types create mode 100644 tests/baselines/reference/collisionExportsRequireAndFunction.types create mode 100644 tests/baselines/reference/collisionExportsRequireAndModule.types create mode 100644 tests/baselines/reference/collisionExportsRequireAndUninstantiatedModule.types create mode 100644 tests/baselines/reference/collisionExportsRequireAndVar.types create mode 100644 tests/baselines/reference/collisionRestParameterInType.types create mode 100644 tests/baselines/reference/collisionRestParameterInterfaceMembers.types create mode 100644 tests/baselines/reference/commaOperator1.types create mode 100644 tests/baselines/reference/commaOperatorOtherValidOperation.types create mode 100644 tests/baselines/reference/commaOperatorWithSecondOperandAnyType.types create mode 100644 tests/baselines/reference/commaOperatorWithSecondOperandBooleanType.types create mode 100644 tests/baselines/reference/commaOperatorWithSecondOperandNumberType.types create mode 100644 tests/baselines/reference/commaOperatorWithSecondOperandObjectType.types create mode 100644 tests/baselines/reference/commaOperatorWithSecondOperandStringType.types create mode 100644 tests/baselines/reference/commaOperatorsMultipleOperators.types create mode 100644 tests/baselines/reference/commentBeforeStaticMethod1.types create mode 100644 tests/baselines/reference/commentInEmptyParameterList1.types create mode 100644 tests/baselines/reference/commentInMethodCall.types create mode 100644 tests/baselines/reference/commentOnAmbientClass1.types create mode 100644 tests/baselines/reference/commentOnAmbientVariable1.types create mode 100644 tests/baselines/reference/commentOnAmbientVariable2.types create mode 100644 tests/baselines/reference/commentOnClassMethod1.types create mode 100644 tests/baselines/reference/commentOnElidedModule1.types create mode 100644 tests/baselines/reference/commentOnExpressionStatement1.types create mode 100644 tests/baselines/reference/commentOnIfStatement1.types create mode 100644 tests/baselines/reference/commentOnInterface1.types create mode 100644 tests/baselines/reference/commentOnParenthesizedExpressionOpenParen1.types create mode 100644 tests/baselines/reference/commentOnSignature1.types create mode 100644 tests/baselines/reference/commentOnSimpleArrowFunctionBody1.types create mode 100644 tests/baselines/reference/commentOnStaticMember1.types create mode 100644 tests/baselines/reference/commentsAtEndOfFile1.types create mode 100644 tests/baselines/reference/commentsBeforeFunctionExpression1.types create mode 100644 tests/baselines/reference/commentsBeforeVariableStatement1.types create mode 100644 tests/baselines/reference/commentsClass.types create mode 100644 tests/baselines/reference/commentsClassMembers.types create mode 100644 tests/baselines/reference/commentsCommentParsing.types create mode 100644 tests/baselines/reference/commentsDottedModuleName.types create mode 100644 tests/baselines/reference/commentsEnums.types create mode 100644 tests/baselines/reference/commentsExternalModules.types create mode 100644 tests/baselines/reference/commentsFunction.types create mode 100644 tests/baselines/reference/commentsInheritance.types create mode 100644 tests/baselines/reference/commentsInterface.types create mode 100644 tests/baselines/reference/commentsModules.types create mode 100644 tests/baselines/reference/commentsMultiModuleMultiFile.types create mode 100644 tests/baselines/reference/commentsMultiModuleSingleFile.types create mode 100644 tests/baselines/reference/commentsOnReturnStatement1.types create mode 100644 tests/baselines/reference/commentsOnStaticMembers.types create mode 100644 tests/baselines/reference/commentsOverloads.types create mode 100644 tests/baselines/reference/commentsPropertySignature1.types create mode 100644 tests/baselines/reference/commentsVarDecl.types create mode 100644 tests/baselines/reference/commentsVariableStatement1.types create mode 100644 tests/baselines/reference/commentsdoNotEmitComments.types create mode 100644 tests/baselines/reference/commentsemitComments.types create mode 100644 tests/baselines/reference/commonJSImportAsPrimaryExpression.types create mode 100644 tests/baselines/reference/commonJSImportNotAsPrimaryExpression.types create mode 100644 tests/baselines/reference/comparisonOperatorWithIdenticalObjects.types create mode 100644 tests/baselines/reference/comparisonOperatorWithIdenticalPrimitiveType.types create mode 100644 tests/baselines/reference/comparisonOperatorWithIdenticalTypeParameter.types create mode 100644 tests/baselines/reference/comparisonOperatorWithOneOperandIsAny.types create mode 100644 tests/baselines/reference/comparisonOperatorWithOneOperandIsNull.types create mode 100644 tests/baselines/reference/comparisonOperatorWithOneOperandIsUndefined.types create mode 100644 tests/baselines/reference/comparisonOperatorWithSubtypeEnumAndNumber.types create mode 100644 tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.types create mode 100644 tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.types create mode 100644 tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.types create mode 100644 tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnOptionalProperty.types create mode 100644 tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.types create mode 100644 tests/baselines/reference/comparisonOperatorWithTwoOperandsAreAny.types create mode 100644 tests/baselines/reference/complexClassRelationships.types create mode 100644 tests/baselines/reference/compositeGenericFunction.types create mode 100644 tests/baselines/reference/compoundAdditionAssignmentLHSCanBeAssigned.types create mode 100644 tests/baselines/reference/compoundArithmeticAssignmentLHSCanBeAssigned.types create mode 100644 tests/baselines/reference/compoundAssignmentLHSIsReference.types create mode 100644 tests/baselines/reference/compoundVarDecl1.types create mode 100644 tests/baselines/reference/concatError.types create mode 100644 tests/baselines/reference/conditionalExpressions2.types create mode 100644 tests/baselines/reference/conditionalOperatorConditionIsBooleanType.types create mode 100644 tests/baselines/reference/conditionalOperatorConditionIsNumberType.types create mode 100644 tests/baselines/reference/conditionalOperatorConditionIsObjectType.types create mode 100644 tests/baselines/reference/conditionalOperatorConditoinIsAnyType.types create mode 100644 tests/baselines/reference/conditionalOperatorConditoinIsStringType.types create mode 100644 tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types create mode 100644 tests/baselines/reference/conditionallyDuplicateOverloadsCausedByOverloadResolution.types create mode 100644 tests/baselines/reference/conformanceFunctionOverloads.types create mode 100644 tests/baselines/reference/constantOverloadFunction.types create mode 100644 tests/baselines/reference/constraintCheckInGenericBaseTypeReference.types create mode 100644 tests/baselines/reference/constraintPropagationThroughReturnTypes.types create mode 100644 tests/baselines/reference/constraintSatisfactionWithAny.types create mode 100644 tests/baselines/reference/constraintSatisfactionWithEmptyObject.types create mode 100644 tests/baselines/reference/constraintsUsedInPrototypeProperty.types create mode 100644 tests/baselines/reference/constructSignatureAssignabilityInInheritance2.types create mode 100644 tests/baselines/reference/constructSignatureAssignabilityInInheritance4.types create mode 100644 tests/baselines/reference/constructSignatureAssignabilityInInheritance5.types create mode 100644 tests/baselines/reference/constructSignatureAssignabilityInInheritance6.types create mode 100644 tests/baselines/reference/constructSignaturesWithIdenticalOverloads.types create mode 100644 tests/baselines/reference/constructSignaturesWithOverloads.types create mode 100644 tests/baselines/reference/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.types create mode 100644 tests/baselines/reference/constructorArgWithGenericCallSignature.types create mode 100644 tests/baselines/reference/constructorArgs.types create mode 100644 tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.types create mode 100644 tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.types create mode 100644 tests/baselines/reference/constructorHasPrototypeProperty.types create mode 100644 tests/baselines/reference/constructorImplementationWithDefaultValues.types create mode 100644 tests/baselines/reference/constructorOverloads2.types create mode 100644 tests/baselines/reference/constructorOverloadsWithOptionalParameters.types create mode 100644 tests/baselines/reference/constructorReturningAPrimitive.types create mode 100644 tests/baselines/reference/constructorStaticParamName.types create mode 100644 tests/baselines/reference/constructorTypeWithTypeParameters.types create mode 100644 tests/baselines/reference/constructorWithExpressionLessReturn.types create mode 100644 tests/baselines/reference/contextualSigInstantiationRestParams.types create mode 100644 tests/baselines/reference/contextualSignatureInstantiation1.types create mode 100644 tests/baselines/reference/contextualSignatureInstantiation2.types create mode 100644 tests/baselines/reference/contextualSignatureInstantiation3.types create mode 100644 tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.types create mode 100644 tests/baselines/reference/contextualSignatureInstatiationContravariance.types create mode 100644 tests/baselines/reference/contextualSignatureInstatiationCovariance.types create mode 100644 tests/baselines/reference/contextualTypeAny.types create mode 100644 tests/baselines/reference/contextualTypeAppliedToVarArgs.types create mode 100644 tests/baselines/reference/contextualTypeArrayReturnType.types create mode 100644 tests/baselines/reference/contextualTyping1.types create mode 100644 tests/baselines/reference/contextualTyping10.types create mode 100644 tests/baselines/reference/contextualTyping12.types create mode 100644 tests/baselines/reference/contextualTyping13.types create mode 100644 tests/baselines/reference/contextualTyping14.types create mode 100644 tests/baselines/reference/contextualTyping15.types create mode 100644 tests/baselines/reference/contextualTyping16.types create mode 100644 tests/baselines/reference/contextualTyping17.types create mode 100644 tests/baselines/reference/contextualTyping18.types create mode 100644 tests/baselines/reference/contextualTyping19.types create mode 100644 tests/baselines/reference/contextualTyping2.types create mode 100644 tests/baselines/reference/contextualTyping20.types create mode 100644 tests/baselines/reference/contextualTyping22.types create mode 100644 tests/baselines/reference/contextualTyping23.types create mode 100644 tests/baselines/reference/contextualTyping25.types create mode 100644 tests/baselines/reference/contextualTyping26.types create mode 100644 tests/baselines/reference/contextualTyping27.types create mode 100644 tests/baselines/reference/contextualTyping28.types create mode 100644 tests/baselines/reference/contextualTyping29.types create mode 100644 tests/baselines/reference/contextualTyping3.types create mode 100644 tests/baselines/reference/contextualTyping31.types create mode 100644 tests/baselines/reference/contextualTyping32.types create mode 100644 tests/baselines/reference/contextualTyping34.types create mode 100644 tests/baselines/reference/contextualTyping35.types create mode 100644 tests/baselines/reference/contextualTyping36.types create mode 100644 tests/baselines/reference/contextualTyping37.types create mode 100644 tests/baselines/reference/contextualTyping38.types create mode 100644 tests/baselines/reference/contextualTyping4.types create mode 100644 tests/baselines/reference/contextualTyping40.types create mode 100644 tests/baselines/reference/contextualTyping6.types create mode 100644 tests/baselines/reference/contextualTyping7.types create mode 100644 tests/baselines/reference/contextualTyping8.types create mode 100644 tests/baselines/reference/contextualTyping9.types create mode 100644 tests/baselines/reference/contextualTypingArrayOfLambdas.types create mode 100644 tests/baselines/reference/contextualTypingOfConditionalExpression.types create mode 100644 tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures.types create mode 100644 tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.types create mode 100644 tests/baselines/reference/contextualTypingTwoInstancesOfSameTypeParameter.types create mode 100644 tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.types create mode 100644 tests/baselines/reference/contextualTypingWithGenericSignature.types create mode 100644 tests/baselines/reference/contextuallyTypingOrOperator.types create mode 100644 tests/baselines/reference/contextuallyTypingOrOperator2.types create mode 100644 tests/baselines/reference/convertKeywords.types create mode 100644 tests/baselines/reference/convertKeywordsYes.types create mode 100644 tests/baselines/reference/covariance1.types create mode 100644 tests/baselines/reference/crashInResolveInterface.types create mode 100644 tests/baselines/reference/crashInresolveReturnStatement.types create mode 100644 tests/baselines/reference/cyclicModuleImport.types create mode 100644 tests/baselines/reference/debugger.types create mode 100644 tests/baselines/reference/debuggerEmit.types create mode 100644 tests/baselines/reference/declFileAccessors.types create mode 100644 tests/baselines/reference/declFileAmbientExternalModuleWithSingleExportedModule.types create mode 100644 tests/baselines/reference/declFileCallSignatures.types create mode 100644 tests/baselines/reference/declFileClassWithIndexSignature.types create mode 100644 tests/baselines/reference/declFileClassWithStaticMethodReturningConstructor.types create mode 100644 tests/baselines/reference/declFileConstructSignatures.types create mode 100644 tests/baselines/reference/declFileConstructors.types create mode 100644 tests/baselines/reference/declFileEnumUsedAsValue.types create mode 100644 tests/baselines/reference/declFileEnums.types create mode 100644 tests/baselines/reference/declFileExportAssignmentImportInternalModule.types create mode 100644 tests/baselines/reference/declFileExportAssignmentOfGenericInterface.types create mode 100644 tests/baselines/reference/declFileExportImportChain.types create mode 100644 tests/baselines/reference/declFileExportImportChain2.types create mode 100644 tests/baselines/reference/declFileForClassWithMultipleBaseClasses.types create mode 100644 tests/baselines/reference/declFileForClassWithPrivateOverloadedFunction.types create mode 100644 tests/baselines/reference/declFileForExportedImport.types create mode 100644 tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.types create mode 100644 tests/baselines/reference/declFileForInterfaceWithOptionalFunction.types create mode 100644 tests/baselines/reference/declFileForInterfaceWithRestParams.types create mode 100644 tests/baselines/reference/declFileForTypeParameters.types create mode 100644 tests/baselines/reference/declFileForVarList.types create mode 100644 tests/baselines/reference/declFileFunctions.types create mode 100644 tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.types create mode 100644 tests/baselines/reference/declFileGenericType.types create mode 100644 tests/baselines/reference/declFileGenericType2.types create mode 100644 tests/baselines/reference/declFileImportModuleWithExportAssignment.types create mode 100644 tests/baselines/reference/declFileImportedTypeUseInTypeArgPosition.types create mode 100644 tests/baselines/reference/declFileIndexSignatures.types create mode 100644 tests/baselines/reference/declFileInternalAliases.types create mode 100644 tests/baselines/reference/declFileMethods.types create mode 100644 tests/baselines/reference/declFileModuleAssignmentInObjectLiteralProperty.types create mode 100644 tests/baselines/reference/declFileModuleContinuation.types create mode 100644 tests/baselines/reference/declFileModuleWithPropertyOfTypeModule.types create mode 100644 tests/baselines/reference/declFileOptionalInterfaceMethod.types create mode 100644 tests/baselines/reference/declFileRegressionTests.types create mode 100644 tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.types create mode 100644 tests/baselines/reference/declFileTypeofClass.types create mode 100644 tests/baselines/reference/declFileTypeofEnum.types create mode 100644 tests/baselines/reference/declFileTypeofFunction.types create mode 100644 tests/baselines/reference/declFileTypeofInAnonymousType.types create mode 100644 tests/baselines/reference/declFileTypeofModule.types create mode 100644 tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.types create mode 100644 tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.types create mode 100644 tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause1.types create mode 100644 tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause2.types create mode 100644 tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause3.types create mode 100644 tests/baselines/reference/declInput-2.types create mode 100644 tests/baselines/reference/declInput3.types create mode 100644 tests/baselines/reference/declInput4.types create mode 100644 tests/baselines/reference/declarationEmit_array-types-from-generic-array-usage.types create mode 100644 tests/baselines/reference/declarationEmit_nameConflicts.types create mode 100644 tests/baselines/reference/declarationEmit_nameConflicts2.types create mode 100644 tests/baselines/reference/declarationEmit_nameConflicts3.types create mode 100644 tests/baselines/reference/declarationEmit_nameConflictsWithAlias.types create mode 100644 tests/baselines/reference/declareDottedExtend.types create mode 100644 tests/baselines/reference/declareDottedModuleName.types create mode 100644 tests/baselines/reference/declareExternalModuleWithExportAssignedFundule.types create mode 100644 tests/baselines/reference/declareFileExportAssignment.types create mode 100644 tests/baselines/reference/declareFileExportAssignmentWithVarFromVariableStatement.types create mode 100644 tests/baselines/reference/declaredExternalModule.types create mode 100644 tests/baselines/reference/declaredExternalModuleWithExportAssignment.types create mode 100644 tests/baselines/reference/decrementOperatorWithAnyOtherType.types create mode 100644 tests/baselines/reference/decrementOperatorWithEnumType.types create mode 100644 tests/baselines/reference/decrementOperatorWithNumberType.types create mode 100644 tests/baselines/reference/defaultIndexProps1.types create mode 100644 tests/baselines/reference/defaultIndexProps2.types create mode 100644 tests/baselines/reference/deleteOperatorWithBooleanType.types create mode 100644 tests/baselines/reference/deleteOperatorWithEnumType.types create mode 100644 tests/baselines/reference/deleteOperatorWithNumberType.types create mode 100644 tests/baselines/reference/deleteOperatorWithStringType.types create mode 100644 tests/baselines/reference/dependencyViaImportAlias.types create mode 100644 tests/baselines/reference/deprecatedBool.types create mode 100644 tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.types create mode 100644 tests/baselines/reference/derivedClassOverridesWithoutSubtype.types create mode 100644 tests/baselines/reference/derivedClasses.types create mode 100644 tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.types create mode 100644 tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.types create mode 100644 tests/baselines/reference/doNotWidenAtObjectLiteralPropertyAssignment.types create mode 100644 tests/baselines/reference/doWhileBreakStatements.types create mode 100644 tests/baselines/reference/doWhileContinueStatements.types create mode 100644 tests/baselines/reference/doWhileLoop.types create mode 100644 tests/baselines/reference/dottedModuleName2.types create mode 100644 tests/baselines/reference/dottedSymbolResolution1.types create mode 100644 tests/baselines/reference/duplicateAnonymousInners1.types create mode 100644 tests/baselines/reference/duplicateAnonymousModuleClasses.types create mode 100644 tests/baselines/reference/duplicateConstructSignature.types create mode 100644 tests/baselines/reference/duplicateConstructSignature2.types create mode 100644 tests/baselines/reference/duplicateConstructorOverloadSignature.types create mode 100644 tests/baselines/reference/duplicateConstructorOverloadSignature2.types create mode 100644 tests/baselines/reference/duplicateIdentifierShouldNotShortCircuitBaseTypeBinding.types create mode 100644 tests/baselines/reference/duplicateOverloadInTypeAugmentation1.types create mode 100644 tests/baselines/reference/duplicateVarAndImport.types create mode 100644 tests/baselines/reference/duplicateVariableDeclaration1.types create mode 100644 tests/baselines/reference/duplicateVariablesByScope.types create mode 100644 tests/baselines/reference/dynamicModuleTypecheckError.types create mode 100644 tests/baselines/reference/emitBOM.types create mode 100644 tests/baselines/reference/emitCommentsOnlyFile.types create mode 100644 tests/baselines/reference/emitMemberAccessExpression.types create mode 100644 tests/baselines/reference/emitPostComments.types create mode 100644 tests/baselines/reference/emitPreComments.types create mode 100644 tests/baselines/reference/emptyEnum.types create mode 100644 tests/baselines/reference/emptyExpr.types create mode 100644 tests/baselines/reference/emptyFile-declaration.types create mode 100644 tests/baselines/reference/emptyFile-souremap.types create mode 100644 tests/baselines/reference/emptyFile.types create mode 100644 tests/baselines/reference/emptyIndexer.types create mode 100644 tests/baselines/reference/enumBasics.types create mode 100644 tests/baselines/reference/enumCodeGenNewLines1.types create mode 100644 tests/baselines/reference/enumDecl1.types create mode 100644 tests/baselines/reference/enumFromExternalModule.types create mode 100644 tests/baselines/reference/enumIdentifierLiterals.types create mode 100644 tests/baselines/reference/enumIndexer.types create mode 100644 tests/baselines/reference/enumMapBackIntoItself.types create mode 100644 tests/baselines/reference/enumMerging.types create mode 100644 tests/baselines/reference/enumNegativeLiteral1.types create mode 100644 tests/baselines/reference/enumNumbering1.types create mode 100644 tests/baselines/reference/enumOperations.types create mode 100644 tests/baselines/reference/enumWithQuotedElementName1.types create mode 100644 tests/baselines/reference/enumWithQuotedElementName2.types create mode 100644 tests/baselines/reference/enumWithUnicodeEscape1.types create mode 100644 tests/baselines/reference/enumsWithMultipleDeclarations3.types create mode 100644 tests/baselines/reference/es3-amd.types create mode 100644 tests/baselines/reference/es3-declaration-amd.types create mode 100644 tests/baselines/reference/es3-sourcemap-amd.types create mode 100644 tests/baselines/reference/es5-amd.types create mode 100644 tests/baselines/reference/es5-declaration-amd.types create mode 100644 tests/baselines/reference/es5-souremap-amd.types create mode 100644 tests/baselines/reference/es6ClassSuperCodegenBug.types create mode 100644 tests/baselines/reference/es6ClassTest4.types create mode 100644 tests/baselines/reference/es6ClassTest5.types create mode 100644 tests/baselines/reference/es6ClassTest7.types create mode 100644 tests/baselines/reference/es6ClassTest8.types create mode 100644 tests/baselines/reference/escapedIdentifiers.types create mode 100644 tests/baselines/reference/everyTypeAssignableToAny.types create mode 100644 tests/baselines/reference/everyTypeWithAnnotationAndInitializer.types create mode 100644 tests/baselines/reference/everyTypeWithInitializer.types create mode 100644 tests/baselines/reference/exportAssignClassAndModule.types create mode 100644 tests/baselines/reference/exportAssignValueAndType.types create mode 100644 tests/baselines/reference/exportAssignedTypeAsTypeAnnotation.types create mode 100644 tests/baselines/reference/exportAssignmentCircularModules.types create mode 100644 tests/baselines/reference/exportAssignmentClass.types create mode 100644 tests/baselines/reference/exportAssignmentEnum.types create mode 100644 tests/baselines/reference/exportAssignmentError.types create mode 100644 tests/baselines/reference/exportAssignmentFunction.types create mode 100644 tests/baselines/reference/exportAssignmentGenericType.types create mode 100644 tests/baselines/reference/exportAssignmentInterface.types create mode 100644 tests/baselines/reference/exportAssignmentInternalModule.types create mode 100644 tests/baselines/reference/exportAssignmentMergedInterface.types create mode 100644 tests/baselines/reference/exportAssignmentMergedModule.types create mode 100644 tests/baselines/reference/exportAssignmentOfGenericType1.types create mode 100644 tests/baselines/reference/exportAssignmentTopLevelClodule.types create mode 100644 tests/baselines/reference/exportAssignmentTopLevelEnumdule.types create mode 100644 tests/baselines/reference/exportAssignmentTopLevelFundule.types create mode 100644 tests/baselines/reference/exportAssignmentTopLevelIdentifier.types create mode 100644 tests/baselines/reference/exportAssignmentVariable.types create mode 100644 tests/baselines/reference/exportAssignmentWithImportStatementPrivacyError.types create mode 100644 tests/baselines/reference/exportAssignmentWithPrivacyError.types create mode 100644 tests/baselines/reference/exportCodeGen.types create mode 100644 tests/baselines/reference/exportEqualCallable.types create mode 100644 tests/baselines/reference/exportEqualNamespaces.types create mode 100644 tests/baselines/reference/exportImport.types create mode 100644 tests/baselines/reference/exportImportAlias.types create mode 100644 tests/baselines/reference/exportImportAndClodule.types create mode 100644 tests/baselines/reference/exportImportMultipleFiles.types create mode 100644 tests/baselines/reference/exportImportNonInstantiatedModule.types create mode 100644 tests/baselines/reference/exportImportNonInstantiatedModule2.types create mode 100644 tests/baselines/reference/exportPrivateType.types create mode 100644 tests/baselines/reference/exportVisibility.types create mode 100644 tests/baselines/reference/exportedInterfaceInaccessibleInCallbackInModule.types create mode 100644 tests/baselines/reference/exportedVariable1.types create mode 100644 tests/baselines/reference/extBaseClass1.types create mode 100644 tests/baselines/reference/extendAndImplementTheSameBaseType.types create mode 100644 tests/baselines/reference/extendBaseClassBeforeItsDeclared.types create mode 100644 tests/baselines/reference/extendBooleanInterface.types create mode 100644 tests/baselines/reference/extendNumberInterface.types create mode 100644 tests/baselines/reference/extendStringInterface.types create mode 100644 tests/baselines/reference/extendedInterfaceGenericType.types create mode 100644 tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types create mode 100644 tests/baselines/reference/externFunc.types create mode 100644 tests/baselines/reference/externModuleClobber.types create mode 100644 tests/baselines/reference/externalModuleAssignToVar.types create mode 100644 tests/baselines/reference/externalModuleQualification.types create mode 100644 tests/baselines/reference/externalModuleReferenceOfImportDeclarationWithExportModifier.types create mode 100644 tests/baselines/reference/externalModuleResolution.types create mode 100644 tests/baselines/reference/externalModuleResolution2.types create mode 100644 tests/baselines/reference/fatArrowSelf.types create mode 100644 tests/baselines/reference/fatArrowfunctionAsType.types create mode 100644 tests/baselines/reference/fatarrowfunctions.types create mode 100644 tests/baselines/reference/fatarrowfunctionsInFunctionParameterDefaults.types create mode 100644 tests/baselines/reference/fatarrowfunctionsInFunctions.types create mode 100644 tests/baselines/reference/fileReferencesWithNoExtensions.types create mode 100644 tests/baselines/reference/fillInMissingTypeArgsOnConstructCalls.types create mode 100644 tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.types create mode 100644 tests/baselines/reference/forBreakStatements.types create mode 100644 tests/baselines/reference/forContinueStatements.types create mode 100644 tests/baselines/reference/forInBreakStatements.types create mode 100644 tests/baselines/reference/forInContinueStatements.types create mode 100644 tests/baselines/reference/forInModule.types create mode 100644 tests/baselines/reference/forInStatement1.types create mode 100644 tests/baselines/reference/forInStatement3.types create mode 100644 tests/baselines/reference/forInStatement5.types create mode 100644 tests/baselines/reference/forInStatement6.types create mode 100644 tests/baselines/reference/forStatements.types create mode 100644 tests/baselines/reference/forStatementsMultipleValidDecl.types create mode 100644 tests/baselines/reference/funcdecl.types create mode 100644 tests/baselines/reference/functionAssignmentError.types create mode 100644 tests/baselines/reference/functionCall1.types create mode 100644 tests/baselines/reference/functionCall2.types create mode 100644 tests/baselines/reference/functionCall3.types create mode 100644 tests/baselines/reference/functionCall4.types create mode 100644 tests/baselines/reference/functionCall5.types create mode 100644 tests/baselines/reference/functionConstraintSatisfaction.types create mode 100644 tests/baselines/reference/functionConstraintSatisfaction3.types create mode 100644 tests/baselines/reference/functionDeclarationWithArgumentOfTypeFunctionTypeArray.types create mode 100644 tests/baselines/reference/functionExpressionAndLambdaMatchesFunction.types create mode 100644 tests/baselines/reference/functionExpressionReturningItself.types create mode 100644 tests/baselines/reference/functionImplementations.types create mode 100644 tests/baselines/reference/functionInIfStatementInModule.types create mode 100644 tests/baselines/reference/functionLiteral.types create mode 100644 tests/baselines/reference/functionLiteralForOverloads.types create mode 100644 tests/baselines/reference/functionLiteralForOverloads2.types create mode 100644 tests/baselines/reference/functionLiterals.types create mode 100644 tests/baselines/reference/functionMergedWithModule.types create mode 100644 tests/baselines/reference/functionOnlyHasThrow.types create mode 100644 tests/baselines/reference/functionOverloads10.types create mode 100644 tests/baselines/reference/functionOverloads12.types create mode 100644 tests/baselines/reference/functionOverloads13.types create mode 100644 tests/baselines/reference/functionOverloads14.types create mode 100644 tests/baselines/reference/functionOverloads15.types create mode 100644 tests/baselines/reference/functionOverloads16.types create mode 100644 tests/baselines/reference/functionOverloads21.types create mode 100644 tests/baselines/reference/functionOverloads23.types create mode 100644 tests/baselines/reference/functionOverloads24.types create mode 100644 tests/baselines/reference/functionOverloads25.types create mode 100644 tests/baselines/reference/functionOverloads26.types create mode 100644 tests/baselines/reference/functionOverloads28.types create mode 100644 tests/baselines/reference/functionOverloads30.types create mode 100644 tests/baselines/reference/functionOverloads31.types create mode 100644 tests/baselines/reference/functionOverloads32.types create mode 100644 tests/baselines/reference/functionOverloads33.types create mode 100644 tests/baselines/reference/functionOverloads35.types create mode 100644 tests/baselines/reference/functionOverloads36.types create mode 100644 tests/baselines/reference/functionOverloads38.types create mode 100644 tests/baselines/reference/functionOverloads39.types create mode 100644 tests/baselines/reference/functionOverloads42.types create mode 100644 tests/baselines/reference/functionOverloads6.types create mode 100644 tests/baselines/reference/functionOverloads7.types create mode 100644 tests/baselines/reference/functionOverloads8.types create mode 100644 tests/baselines/reference/functionOverloads9.types create mode 100644 tests/baselines/reference/functionOverloadsOnGenericArity1.types create mode 100644 tests/baselines/reference/functionOverloadsOnGenericArity2.types create mode 100644 tests/baselines/reference/functionOverloadsRecursiveGenericReturnType.types create mode 100644 tests/baselines/reference/functionReturn.types create mode 100644 tests/baselines/reference/functionReturningItself.types create mode 100644 tests/baselines/reference/functionSubtypingOfVarArgs.types create mode 100644 tests/baselines/reference/functionSubtypingOfVarArgs2.types create mode 100644 tests/baselines/reference/functionType.types create mode 100644 tests/baselines/reference/functionWithAnyReturnTypeAndNoReturnExpression.types create mode 100644 tests/baselines/reference/functionWithMultipleReturnStatements2.types create mode 100644 tests/baselines/reference/funduleExportedClassIsUsedBeforeDeclaration.types create mode 100644 tests/baselines/reference/funduleOfFunctionWithoutReturnTypeAnnotation.types create mode 100644 tests/baselines/reference/funduleUsedAcrossFileBoundary.types create mode 100644 tests/baselines/reference/generatedContextualTyping.types create mode 100644 tests/baselines/reference/generativeRecursionWithTypeOf.types create mode 100644 tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName2.types create mode 100644 tests/baselines/reference/genericAndNonGenericOverload1.types create mode 100644 tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types create mode 100644 tests/baselines/reference/genericArray0.types create mode 100644 tests/baselines/reference/genericArray1.types create mode 100644 tests/baselines/reference/genericArrayPropertyAssignment.types create mode 100644 tests/baselines/reference/genericBaseClassLiteralProperty.types create mode 100644 tests/baselines/reference/genericBaseClassLiteralProperty2.types create mode 100644 tests/baselines/reference/genericCallTypeArgumentInference.types create mode 100644 tests/baselines/reference/genericCallWithArrayLiteralArgs.types create mode 100644 tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.types create mode 100644 tests/baselines/reference/genericCallWithFixedArguments.types create mode 100644 tests/baselines/reference/genericCallWithFunctionTypedArguments.types create mode 100644 tests/baselines/reference/genericCallWithFunctionTypedArguments2.types create mode 100644 tests/baselines/reference/genericCallWithFunctionTypedArguments3.types create mode 100644 tests/baselines/reference/genericCallWithFunctionTypedArguments4.types create mode 100644 tests/baselines/reference/genericCallWithGenericSignatureArguments.types create mode 100644 tests/baselines/reference/genericCallWithGenericSignatureArguments3.types create mode 100644 tests/baselines/reference/genericCallWithNonGenericArgs1.types create mode 100644 tests/baselines/reference/genericCallWithNonSymmetricSubtypes.types create mode 100644 tests/baselines/reference/genericCallWithObjectLiteralArgs.types create mode 100644 tests/baselines/reference/genericCallWithObjectTypeArgs.types create mode 100644 tests/baselines/reference/genericCallWithObjectTypeArgs2.types create mode 100644 tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints.types create mode 100644 tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.types create mode 100644 tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexers.types create mode 100644 tests/baselines/reference/genericCallWithObjectTypeArgsAndNumericIndexer.types create mode 100644 tests/baselines/reference/genericCallWithObjectTypeArgsAndStringIndexer.types create mode 100644 tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.types create mode 100644 tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments.types create mode 100644 tests/baselines/reference/genericCallbacksAndClassHierarchy.types create mode 100644 tests/baselines/reference/genericClassImplementingGenericInterfaceFromAnotherModule.types create mode 100644 tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.types create mode 100644 tests/baselines/reference/genericClassPropertyInheritanceSpecialization.types create mode 100644 tests/baselines/reference/genericClassStaticMethod.types create mode 100644 tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.types create mode 100644 tests/baselines/reference/genericClassWithObjectTypeArgsAndConstraints.types create mode 100644 tests/baselines/reference/genericClassWithStaticFactory.types create mode 100644 tests/baselines/reference/genericClasses0.types create mode 100644 tests/baselines/reference/genericClasses1.types create mode 100644 tests/baselines/reference/genericClasses2.types create mode 100644 tests/baselines/reference/genericClasses3.types create mode 100644 tests/baselines/reference/genericClasses4.types create mode 100644 tests/baselines/reference/genericClassesInModule.types create mode 100644 tests/baselines/reference/genericClassesInModule2.types create mode 100644 tests/baselines/reference/genericCloduleInModule.types create mode 100644 tests/baselines/reference/genericConstraintDeclaration.types create mode 100644 tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.types create mode 100644 tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.types create mode 100644 tests/baselines/reference/genericConstructSignatureInInterface.types create mode 100644 tests/baselines/reference/genericContextualTypingSpecialization.types create mode 100644 tests/baselines/reference/genericFunctionHasFreshTypeArgs.types create mode 100644 tests/baselines/reference/genericFunctionSpecializations1.types create mode 100644 tests/baselines/reference/genericFunctions0.types create mode 100644 tests/baselines/reference/genericFunctions1.types create mode 100644 tests/baselines/reference/genericFunctions2.types create mode 100644 tests/baselines/reference/genericFunctions3.types create mode 100644 tests/baselines/reference/genericFunctionsWithOptionalParameters1.types create mode 100644 tests/baselines/reference/genericFunctionsWithOptionalParameters3.types create mode 100644 tests/baselines/reference/genericImplements.types create mode 100644 tests/baselines/reference/genericInference1.types create mode 100644 tests/baselines/reference/genericInference2.types create mode 100644 tests/baselines/reference/genericInstanceOf.types create mode 100644 tests/baselines/reference/genericInstantiationEquivalentToObjectLiteral.types create mode 100644 tests/baselines/reference/genericInterfaceFunctionTypeParameter.types create mode 100644 tests/baselines/reference/genericInterfaceImplementation.types create mode 100644 tests/baselines/reference/genericInterfaceTypeCall.types create mode 100644 tests/baselines/reference/genericMethodOverspecialization.types create mode 100644 tests/baselines/reference/genericObjectLitReturnType.types create mode 100644 tests/baselines/reference/genericOfACloduleType1.types create mode 100644 tests/baselines/reference/genericOfACloduleType2.types create mode 100644 tests/baselines/reference/genericOverloadSignatures.types create mode 100644 tests/baselines/reference/genericParameterAssignability1.types create mode 100644 tests/baselines/reference/genericPrototypeProperty.types create mode 100644 tests/baselines/reference/genericPrototypeProperty2.types create mode 100644 tests/baselines/reference/genericPrototypeProperty3.types create mode 100644 tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.types create mode 100644 tests/baselines/reference/genericReversingTypeParameters.types create mode 100644 tests/baselines/reference/genericReversingTypeParameters2.types create mode 100644 tests/baselines/reference/genericSignatureInheritance.types create mode 100644 tests/baselines/reference/genericSignatureInheritance2.types create mode 100644 tests/baselines/reference/genericSpecializationToTypeLiteral1.types create mode 100644 tests/baselines/reference/genericSpecializations1.types create mode 100644 tests/baselines/reference/genericStaticAnyTypeFunction.types create mode 100644 tests/baselines/reference/genericTypeArgumentInference1.types create mode 100644 tests/baselines/reference/genericTypeAssertions3.types create mode 100644 tests/baselines/reference/genericTypeParameterEquivalence2.types create mode 100644 tests/baselines/reference/genericTypeWithCallableMembers.types create mode 100644 tests/baselines/reference/genericTypeWithCallableMembers2.types create mode 100644 tests/baselines/reference/genericTypeWithMultipleBases1.types create mode 100644 tests/baselines/reference/genericTypeWithMultipleBases2.types create mode 100644 tests/baselines/reference/genericTypeWithMultipleBases3.types create mode 100644 tests/baselines/reference/genericWithCallSignatureReturningSpecialization.types create mode 100644 tests/baselines/reference/genericWithCallSignatures1.types create mode 100644 tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types create mode 100644 tests/baselines/reference/genericWithIndexerOfTypeParameterType2.types create mode 100644 tests/baselines/reference/generics0.types create mode 100644 tests/baselines/reference/generics1NoError.types create mode 100644 tests/baselines/reference/generics2NoError.types create mode 100644 tests/baselines/reference/generics3.types create mode 100644 tests/baselines/reference/generics4NoError.types create mode 100644 tests/baselines/reference/genericsAndHigherOrderFunctions.types create mode 100644 tests/baselines/reference/genericsManyTypeParameters.types create mode 100644 tests/baselines/reference/getterSetterNonAccessor.types create mode 100644 tests/baselines/reference/global.types create mode 100644 tests/baselines/reference/globalThis.types create mode 100644 tests/baselines/reference/globalThisCapture.types create mode 100644 tests/baselines/reference/heterogeneousArrayLiterals.types create mode 100644 tests/baselines/reference/hidingCallSignatures.types create mode 100644 tests/baselines/reference/hidingConstructSignatures.types create mode 100644 tests/baselines/reference/hidingIndexSignatures.types create mode 100644 tests/baselines/reference/icomparable.types create mode 100644 tests/baselines/reference/idInProp.types create mode 100644 tests/baselines/reference/identicalCallSignatures.types create mode 100644 tests/baselines/reference/identicalCallSignatures2.types create mode 100644 tests/baselines/reference/identicalCallSignatures3.types create mode 100644 tests/baselines/reference/identityForSignaturesWithTypeParametersSwitched.types create mode 100644 tests/baselines/reference/ifDoWhileStatements.types create mode 100644 tests/baselines/reference/illegalGenericWrapping1.types create mode 100644 tests/baselines/reference/implementArrayInterface.types create mode 100644 tests/baselines/reference/implementInterfaceAnyMemberWithVoid.types create mode 100644 tests/baselines/reference/implicitAnyAnyReturningFunction.types create mode 100644 tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType2.types create mode 100644 tests/baselines/reference/implicitAnyGenerics.types create mode 100644 tests/baselines/reference/implicitAnyInCatch.types create mode 100644 tests/baselines/reference/importAliasIdentifiers.types create mode 100644 tests/baselines/reference/importAliasWithDottedName.types create mode 100644 tests/baselines/reference/importAndVariableDeclarationConflict2.types create mode 100644 tests/baselines/reference/importDeclWithExportModifierInAmbientContext.types create mode 100644 tests/baselines/reference/importDeclarationUsedAsTypeQuery.types create mode 100644 tests/baselines/reference/importImportOnlyModule.types create mode 100644 tests/baselines/reference/importInTypePosition.types create mode 100644 tests/baselines/reference/importOnAliasedIdentifiers.types create mode 100644 tests/baselines/reference/importShadowsGlobalName.types create mode 100644 tests/baselines/reference/importStatements.types create mode 100644 tests/baselines/reference/importUsedInExtendsList1.types create mode 100644 tests/baselines/reference/import_reference-exported-alias.types create mode 100644 tests/baselines/reference/import_reference-to-type-alias.types create mode 100644 tests/baselines/reference/import_unneeded-require-when-referenecing-aliased-type-throug-array.types create mode 100644 tests/baselines/reference/import_var-referencing-an-imported-module-alias.types create mode 100644 tests/baselines/reference/importedModuleClassNameClash.types create mode 100644 tests/baselines/reference/inOperatorWithFunction.types create mode 100644 tests/baselines/reference/inOperatorWithGeneric.types create mode 100644 tests/baselines/reference/inOperatorWithValidOperands.types create mode 100644 tests/baselines/reference/incrementOperatorWithAnyOtherType.types create mode 100644 tests/baselines/reference/incrementOperatorWithEnumType.types create mode 100644 tests/baselines/reference/incrementOperatorWithNumberType.types create mode 100644 tests/baselines/reference/indexClassByNumber.types create mode 100644 tests/baselines/reference/indexIntoEnum.types create mode 100644 tests/baselines/reference/indexSignaturesInferentialTyping.types create mode 100644 tests/baselines/reference/indexer.types create mode 100644 tests/baselines/reference/indexer2.types create mode 100644 tests/baselines/reference/indexer3.types create mode 100644 tests/baselines/reference/indexerA.types create mode 100644 tests/baselines/reference/indexerReturningTypeParameter1.types create mode 100644 tests/baselines/reference/indexersInClassType.types create mode 100644 tests/baselines/reference/inferSecondaryParameter.types create mode 100644 tests/baselines/reference/inferTypeArgumentsInSignatureWithRestParameters.types create mode 100644 tests/baselines/reference/inferentialTypingWithFunctionType.types create mode 100644 tests/baselines/reference/inferentialTypingWithFunctionType2.types create mode 100644 tests/baselines/reference/inferentialTypingWithFunctionTypeNested.types create mode 100644 tests/baselines/reference/inferentialTypingWithFunctionTypeSyntacticScenarios.types create mode 100644 tests/baselines/reference/inferentialTypingWithFunctionTypeZip.types create mode 100644 tests/baselines/reference/inferentiallyTypingAnEmptyArray.types create mode 100644 tests/baselines/reference/infiniteExpandingTypeThroughInheritanceInstantiation.types create mode 100644 tests/baselines/reference/infiniteExpansionThroughTypeInference.types create mode 100644 tests/baselines/reference/infinitelyExpandingBaseTypes1.types create mode 100644 tests/baselines/reference/infinitelyExpandingBaseTypes2.types create mode 100644 tests/baselines/reference/infinitelyExpandingTypeAssignability.types create mode 100644 tests/baselines/reference/infinitelyExpandingTypes3.types create mode 100644 tests/baselines/reference/infinitelyExpandingTypes4.types create mode 100644 tests/baselines/reference/infinitelyExpandingTypes5.types create mode 100644 tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.types create mode 100644 tests/baselines/reference/infinitelyGenerativeInheritance1.types create mode 100644 tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.types create mode 100644 tests/baselines/reference/inheritanceMemberFuncOverridingMethod.types create mode 100644 tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.types create mode 100644 tests/baselines/reference/inheritanceOfGenericConstructorMethod1.types create mode 100644 tests/baselines/reference/inheritanceOfGenericConstructorMethod2.types create mode 100644 tests/baselines/reference/inheritanceStaticFuncOverridingMethod.types create mode 100644 tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.types create mode 100644 tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.types create mode 100644 tests/baselines/reference/inheritanceStaticMembersCompatible.types create mode 100644 tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.types create mode 100644 tests/baselines/reference/inheritedFunctionAssignmentCompatibility.types create mode 100644 tests/baselines/reference/inheritedGenericCallSignature.types create mode 100644 tests/baselines/reference/inheritedMembersAndIndexSignaturesFromDifferentBases2.types create mode 100644 tests/baselines/reference/inheritedOverloadedSpecializedSignatures.types create mode 100644 tests/baselines/reference/initializersWidened.types create mode 100644 tests/baselines/reference/innerAliases2.types create mode 100644 tests/baselines/reference/innerBoundLambdaEmit.types create mode 100644 tests/baselines/reference/innerExtern.types create mode 100644 tests/baselines/reference/innerFunc.types create mode 100644 tests/baselines/reference/innerOverloads.types create mode 100644 tests/baselines/reference/innerTypeArgumentInference.types create mode 100644 tests/baselines/reference/innerTypeParameterShadowingOuterOne.types create mode 100644 tests/baselines/reference/innerTypeParameterShadowingOuterOne2.types create mode 100644 tests/baselines/reference/instanceAndStaticDeclarations1.types create mode 100644 tests/baselines/reference/instanceMemberInitialization.types create mode 100644 tests/baselines/reference/instanceOfInExternalModules.types create mode 100644 tests/baselines/reference/instanceSubtypeCheck1.types create mode 100644 tests/baselines/reference/instanceofOperatorWithAny.types create mode 100644 tests/baselines/reference/instanceofOperatorWithLHSIsObject.types create mode 100644 tests/baselines/reference/instanceofOperatorWithLHSIsTypeParameter.types create mode 100644 tests/baselines/reference/instanceofOperatorWithRHSIsSubtypeOfFunction.types create mode 100644 tests/baselines/reference/instantiateGenericClassWithZeroTypeArguments.types create mode 100644 tests/baselines/reference/instantiatedModule.types create mode 100644 tests/baselines/reference/instantiatedReturnTypeContravariance.types create mode 100644 tests/baselines/reference/interMixingModulesInterfaces0.types create mode 100644 tests/baselines/reference/interMixingModulesInterfaces1.types create mode 100644 tests/baselines/reference/interMixingModulesInterfaces2.types create mode 100644 tests/baselines/reference/interMixingModulesInterfaces3.types create mode 100644 tests/baselines/reference/interMixingModulesInterfaces4.types create mode 100644 tests/baselines/reference/interMixingModulesInterfaces5.types create mode 100644 tests/baselines/reference/interface0.types create mode 100644 tests/baselines/reference/interfaceContextualType.types create mode 100644 tests/baselines/reference/interfaceDeclaration5.types create mode 100644 tests/baselines/reference/interfaceExtendsClass1.types create mode 100644 tests/baselines/reference/interfaceInReopenedModule.types create mode 100644 tests/baselines/reference/interfaceInheritance2.types create mode 100644 tests/baselines/reference/interfaceOnly.types create mode 100644 tests/baselines/reference/interfacePropertiesWithSameName1.types create mode 100644 tests/baselines/reference/interfaceSubtyping.types create mode 100644 tests/baselines/reference/interfaceThatHidesBaseProperty.types create mode 100644 tests/baselines/reference/interfaceWithCallAndConstructSignature.types create mode 100644 tests/baselines/reference/interfaceWithCallSignaturesThatHidesBaseSignature.types create mode 100644 tests/baselines/reference/interfaceWithCallSignaturesThatHidesBaseSignature2.types create mode 100644 tests/baselines/reference/interfaceWithConstructSignaturesThatHidesBaseSignature.types create mode 100644 tests/baselines/reference/interfaceWithConstructSignaturesThatHidesBaseSignature2.types create mode 100644 tests/baselines/reference/interfaceWithOptionalProperty.types create mode 100644 tests/baselines/reference/interfaceWithOverloadedCallAndConstructSignatures.types create mode 100644 tests/baselines/reference/interfaceWithPropertyOfEveryType.types create mode 100644 tests/baselines/reference/interfaceWithSpecializedCallAndConstructSignatures.types create mode 100644 tests/baselines/reference/interfacedecl.types create mode 100644 tests/baselines/reference/internalAliasClass.types create mode 100644 tests/baselines/reference/internalAliasClassInsideLocalModuleWithExport.types create mode 100644 tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExport.types create mode 100644 tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithExport.types create mode 100644 tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithoutExport.types create mode 100644 tests/baselines/reference/internalAliasEnum.types create mode 100644 tests/baselines/reference/internalAliasEnumInsideLocalModuleWithExport.types create mode 100644 tests/baselines/reference/internalAliasEnumInsideLocalModuleWithoutExport.types create mode 100644 tests/baselines/reference/internalAliasEnumInsideTopLevelModuleWithExport.types create mode 100644 tests/baselines/reference/internalAliasEnumInsideTopLevelModuleWithoutExport.types create mode 100644 tests/baselines/reference/internalAliasFunction.types create mode 100644 tests/baselines/reference/internalAliasFunctionInsideLocalModuleWithExport.types create mode 100644 tests/baselines/reference/internalAliasFunctionInsideLocalModuleWithoutExport.types create mode 100644 tests/baselines/reference/internalAliasFunctionInsideTopLevelModuleWithExport.types create mode 100644 tests/baselines/reference/internalAliasFunctionInsideTopLevelModuleWithoutExport.types create mode 100644 tests/baselines/reference/internalAliasInitializedModule.types create mode 100644 tests/baselines/reference/internalAliasInitializedModuleInsideLocalModuleWithExport.types create mode 100644 tests/baselines/reference/internalAliasInitializedModuleInsideLocalModuleWithoutExport.types create mode 100644 tests/baselines/reference/internalAliasInitializedModuleInsideTopLevelModuleWithExport.types create mode 100644 tests/baselines/reference/internalAliasInitializedModuleInsideTopLevelModuleWithoutExport.types create mode 100644 tests/baselines/reference/internalAliasInterface.types create mode 100644 tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithExport.types create mode 100644 tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExport.types create mode 100644 tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithExport.types create mode 100644 tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithoutExport.types create mode 100644 tests/baselines/reference/internalAliasUninitializedModule.types create mode 100644 tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.types create mode 100644 tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.types create mode 100644 tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.types create mode 100644 tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.types create mode 100644 tests/baselines/reference/internalAliasVar.types create mode 100644 tests/baselines/reference/internalAliasVarInsideLocalModuleWithExport.types create mode 100644 tests/baselines/reference/internalAliasVarInsideLocalModuleWithoutExport.types create mode 100644 tests/baselines/reference/internalAliasVarInsideTopLevelModuleWithExport.types create mode 100644 tests/baselines/reference/internalAliasVarInsideTopLevelModuleWithoutExport.types create mode 100644 tests/baselines/reference/internalAliasWithDottedNameEmit.types create mode 100644 tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.types create mode 100644 tests/baselines/reference/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.types create mode 100644 tests/baselines/reference/internalImportUnInstantiatedModuleNotReferencingInstanceNoConflict.types create mode 100644 tests/baselines/reference/invalidSplice.types create mode 100644 tests/baselines/reference/invalidSwitchBreakStatement.types create mode 100644 tests/baselines/reference/invalidTypeNames.types create mode 100644 tests/baselines/reference/invalidUndefinedValues.types create mode 100644 tests/baselines/reference/ipromise2.types create mode 100644 tests/baselines/reference/ipromise3.types create mode 100644 tests/baselines/reference/ipromise4.types create mode 100644 tests/baselines/reference/isLiteral1.types create mode 100644 tests/baselines/reference/isLiteral2.types create mode 100644 tests/baselines/reference/keywordField.types create mode 100644 tests/baselines/reference/lambdaASIEmit.types create mode 100644 tests/baselines/reference/lambdaExpression.types create mode 100644 tests/baselines/reference/libdtsFix.types create mode 100644 tests/baselines/reference/library_ArraySlice.types create mode 100644 tests/baselines/reference/library_DatePrototypeProperties.types create mode 100644 tests/baselines/reference/library_ObjectPrototypeProperties.types create mode 100644 tests/baselines/reference/library_RegExpExecArraySlice.types create mode 100644 tests/baselines/reference/library_StringSlice.types create mode 100644 tests/baselines/reference/listFailure.types create mode 100644 tests/baselines/reference/literals1.types create mode 100644 tests/baselines/reference/localAliasExportAssignment.types create mode 100644 tests/baselines/reference/localImportNameVsGlobalName.types create mode 100644 tests/baselines/reference/localVariablesReturnedFromCatchBlocks.types create mode 100644 tests/baselines/reference/logicalAndOperatorWithEveryType.types create mode 100644 tests/baselines/reference/logicalAndOperatorWithTypeParameters.types create mode 100644 tests/baselines/reference/logicalNotOperatorWithBooleanType.types create mode 100644 tests/baselines/reference/logicalNotOperatorWithEnumType.types create mode 100644 tests/baselines/reference/logicalNotOperatorWithNumberType.types create mode 100644 tests/baselines/reference/logicalNotOperatorWithStringType.types create mode 100644 tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.types create mode 100644 tests/baselines/reference/logicalOrExpressionIsNotContextuallyTyped.types create mode 100644 tests/baselines/reference/logicalOrOperatorWithEveryType.types create mode 100644 tests/baselines/reference/logicalOrOperatorWithTypeParameters.types create mode 100644 tests/baselines/reference/m7Bugs.types create mode 100644 tests/baselines/reference/memberAccessMustUseModuleInstances.types create mode 100644 tests/baselines/reference/memberAccessOnConstructorType.types create mode 100644 tests/baselines/reference/memberFunctionsWithPublicOverloads.types create mode 100644 tests/baselines/reference/memberVariableDeclarations1.types create mode 100644 tests/baselines/reference/mergeThreeInterfaces.types create mode 100644 tests/baselines/reference/mergeThreeInterfaces2.types create mode 100644 tests/baselines/reference/mergeTwoInterfaces.types create mode 100644 tests/baselines/reference/mergeTwoInterfaces2.types create mode 100644 tests/baselines/reference/mergedDeclarations1.types create mode 100644 tests/baselines/reference/mergedDeclarations4.types create mode 100644 tests/baselines/reference/mergedEnumDeclarationCodeGen.types create mode 100644 tests/baselines/reference/mergedInterfaceFromMultipleFiles1.types create mode 100644 tests/baselines/reference/mergedInterfacesWithIndexers.types create mode 100644 tests/baselines/reference/mergedInterfacesWithMultipleBases.types create mode 100644 tests/baselines/reference/mergedInterfacesWithMultipleBases2.types create mode 100644 tests/baselines/reference/mergedInterfacesWithMultipleBases3.types create mode 100644 tests/baselines/reference/mergedModuleDeclarationCodeGen2.types create mode 100644 tests/baselines/reference/mergedModuleDeclarationCodeGen3.types create mode 100644 tests/baselines/reference/mergedModuleDeclarationCodeGen4.types create mode 100644 tests/baselines/reference/mergedModuleDeclarationCodeGen5.types create mode 100644 tests/baselines/reference/mergedModuleDeclarationWithSharedExportedVar.types create mode 100644 tests/baselines/reference/methodContainingLocalFunction.types create mode 100644 tests/baselines/reference/methodSignatureDeclarationEmit1.types create mode 100644 tests/baselines/reference/methodSignaturesWithOverloads2.types create mode 100644 tests/baselines/reference/mismatchedGenericArguments1.types create mode 100644 tests/baselines/reference/missingImportAfterModuleImport.types create mode 100644 tests/baselines/reference/missingSelf.types create mode 100644 tests/baselines/reference/missingTypeArguments3.types create mode 100644 tests/baselines/reference/mixedExports.types create mode 100644 tests/baselines/reference/mixingFunctionAndAmbientModule1.types create mode 100644 tests/baselines/reference/modFunctionCrash.types create mode 100644 tests/baselines/reference/modKeyword.types create mode 100644 tests/baselines/reference/moduleAliasAsFunctionArgument.types create mode 100644 tests/baselines/reference/moduleAliasInterface.types create mode 100644 tests/baselines/reference/moduleAndInterfaceSharingName.types create mode 100644 tests/baselines/reference/moduleAndInterfaceSharingName3.types create mode 100644 tests/baselines/reference/moduleAndInterfaceSharingName4.types create mode 100644 tests/baselines/reference/moduleCodeGenTest3.types create mode 100644 tests/baselines/reference/moduleCodeGenTest5.types create mode 100644 tests/baselines/reference/moduleCodegenTest4.types create mode 100644 tests/baselines/reference/moduleIdentifiers.types create mode 100644 tests/baselines/reference/moduleImportedForTypeArgumentPosition.types create mode 100644 tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.types create mode 100644 tests/baselines/reference/moduleMemberWithoutTypeAnnotation2.types create mode 100644 tests/baselines/reference/moduleMerge.types create mode 100644 tests/baselines/reference/moduleNoEmit.types create mode 100644 tests/baselines/reference/moduleOuterQualification.types create mode 100644 tests/baselines/reference/moduleRedifinitionErrors.types create mode 100644 tests/baselines/reference/moduleReopenedTypeOtherBlock.types create mode 100644 tests/baselines/reference/moduleReopenedTypeSameBlock.types create mode 100644 tests/baselines/reference/moduleScopingBug.types create mode 100644 tests/baselines/reference/moduleUnassignedVariable.types create mode 100644 tests/baselines/reference/moduleVariableArrayIndexer.types create mode 100644 tests/baselines/reference/moduleVariables.types create mode 100644 tests/baselines/reference/moduleVisibilityTest1.types create mode 100644 tests/baselines/reference/moduleWithStatementsOfEveryKind.types create mode 100644 tests/baselines/reference/moduleWithTryStatement1.types create mode 100644 tests/baselines/reference/multiCallOverloads.types create mode 100644 tests/baselines/reference/multiExtendsSplitInterfaces2.types create mode 100644 tests/baselines/reference/multiModuleClodule1.types create mode 100644 tests/baselines/reference/multiModuleFundule1.types create mode 100644 tests/baselines/reference/mutrec.types create mode 100644 tests/baselines/reference/mutuallyRecursiveGenericBaseTypes1.types create mode 100644 tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.types create mode 100644 tests/baselines/reference/nameCollision.types create mode 100644 tests/baselines/reference/nameCollisionsInPropertyAssignments.types create mode 100644 tests/baselines/reference/nameDelimitedBySlashes.types create mode 100644 tests/baselines/reference/nameWithRelativePaths.types create mode 100644 tests/baselines/reference/namedFunctionExpressionAssignedToClassProperty.types create mode 100644 tests/baselines/reference/namedFunctionExpressionCall.types create mode 100644 tests/baselines/reference/namedFunctionExpressionInModule.types create mode 100644 tests/baselines/reference/namespaces1.types create mode 100644 tests/baselines/reference/namespaces2.types create mode 100644 tests/baselines/reference/negateOperatorWithAnyOtherType.types create mode 100644 tests/baselines/reference/negateOperatorWithBooleanType.types create mode 100644 tests/baselines/reference/negateOperatorWithEnumType.types create mode 100644 tests/baselines/reference/negateOperatorWithNumberType.types create mode 100644 tests/baselines/reference/negateOperatorWithStringType.types create mode 100644 tests/baselines/reference/negativeZero.types create mode 100644 tests/baselines/reference/nestedGenerics.types create mode 100644 tests/baselines/reference/nestedIfStatement.types create mode 100644 tests/baselines/reference/nestedIndexer.types create mode 100644 tests/baselines/reference/nestedInfinitelyExpandedRecursiveTypes.types create mode 100644 tests/baselines/reference/nestedModulePrivateAccess.types create mode 100644 tests/baselines/reference/nestedModules.types create mode 100644 tests/baselines/reference/nestedRecursiveLambda.types create mode 100644 tests/baselines/reference/nestedSelf.types create mode 100644 tests/baselines/reference/newArrays.types create mode 100644 tests/baselines/reference/newExpressionWithTypeParameterConstrainedToOuterTypeParameter.types create mode 100644 tests/baselines/reference/newOperatorConformance.types create mode 100644 tests/baselines/reference/noCatchBlock.types create mode 100644 tests/baselines/reference/noCollisionThisExpressionAndClassInGlobal.types create mode 100644 tests/baselines/reference/noCollisionThisExpressionAndLocalVarInConstructor.types create mode 100644 tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.types create mode 100644 tests/baselines/reference/noCollisionThisExpressionAndLocalVarInLambda.types create mode 100644 tests/baselines/reference/noCollisionThisExpressionAndLocalVarInMethod.types create mode 100644 tests/baselines/reference/noCollisionThisExpressionAndLocalVarInProperty.types create mode 100644 tests/baselines/reference/noCollisionThisExpressionAndVarInGlobal.types create mode 100644 tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.types create mode 100644 tests/baselines/reference/noConstraintInReturnType1.types create mode 100644 tests/baselines/reference/noImplicitAnyAndPrivateMembersWithoutTypeAnnotations.types create mode 100644 tests/baselines/reference/noImplicitAnyInContextuallyTypesFunctionParamter.types create mode 100644 tests/baselines/reference/noSelfOnVars.types create mode 100644 tests/baselines/reference/nominalSubtypeCheckOfTypeParameter.types create mode 100644 tests/baselines/reference/nominalSubtypeCheckOfTypeParameter2.types create mode 100644 tests/baselines/reference/nonConflictingRecursiveBaseTypeMembers.types create mode 100644 tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.types create mode 100644 tests/baselines/reference/nonInstantiatedModule.types create mode 100644 tests/baselines/reference/null.types create mode 100644 tests/baselines/reference/nullAssignableToEveryType.types create mode 100644 tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.types create mode 100644 tests/baselines/reference/numberAsInLHS.types create mode 100644 tests/baselines/reference/numberAssignableToEnum.types create mode 100644 tests/baselines/reference/numberOnLeftSideOfInExpression.types create mode 100644 tests/baselines/reference/numberPropertyAccess.types create mode 100644 tests/baselines/reference/numericIndexerConstraint3.types create mode 100644 tests/baselines/reference/numericIndexerConstraint4.types create mode 100644 tests/baselines/reference/numericIndexingResults.types create mode 100644 tests/baselines/reference/numericMethodName1.types create mode 100644 tests/baselines/reference/objectIndexer.types create mode 100644 tests/baselines/reference/objectLitGetterSetter.types create mode 100644 tests/baselines/reference/objectLiteral1.types create mode 100644 tests/baselines/reference/objectLiteral2.types create mode 100644 tests/baselines/reference/objectLiteralArraySpecialization.types create mode 100644 tests/baselines/reference/objectLiteralDeclarationGeneration1.types create mode 100644 tests/baselines/reference/objectLiteralIndexers.types create mode 100644 tests/baselines/reference/objectLiteralWidened.types create mode 100644 tests/baselines/reference/objectMembersOnTypes.types create mode 100644 tests/baselines/reference/objectTypeHidingMembersOfObject.types create mode 100644 tests/baselines/reference/objectTypeLiteralSyntax.types create mode 100644 tests/baselines/reference/objectTypePropertyAccess.types create mode 100644 tests/baselines/reference/objectTypeWithCallSignatureAppearsToBeFunctionType.types create mode 100644 tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfExtendedFunction.types create mode 100644 tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunction.types create mode 100644 tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.types create mode 100644 tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunction.types create mode 100644 tests/baselines/reference/objectTypeWithNumericProperty.types create mode 100644 tests/baselines/reference/objectTypeWithStringNamedNumericProperty.types create mode 100644 tests/baselines/reference/objectTypeWithStringNamedPropertyOfIllegalCharacters.types create mode 100644 tests/baselines/reference/objectTypesIdentity.types create mode 100644 tests/baselines/reference/objectTypesIdentity2.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithCallSignatures.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithCallSignatures2.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts2.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithConstructSignatures.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithOptionality.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithPrivates.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithPrivates2.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithPublics.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithStringIndexers.types create mode 100644 tests/baselines/reference/objectTypesIdentityWithStringIndexers2.types create mode 100644 tests/baselines/reference/optionalAccessorsInInterface1.types create mode 100644 tests/baselines/reference/optionalConstructorArgInSuper.types create mode 100644 tests/baselines/reference/optionalParamInOverride.types create mode 100644 tests/baselines/reference/optionalParamReferencingOtherParams1.types create mode 100644 tests/baselines/reference/out-flag.types create mode 100644 tests/baselines/reference/overload2.types create mode 100644 tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.types create mode 100644 tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.types create mode 100644 tests/baselines/reference/overloadCallTest.types create mode 100644 tests/baselines/reference/overloadCrash.types create mode 100644 tests/baselines/reference/overloadEquivalenceWithStatics.types create mode 100644 tests/baselines/reference/overloadGenericFunctionWithRestArgs.types create mode 100644 tests/baselines/reference/overloadOnConstConstraintChecks1.types create mode 100644 tests/baselines/reference/overloadOnConstConstraintChecks2.types create mode 100644 tests/baselines/reference/overloadOnConstConstraintChecks3.types create mode 100644 tests/baselines/reference/overloadOnConstInheritance1.types create mode 100644 tests/baselines/reference/overloadOnGenericArity.types create mode 100644 tests/baselines/reference/overloadOnGenericClassAndNonGenericClass.types create mode 100644 tests/baselines/reference/overloadResolutionOverNonCTLambdas.types create mode 100644 tests/baselines/reference/overloadResolutionOverNonCTObjectLit.types create mode 100644 tests/baselines/reference/overloadResolutionWithAny.types create mode 100644 tests/baselines/reference/overloadRet.types create mode 100644 tests/baselines/reference/overloadReturnTypes.types create mode 100644 tests/baselines/reference/overloadWithCallbacksWithDifferingOptionalityOnArgs.types create mode 100644 tests/baselines/reference/overloadedStaticMethodSpecialization.types create mode 100644 tests/baselines/reference/overloadsAndTypeArgumentArity.types create mode 100644 tests/baselines/reference/parameterPropertyInitializerInInitializers.types create mode 100644 tests/baselines/reference/parameterPropertyReferencingOtherParameter.types create mode 100644 tests/baselines/reference/parameterReferencesOtherParameter1.types create mode 100644 tests/baselines/reference/parameterReferencesOtherParameter2.types create mode 100644 tests/baselines/reference/parametersWithNoAnnotationAreAny.types create mode 100644 tests/baselines/reference/parseShortform.types create mode 100644 tests/baselines/reference/parser509677.types create mode 100644 tests/baselines/reference/parser537152.types create mode 100644 tests/baselines/reference/parser579071.types create mode 100644 tests/baselines/reference/parser596700.types create mode 100644 tests/baselines/reference/parser630933.types create mode 100644 tests/baselines/reference/parser642331.types create mode 100644 tests/baselines/reference/parser643728.types create mode 100644 tests/baselines/reference/parser645086_3.types create mode 100644 tests/baselines/reference/parser645086_4.types create mode 100644 tests/baselines/reference/parser645484.types create mode 100644 tests/baselines/reference/parser768531.types create mode 100644 tests/baselines/reference/parserAccessibilityAfterStatic11.types create mode 100644 tests/baselines/reference/parserAccessibilityAfterStatic14.types create mode 100644 tests/baselines/reference/parserAccessibilityAfterStatic2.types create mode 100644 tests/baselines/reference/parserAccessibilityAfterStatic3.types create mode 100644 tests/baselines/reference/parserAccessibilityAfterStatic4.types create mode 100644 tests/baselines/reference/parserAccessibilityAfterStatic5.types create mode 100644 tests/baselines/reference/parserAccessors2.types create mode 100644 tests/baselines/reference/parserAccessors4.types create mode 100644 tests/baselines/reference/parserArrayLiteralExpression1.types create mode 100644 tests/baselines/reference/parserArrayLiteralExpression10.types create mode 100644 tests/baselines/reference/parserArrayLiteralExpression11.types create mode 100644 tests/baselines/reference/parserArrayLiteralExpression12.types create mode 100644 tests/baselines/reference/parserArrayLiteralExpression13.types create mode 100644 tests/baselines/reference/parserArrayLiteralExpression14.types create mode 100644 tests/baselines/reference/parserArrayLiteralExpression15.types create mode 100644 tests/baselines/reference/parserArrayLiteralExpression2.types create mode 100644 tests/baselines/reference/parserArrayLiteralExpression3.types create mode 100644 tests/baselines/reference/parserArrayLiteralExpression4.types create mode 100644 tests/baselines/reference/parserArrayLiteralExpression5.types create mode 100644 tests/baselines/reference/parserArrayLiteralExpression6.types create mode 100644 tests/baselines/reference/parserArrayLiteralExpression7.types create mode 100644 tests/baselines/reference/parserArrayLiteralExpression8.types create mode 100644 tests/baselines/reference/parserArrayLiteralExpression9.types create mode 100644 tests/baselines/reference/parserClassDeclaration16.types create mode 100644 tests/baselines/reference/parserClassDeclaration17.types create mode 100644 tests/baselines/reference/parserClassDeclaration19.types create mode 100644 tests/baselines/reference/parserClassDeclaration20.types create mode 100644 tests/baselines/reference/parserClassDeclaration23.types create mode 100644 tests/baselines/reference/parserClassDeclaration26.types create mode 100644 tests/baselines/reference/parserClassDeclaration7.d.types create mode 100644 tests/baselines/reference/parserClassDeclarationIndexSignature1.types create mode 100644 tests/baselines/reference/parserConstructorDeclaration1.types create mode 100644 tests/baselines/reference/parserDebuggerStatement1.types create mode 100644 tests/baselines/reference/parserDebuggerStatement2.types create mode 100644 tests/baselines/reference/parserDoStatement2.types create mode 100644 tests/baselines/reference/parserEmptyFile1.types create mode 100644 tests/baselines/reference/parserEmptyStatement1.types create mode 100644 tests/baselines/reference/parserEnum6.types create mode 100644 tests/baselines/reference/parserEnum7.types create mode 100644 tests/baselines/reference/parserEnumDeclaration1.types create mode 100644 tests/baselines/reference/parserEnumDeclaration2.d.types create mode 100644 tests/baselines/reference/parserEnumDeclaration3.types create mode 100644 tests/baselines/reference/parserEnumDeclaration5.types create mode 100644 tests/baselines/reference/parserExportAsFunctionIdentifier.types create mode 100644 tests/baselines/reference/parserFunctionDeclaration1.d.types create mode 100644 tests/baselines/reference/parserFunctionDeclaration5.types create mode 100644 tests/baselines/reference/parserFunctionDeclaration8.types create mode 100644 tests/baselines/reference/parserFunctionPropertyAssignment1.types create mode 100644 tests/baselines/reference/parserFunctionPropertyAssignment2.types create mode 100644 tests/baselines/reference/parserFunctionPropertyAssignment3.types create mode 100644 tests/baselines/reference/parserFunctionPropertyAssignment4.types create mode 100644 tests/baselines/reference/parserGenericClass1.types create mode 100644 tests/baselines/reference/parserGenericClass2.types create mode 100644 tests/baselines/reference/parserGenericConstraint1.types create mode 100644 tests/baselines/reference/parserGreaterThanTokenAmbiguity1.types create mode 100644 tests/baselines/reference/parserGreaterThanTokenAmbiguity10.types create mode 100644 tests/baselines/reference/parserGreaterThanTokenAmbiguity5.types create mode 100644 tests/baselines/reference/parserGreaterThanTokenAmbiguity6.types create mode 100644 tests/baselines/reference/parserIndexMemberDeclaration1.types create mode 100644 tests/baselines/reference/parserIndexMemberDeclaration2.types create mode 100644 tests/baselines/reference/parserIndexMemberDeclaration3.types create mode 100644 tests/baselines/reference/parserIndexMemberDeclaration4.types create mode 100644 tests/baselines/reference/parserInterfaceKeywordInEnum.types create mode 100644 tests/baselines/reference/parserInterfaceKeywordInEnum1.types create mode 100644 tests/baselines/reference/parserKeywordsAsIdentifierName1.types create mode 100644 tests/baselines/reference/parserMemberAccessorDeclaration4.types create mode 100644 tests/baselines/reference/parserMemberAccessorDeclaration5.types create mode 100644 tests/baselines/reference/parserMemberAccessorDeclaration6.types create mode 100644 tests/baselines/reference/parserMethodSignature1.types create mode 100644 tests/baselines/reference/parserMethodSignature10.types create mode 100644 tests/baselines/reference/parserMethodSignature11.types create mode 100644 tests/baselines/reference/parserMethodSignature12.types create mode 100644 tests/baselines/reference/parserMethodSignature2.types create mode 100644 tests/baselines/reference/parserMethodSignature3.types create mode 100644 tests/baselines/reference/parserMethodSignature4.types create mode 100644 tests/baselines/reference/parserMethodSignature5.types create mode 100644 tests/baselines/reference/parserMethodSignature6.types create mode 100644 tests/baselines/reference/parserMethodSignature7.types create mode 100644 tests/baselines/reference/parserMethodSignature8.types create mode 100644 tests/baselines/reference/parserMethodSignature9.types create mode 100644 tests/baselines/reference/parserModifierOnPropertySignature2.types create mode 100644 tests/baselines/reference/parserModuleDeclaration11.types create mode 100644 tests/baselines/reference/parserModuleDeclaration12.types create mode 100644 tests/baselines/reference/parserModuleDeclaration2.types create mode 100644 tests/baselines/reference/parserModuleDeclaration3.d.types create mode 100644 tests/baselines/reference/parserModuleDeclaration4.types create mode 100644 tests/baselines/reference/parserModuleDeclaration6.types create mode 100644 tests/baselines/reference/parserModuleDeclaration7.types create mode 100644 tests/baselines/reference/parserModuleDeclaration8.types create mode 100644 tests/baselines/reference/parserModuleDeclaration9.types create mode 100644 tests/baselines/reference/parserObjectLiterals1.types create mode 100644 tests/baselines/reference/parserObjectType1.types create mode 100644 tests/baselines/reference/parserObjectType2.types create mode 100644 tests/baselines/reference/parserObjectType3.types create mode 100644 tests/baselines/reference/parserObjectType4.types create mode 100644 tests/baselines/reference/parserPropertySignature1.types create mode 100644 tests/baselines/reference/parserPropertySignature10.types create mode 100644 tests/baselines/reference/parserPropertySignature11.types create mode 100644 tests/baselines/reference/parserPropertySignature12.types create mode 100644 tests/baselines/reference/parserPropertySignature2.types create mode 100644 tests/baselines/reference/parserPropertySignature3.types create mode 100644 tests/baselines/reference/parserPropertySignature4.types create mode 100644 tests/baselines/reference/parserPropertySignature5.types create mode 100644 tests/baselines/reference/parserPropertySignature6.types create mode 100644 tests/baselines/reference/parserPropertySignature7.types create mode 100644 tests/baselines/reference/parserPropertySignature8.types create mode 100644 tests/baselines/reference/parserPropertySignature9.types create mode 100644 tests/baselines/reference/parserReturnStatement3.types create mode 100644 tests/baselines/reference/parserS7.6.1.1_A1.10.types create mode 100644 tests/baselines/reference/parserSbp_7.9_A9_T3.types create mode 100644 tests/baselines/reference/parserStrictMode16.types create mode 100644 tests/baselines/reference/parserSyntaxWalker.generated.types create mode 100644 tests/baselines/reference/parserUnaryExpression6.types create mode 100644 tests/baselines/reference/parserUnicode2.types create mode 100644 tests/baselines/reference/parserUnicode3.types create mode 100644 tests/baselines/reference/parserUnicodeWhitespaceCharacter1.types create mode 100644 tests/baselines/reference/parserVariableDeclaration11.types create mode 100644 tests/baselines/reference/parserVariableDeclaration4.d.types create mode 100644 tests/baselines/reference/parserVariableDeclaration7.types create mode 100644 tests/baselines/reference/parserVariableDeclaration9.types create mode 100644 tests/baselines/reference/parserVariableStatement1.types create mode 100644 tests/baselines/reference/parserVariableStatement2.types create mode 100644 tests/baselines/reference/parserVariableStatement3.types create mode 100644 tests/baselines/reference/parserVariableStatement4.types create mode 100644 tests/baselines/reference/parserVoidExpression1.types create mode 100644 tests/baselines/reference/parserX_ArrowFunction4.types create mode 100644 tests/baselines/reference/parser_breakInIterationOrSwitchStatement1.types create mode 100644 tests/baselines/reference/parser_breakInIterationOrSwitchStatement2.types create mode 100644 tests/baselines/reference/parser_breakInIterationOrSwitchStatement3.types create mode 100644 tests/baselines/reference/parser_breakTarget1.types create mode 100644 tests/baselines/reference/parser_breakTarget2.types create mode 100644 tests/baselines/reference/parser_breakTarget3.types create mode 100644 tests/baselines/reference/parser_breakTarget4.types create mode 100644 tests/baselines/reference/parser_continueInIterationStatement1.types create mode 100644 tests/baselines/reference/parser_continueInIterationStatement2.types create mode 100644 tests/baselines/reference/parser_continueInIterationStatement3.types create mode 100644 tests/baselines/reference/parser_continueLabel.types create mode 100644 tests/baselines/reference/parser_continueTarget2.types create mode 100644 tests/baselines/reference/parser_continueTarget3.types create mode 100644 tests/baselines/reference/parser_continueTarget4.types create mode 100644 tests/baselines/reference/parser_duplicateLabel3.types create mode 100644 tests/baselines/reference/parser_duplicateLabel4.types create mode 100644 tests/baselines/reference/parservoidInQualifiedName0.types create mode 100644 tests/baselines/reference/partiallyAmbientClodule.types create mode 100644 tests/baselines/reference/partiallyAmbientFundule.types create mode 100644 tests/baselines/reference/plusOperatorWithBooleanType.types create mode 100644 tests/baselines/reference/plusOperatorWithEnumType.types create mode 100644 tests/baselines/reference/plusOperatorWithNumberType.types create mode 100644 tests/baselines/reference/plusOperatorWithStringType.types create mode 100644 tests/baselines/reference/prefixIncrementAsOperandOfPlusExpression.types create mode 100644 tests/baselines/reference/prespecializedGenericMembers1.types create mode 100644 tests/baselines/reference/primitiveTypeAsmoduleName.types create mode 100644 tests/baselines/reference/primtiveTypesAreIdentical.types create mode 100644 tests/baselines/reference/privacyCheckAnonymousFunctionParameter.types create mode 100644 tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.types create mode 100644 tests/baselines/reference/privacyCheckCallbackOfInterfaceMethodWithTypeParameter.types create mode 100644 tests/baselines/reference/privacyCheckExportAssignmentOnExportedGenericInterface1.types create mode 100644 tests/baselines/reference/privacyCheckExportAssignmentOnExportedGenericInterface2.types create mode 100644 tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.types create mode 100644 tests/baselines/reference/privacyCheckOnTypeParameterReferenceInConstructorParameter.types create mode 100644 tests/baselines/reference/privacyCheckTypeOfInvisibleModuleError.types create mode 100644 tests/baselines/reference/privacyCheckTypeOfInvisibleModuleNoError.types create mode 100644 tests/baselines/reference/privacyClass.types create mode 100644 tests/baselines/reference/privacyFunc.types create mode 100644 tests/baselines/reference/privacyGloClass.types create mode 100644 tests/baselines/reference/privacyGloFunc.types create mode 100644 tests/baselines/reference/privacyGloInterface.types create mode 100644 tests/baselines/reference/privacyGloVar.types create mode 100644 tests/baselines/reference/privacyInterface.types create mode 100644 tests/baselines/reference/privacyLocalInternalReferenceImportWithExport.types create mode 100644 tests/baselines/reference/privacyLocalInternalReferenceImportWithoutExport.types create mode 100644 tests/baselines/reference/privacyTopLevelInternalReferenceImportWithExport.types create mode 100644 tests/baselines/reference/privacyTopLevelInternalReferenceImportWithoutExport.types create mode 100644 tests/baselines/reference/privacyTypeParameterOfFunction.types create mode 100644 tests/baselines/reference/privacyTypeParametersOfClass.types create mode 100644 tests/baselines/reference/privacyTypeParametersOfInterface.types create mode 100644 tests/baselines/reference/privacyVar.types create mode 100644 tests/baselines/reference/privateInstanceVisibility.types create mode 100644 tests/baselines/reference/privatePropertyUsingObjectType.types create mode 100644 tests/baselines/reference/privateVisibles.types create mode 100644 tests/baselines/reference/promiseChaining.types create mode 100644 tests/baselines/reference/promiseIdentity.types create mode 100644 tests/baselines/reference/promiseIdentityWithAny.types create mode 100644 tests/baselines/reference/promiseIdentityWithConstraints.types create mode 100644 tests/baselines/reference/promiseTest.types create mode 100644 tests/baselines/reference/promiseTypeInference.types create mode 100644 tests/baselines/reference/promises.types create mode 100644 tests/baselines/reference/promisesWithConstraints.types create mode 100644 tests/baselines/reference/propagationOfPromiseInitialization.types create mode 100644 tests/baselines/reference/properties.types create mode 100644 tests/baselines/reference/propertyAccess6.types create mode 100644 tests/baselines/reference/propertyAccess7.types create mode 100644 tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints.types create mode 100644 tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.types create mode 100644 tests/baselines/reference/propertyAccessOnTypeParameterWithoutConstraints.types create mode 100644 tests/baselines/reference/propertyNameWithoutTypeAnnotation.types create mode 100644 tests/baselines/reference/propertyNamesOfReservedWords.types create mode 100644 tests/baselines/reference/propertyNamesWithStringLiteral.types create mode 100644 tests/baselines/reference/protoAsIndexInIndexExpression.types create mode 100644 tests/baselines/reference/protoInIndexer.types create mode 100644 tests/baselines/reference/prototypeInstantiatedWithBaseConstraint.types create mode 100644 tests/baselines/reference/prototypeOnConstructorFunctions.types create mode 100644 tests/baselines/reference/qualifiedName_ImportDeclarations-entity-names-referencing-a-var.types create mode 100644 tests/baselines/reference/quotedFunctionName1.types create mode 100644 tests/baselines/reference/quotedFunctionName2.types create mode 100644 tests/baselines/reference/quotedPropertyName1.types create mode 100644 tests/baselines/reference/quotedPropertyName2.types create mode 100644 tests/baselines/reference/quotedPropertyName3.types create mode 100644 tests/baselines/reference/randomSemicolons1.types create mode 100644 tests/baselines/reference/reboundBaseClassSymbol.types create mode 100644 tests/baselines/reference/rectype.types create mode 100644 tests/baselines/reference/recur1.types create mode 100644 tests/baselines/reference/recursiveBaseConstructorCreation1.types create mode 100644 tests/baselines/reference/recursiveBaseConstructorCreation2.types create mode 100644 tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.types create mode 100644 tests/baselines/reference/recursiveCloduleReference.types create mode 100644 tests/baselines/reference/recursiveComplicatedClasses.types create mode 100644 tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.types create mode 100644 tests/baselines/reference/recursiveFunctionTypes1.types create mode 100644 tests/baselines/reference/recursiveGenericMethodCall.types create mode 100644 tests/baselines/reference/recursiveGenericSignatureInstantiation.types create mode 100644 tests/baselines/reference/recursiveGenericSignatureInstantiation2.types create mode 100644 tests/baselines/reference/recursiveIdenticalOverloadResolution.types create mode 100644 tests/baselines/reference/recursiveInference1.types create mode 100644 tests/baselines/reference/recursiveInheritance2.types create mode 100644 tests/baselines/reference/recursiveInitializer.types create mode 100644 tests/baselines/reference/recursiveMods.types create mode 100644 tests/baselines/reference/recursiveObjectLiteral.types create mode 100644 tests/baselines/reference/recursiveProperties.types create mode 100644 tests/baselines/reference/recursiveReturns.types create mode 100644 tests/baselines/reference/recursiveSpecializationOfExtendedTypeWithError.types create mode 100644 tests/baselines/reference/recursiveTypeIdentity.types create mode 100644 tests/baselines/reference/recursiveTypeParameterReferenceError1.types create mode 100644 tests/baselines/reference/recursiveTypeParameterReferenceError2.types create mode 100644 tests/baselines/reference/recursivelySpecializedConstructorDeclaration.types create mode 100644 tests/baselines/reference/redeclarationOfVarWithGenericType.types create mode 100644 tests/baselines/reference/regExpWithSlashInCharClass.types create mode 100644 tests/baselines/reference/reorderProperties.types create mode 100644 tests/baselines/reference/requireEmitSemicolon.types create mode 100644 tests/baselines/reference/reservedNameOnModuleImport.types create mode 100644 tests/baselines/reference/reservedWords.types create mode 100644 tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.types create mode 100644 tests/baselines/reference/restParameterAssignmentCompatibility.types create mode 100644 tests/baselines/reference/restParameterNoTypeAnnotation.types create mode 100644 tests/baselines/reference/restParameters.types create mode 100644 tests/baselines/reference/returnStatement1.types create mode 100644 tests/baselines/reference/returnStatements.types create mode 100644 tests/baselines/reference/returnTypeParameterWithModules.types create mode 100644 tests/baselines/reference/reuseInnerModuleMember.types create mode 100644 tests/baselines/reference/reverseInferenceInContextualInstantiation.types create mode 100644 tests/baselines/reference/reversedRecusiveTypeInstantiation.types create mode 100644 tests/baselines/reference/scannerES3NumericLiteral1.types create mode 100644 tests/baselines/reference/scannerES3NumericLiteral2.types create mode 100644 tests/baselines/reference/scannerES3NumericLiteral5.types create mode 100644 tests/baselines/reference/scannerES3NumericLiteral7.types create mode 100644 tests/baselines/reference/scannerNumericLiteral1.types create mode 100644 tests/baselines/reference/scannerNumericLiteral5.types create mode 100644 tests/baselines/reference/scannerNumericLiteral7.types create mode 100644 tests/baselines/reference/scannerStringLiteralWithContainingNullCharacter1.types create mode 100644 tests/baselines/reference/scannerUnicodeEscapeInKeyword1.types create mode 100644 tests/baselines/reference/scopeResolutionIdentifiers.types create mode 100644 tests/baselines/reference/selfInCallback.types create mode 100644 tests/baselines/reference/selfInLambdas.types create mode 100644 tests/baselines/reference/separate1-2.types create mode 100644 tests/baselines/reference/sigantureIsSubTypeIfTheyAreIdentical.types create mode 100644 tests/baselines/reference/simpleArrowFunctionParameterReferencedInObjectLiteral1.types create mode 100644 tests/baselines/reference/sourceMap-Comment1.types create mode 100644 tests/baselines/reference/sourceMap-EmptyFile1.types create mode 100644 tests/baselines/reference/sourceMap-FileWithComments.types create mode 100644 tests/baselines/reference/sourceMap-InterfacePrecedingVariableDeclaration1.types create mode 100644 tests/baselines/reference/sourceMap-NewLine1.types create mode 100644 tests/baselines/reference/sourceMap-SemiColon1.types create mode 100644 tests/baselines/reference/sourceMap-SingleSpace1.types create mode 100644 tests/baselines/reference/sourceMap-SkippedNode.types create mode 100644 tests/baselines/reference/sourceMap-StringLiteralWithNewLine.types create mode 100644 tests/baselines/reference/sourceMapValidationClass.types create mode 100644 tests/baselines/reference/sourceMapValidationClassWithDefaultConstructor.types create mode 100644 tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndCapturedThisStatement.types create mode 100644 tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.types create mode 100644 tests/baselines/reference/sourceMapValidationClasses.types create mode 100644 tests/baselines/reference/sourceMapValidationDebugger.types create mode 100644 tests/baselines/reference/sourceMapValidationDo.types create mode 100644 tests/baselines/reference/sourceMapValidationExportAssignment.types create mode 100644 tests/baselines/reference/sourceMapValidationExportAssignmentCommonjs.types create mode 100644 tests/baselines/reference/sourceMapValidationFunctionExpressions.types create mode 100644 tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.types create mode 100644 tests/baselines/reference/sourceMapValidationFunctions.types create mode 100644 tests/baselines/reference/sourceMapValidationIfElse.types create mode 100644 tests/baselines/reference/sourceMapValidationImport.types create mode 100644 tests/baselines/reference/sourceMapValidationLabeled.types create mode 100644 tests/baselines/reference/sourceMapValidationModule.types create mode 100644 tests/baselines/reference/sourceMapValidationSwitch.types create mode 100644 tests/baselines/reference/sourceMapValidationTryCatchFinally.types create mode 100644 tests/baselines/reference/sourceMapValidationVariables.types create mode 100644 tests/baselines/reference/sourceMapValidationWhile.types create mode 100644 tests/baselines/reference/sourceMapValidationWithComments.types create mode 100644 tests/baselines/reference/sourcemapValidationDuplicateNames.types create mode 100644 tests/baselines/reference/specializationError.types create mode 100644 tests/baselines/reference/specializationOfExportedClass.types create mode 100644 tests/baselines/reference/specializationsShouldNotAffectEachOther.types create mode 100644 tests/baselines/reference/specializeVarArgs1.types create mode 100644 tests/baselines/reference/specializedInheritedConstructors1.types create mode 100644 tests/baselines/reference/specializedLambdaTypeArguments.types create mode 100644 tests/baselines/reference/specializedSignatureInInterface.types create mode 100644 tests/baselines/reference/specializedSignatureIsSubtypeOfNonSpecializedSignature.types create mode 100644 tests/baselines/reference/staticAndMemberFunctions.types create mode 100644 tests/baselines/reference/staticAndNonStaticPropertiesSameName.types create mode 100644 tests/baselines/reference/staticFactory1.types create mode 100644 tests/baselines/reference/staticGetter2.types create mode 100644 tests/baselines/reference/staticInheritance.types create mode 100644 tests/baselines/reference/staticInstanceResolution.types create mode 100644 tests/baselines/reference/staticInstanceResolution2.types create mode 100644 tests/baselines/reference/staticInstanceResolution3.types create mode 100644 tests/baselines/reference/staticInterfaceAssignmentCompat.types create mode 100644 tests/baselines/reference/staticMemberAccessOffDerivedType1.types create mode 100644 tests/baselines/reference/staticMemberInitialization.types create mode 100644 tests/baselines/reference/staticMemberWithStringAndNumberNames.types create mode 100644 tests/baselines/reference/staticMethodWithTypeParameterExtendsClauseDeclFile.types create mode 100644 tests/baselines/reference/staticPropertyAndFunctionWithSameName.types create mode 100644 tests/baselines/reference/staticPrototypePropertyOnClass.types create mode 100644 tests/baselines/reference/stradac.types create mode 100644 tests/baselines/reference/strictMode1.types create mode 100644 tests/baselines/reference/strictMode2.types create mode 100644 tests/baselines/reference/strictMode3.types create mode 100644 tests/baselines/reference/strictMode4.types create mode 100644 tests/baselines/reference/strictMode5.types create mode 100644 tests/baselines/reference/stringHasStringValuedNumericIndexer.types create mode 100644 tests/baselines/reference/stringIndexingResults.types create mode 100644 tests/baselines/reference/stringLiteralObjectLiteralDeclaration1.types create mode 100644 tests/baselines/reference/stringLiteralPropertyNameWithLineContinuation1.types create mode 100644 tests/baselines/reference/stringNamedPropertyAccess.types create mode 100644 tests/baselines/reference/stringPropCodeGen.types create mode 100644 tests/baselines/reference/stringPropertyAccess.types create mode 100644 tests/baselines/reference/structural1.types create mode 100644 tests/baselines/reference/structuralTypeInDeclareFileForModule.types create mode 100644 tests/baselines/reference/styleOptions.types create mode 100644 tests/baselines/reference/subtypesOfAny.types create mode 100644 tests/baselines/reference/subtypingTransitivity.types create mode 100644 tests/baselines/reference/subtypingWithCallSignatures.types create mode 100644 tests/baselines/reference/subtypingWithCallSignatures2.types create mode 100644 tests/baselines/reference/subtypingWithCallSignatures3.types create mode 100644 tests/baselines/reference/subtypingWithCallSignatures4.types create mode 100644 tests/baselines/reference/subtypingWithConstructSignatures.types create mode 100644 tests/baselines/reference/subtypingWithConstructSignatures2.types create mode 100644 tests/baselines/reference/subtypingWithConstructSignatures3.types create mode 100644 tests/baselines/reference/subtypingWithConstructSignatures4.types create mode 100644 tests/baselines/reference/subtypingWithConstructSignatures5.types create mode 100644 tests/baselines/reference/subtypingWithConstructSignatures6.types create mode 100644 tests/baselines/reference/subtypingWithObjectMembers4.types create mode 100644 tests/baselines/reference/subtypingWithObjectMembersOptionality.types create mode 100644 tests/baselines/reference/subtypingWithObjectMembersOptionality3.types create mode 100644 tests/baselines/reference/subtypingWithObjectMembersOptionality4.types create mode 100644 tests/baselines/reference/subtypingWithOptionalProperties.types create mode 100644 tests/baselines/reference/super2.types create mode 100644 tests/baselines/reference/superAccessInFatArrow1.types create mode 100644 tests/baselines/reference/superCallArgsMustMatch.types create mode 100644 tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.types create mode 100644 tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.types create mode 100644 tests/baselines/reference/superCalls.types create mode 100644 tests/baselines/reference/superInCatchBlock1.types create mode 100644 tests/baselines/reference/superWithGenericSpecialization.types create mode 100644 tests/baselines/reference/superWithGenerics.types create mode 100644 tests/baselines/reference/switchBreakStatements.types create mode 100644 tests/baselines/reference/switchCases.types create mode 100644 tests/baselines/reference/switchFallThroughs.types create mode 100644 tests/baselines/reference/switchStatements.types create mode 100644 tests/baselines/reference/targetTypeArgs.types create mode 100644 tests/baselines/reference/targetTypeCalls.types create mode 100644 tests/baselines/reference/targetTypeObjectLiteral.types create mode 100644 tests/baselines/reference/targetTypeObjectLiteralToAny.types create mode 100644 tests/baselines/reference/targetTypeTest2.types create mode 100644 tests/baselines/reference/targetTypingOnFunctions.types create mode 100644 tests/baselines/reference/ternaryExpressionSourceMap.types create mode 100644 tests/baselines/reference/testContainerList.types create mode 100644 tests/baselines/reference/thisBinding2.types create mode 100644 tests/baselines/reference/thisCapture1.types create mode 100644 tests/baselines/reference/thisExpressionInIndexExpression.types create mode 100644 tests/baselines/reference/thisExpressionOfGenericObject.types create mode 100644 tests/baselines/reference/thisInGenericStaticMembers.types create mode 100644 tests/baselines/reference/thisInInnerFunctions.types create mode 100644 tests/baselines/reference/thisInInstanceMemberInitializer.types create mode 100644 tests/baselines/reference/thisInLambda.types create mode 100644 tests/baselines/reference/thisInModuleFunction1.types create mode 100644 tests/baselines/reference/thisInObjectLiterals.types create mode 100644 tests/baselines/reference/thisInPropertyBoundDeclarations.types create mode 100644 tests/baselines/reference/thisInStaticMethod1.types create mode 100644 tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.types create mode 100644 tests/baselines/reference/throwInEnclosingStatements.types create mode 100644 tests/baselines/reference/throwStatements.types create mode 100644 tests/baselines/reference/toStringOnPrimitives.types create mode 100644 tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.types create mode 100644 tests/baselines/reference/topLevel.types create mode 100644 tests/baselines/reference/topLevelAmbientModule.types create mode 100644 tests/baselines/reference/topLevelExports.types create mode 100644 tests/baselines/reference/topLevelFileModule.types create mode 100644 tests/baselines/reference/topLevelLambda2.types create mode 100644 tests/baselines/reference/topLevelLambda3.types create mode 100644 tests/baselines/reference/topLevelLambda4.types create mode 100644 tests/baselines/reference/trailingCommasES3.types create mode 100644 tests/baselines/reference/trailingCommasES5.types create mode 100644 tests/baselines/reference/transitiveTypeArgumentInference1.types create mode 100644 tests/baselines/reference/tryCatchFinally.types create mode 100644 tests/baselines/reference/tryStatements.types create mode 100644 tests/baselines/reference/twoMergedInterfacesWithDifferingOverloads.types create mode 100644 tests/baselines/reference/twoMergedInterfacesWithDifferingOverloads2.types create mode 100644 tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.types create mode 100644 tests/baselines/reference/typeArgInference.types create mode 100644 tests/baselines/reference/typeArgInference2.types create mode 100644 tests/baselines/reference/typeArgInferenceWithNull.types create mode 100644 tests/baselines/reference/typeArgumentInference.types create mode 100644 tests/baselines/reference/typeArgumentInferenceOrdering.types create mode 100644 tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.types create mode 100644 tests/baselines/reference/typeArgumentsInFunctionExpressions.types create mode 100644 tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.types create mode 100644 tests/baselines/reference/typeConstraintsWithConstructSignatures.types create mode 100644 tests/baselines/reference/typeInferenceConflictingCandidates.types create mode 100644 tests/baselines/reference/typeInferenceFixEarly.types create mode 100644 tests/baselines/reference/typeInferenceReturnTypeCallback.types create mode 100644 tests/baselines/reference/typeInferenceWithTypeAnnotation.types create mode 100644 tests/baselines/reference/typeLiteralCallback.types create mode 100644 tests/baselines/reference/typeOfPrototype.types create mode 100644 tests/baselines/reference/typeOfSuperCall.types create mode 100644 tests/baselines/reference/typeOfThisInFunctionExpression.types create mode 100644 tests/baselines/reference/typeOfThisInMemberFunctions.types create mode 100644 tests/baselines/reference/typeOfThisInStaticMembers.types create mode 100644 tests/baselines/reference/typeParameterAndArgumentOfSameName1.types create mode 100644 tests/baselines/reference/typeParameterAsElementType.types create mode 100644 tests/baselines/reference/typeParameterAsTypeArgument.types create mode 100644 tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.types create mode 100644 tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.types create mode 100644 tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.types create mode 100644 tests/baselines/reference/typeParameterConstrainedToOuterTypeParameter.types create mode 100644 tests/baselines/reference/typeParameterConstrainedToOuterTypeParameter2.types create mode 100644 tests/baselines/reference/typeParameterUsedAsTypeParameterConstraint3.types create mode 100644 tests/baselines/reference/typeParametersAreIdenticalToThemselves.types create mode 100644 tests/baselines/reference/typeParametersAvailableInNestedScope.types create mode 100644 tests/baselines/reference/typeParametersAvailableInNestedScope2.types create mode 100644 tests/baselines/reference/typeQueryWithReservedWords.types create mode 100644 tests/baselines/reference/typeResolution.types create mode 100644 tests/baselines/reference/typeVal.types create mode 100644 tests/baselines/reference/typedGenericPrototypeMember.types create mode 100644 tests/baselines/reference/typeofClass2.types create mode 100644 tests/baselines/reference/typeofEnum.types create mode 100644 tests/baselines/reference/typeofInterface.types create mode 100644 tests/baselines/reference/typeofModuleWithoutExports.types create mode 100644 tests/baselines/reference/typeofOperatorWithBooleanType.types create mode 100644 tests/baselines/reference/typeofOperatorWithEnumType.types create mode 100644 tests/baselines/reference/typeofOperatorWithNumberType.types create mode 100644 tests/baselines/reference/typeofOperatorWithStringType.types create mode 100644 tests/baselines/reference/typeofUndefined.types create mode 100644 tests/baselines/reference/typesWithOptionalProperty.types create mode 100644 tests/baselines/reference/typesWithSpecializedCallSignatures.types create mode 100644 tests/baselines/reference/typesWithSpecializedConstructSignatures.types create mode 100644 tests/baselines/reference/unaryPlus.types create mode 100644 tests/baselines/reference/uncaughtCompilerError1.types create mode 100644 tests/baselines/reference/undefinedArgumentInference.types create mode 100644 tests/baselines/reference/undefinedAssignableToEveryType.types create mode 100644 tests/baselines/reference/undefinedInferentialTyping.types create mode 100644 tests/baselines/reference/undefinedIsSubtypeOfEverything.types create mode 100644 tests/baselines/reference/underscoreMapFirst.types create mode 100644 tests/baselines/reference/underscoreTest1.types create mode 100644 tests/baselines/reference/unexportedInstanceClassVariables.types create mode 100644 tests/baselines/reference/unicodeIdentifierNames.types create mode 100644 tests/baselines/reference/untypedArgumentInLambdaExpression.types create mode 100644 tests/baselines/reference/unusedImportDeclaration.types create mode 100644 tests/baselines/reference/usingModuleWithExportImportInValuePosition.types create mode 100644 tests/baselines/reference/validBooleanAssignments.types create mode 100644 tests/baselines/reference/validEnumAssignments.types create mode 100644 tests/baselines/reference/validMultipleVariableDeclarations.types create mode 100644 tests/baselines/reference/validNumberAssignments.types create mode 100644 tests/baselines/reference/validStringAssignments.types create mode 100644 tests/baselines/reference/validUndefinedAssignments.types create mode 100644 tests/baselines/reference/validUndefinedValues.types create mode 100644 tests/baselines/reference/validUseOfThisInSuper.types create mode 100644 tests/baselines/reference/validVoidAssignments.types create mode 100644 tests/baselines/reference/validVoidValues.types create mode 100644 tests/baselines/reference/varArgParamTypeCheck.types create mode 100644 tests/baselines/reference/varArgsOnConstructorTypes.types create mode 100644 tests/baselines/reference/varAsID.types create mode 100644 tests/baselines/reference/varInFunctionInVarInitializer.types create mode 100644 tests/baselines/reference/vardecl.types create mode 100644 tests/baselines/reference/variableDeclarator1.types create mode 100644 tests/baselines/reference/visSyntax.types create mode 100644 tests/baselines/reference/visibilityOfCrossModuleTypeUsage.types create mode 100644 tests/baselines/reference/voidAsOperator.types create mode 100644 tests/baselines/reference/voidConstructor.types create mode 100644 tests/baselines/reference/voidFunctionAssignmentCompat.types create mode 100644 tests/baselines/reference/voidOperator1.types create mode 100644 tests/baselines/reference/voidOperatorWithBooleanType.types create mode 100644 tests/baselines/reference/voidOperatorWithEnumType.types create mode 100644 tests/baselines/reference/voidOperatorWithNumberType.types create mode 100644 tests/baselines/reference/voidOperatorWithStringType.types create mode 100644 tests/baselines/reference/voidReturnLambdaValue.types create mode 100644 tests/baselines/reference/whileBreakStatements.types create mode 100644 tests/baselines/reference/whileContinueStatements.types create mode 100644 tests/baselines/reference/widenedTypes1.types create mode 100644 tests/baselines/reference/withImportDecl.types create mode 100644 tests/baselines/reference/wrappedAndRecursiveConstraints.types create mode 100644 tests/baselines/reference/wrappedAndRecursiveConstraints3.types diff --git a/tests/baselines/reference/2dArrays.types b/tests/baselines/reference/2dArrays.types new file mode 100644 index 00000000000..b113ccdce7b --- /dev/null +++ b/tests/baselines/reference/2dArrays.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/2dArrays.ts === +class Cell { +>Cell : Cell +} + +class Ship { +>Ship : Ship + + isSunk: boolean; +>isSunk : boolean +} + +class Board { +>Board : Board + + ships: Ship[]; +>ships : Ship[] +>Ship : Ship + + cells: Cell[]; +>cells : Cell[] +>Cell : Cell + + private allShipsSunk() { +>allShipsSunk : () => boolean + + return this.ships.every(function (val) { return val.isSunk; }); +>this.ships.every(function (val) { return val.isSunk; }) : boolean +>this.ships.every : (callbackfn: (value: Ship, index: number, array: Ship[]) => boolean, thisArg?: any) => boolean +>this.ships : Ship[] +>this : Board +>ships : Ship[] +>every : (callbackfn: (value: Ship, index: number, array: Ship[]) => boolean, thisArg?: any) => boolean +>function (val) { return val.isSunk; } : (val: Ship) => boolean +>val : Ship +>val.isSunk : boolean +>val : Ship +>isSunk : boolean + } +} diff --git a/tests/baselines/reference/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot.types b/tests/baselines/reference/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot.types new file mode 100644 index 00000000000..da82a2ff662 --- /dev/null +++ b/tests/baselines/reference/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/module.d.ts === +declare module Point { +>Point : typeof Point + + export var Origin: { x: number; y: number; } +>Origin : { x: number; y: number; } +>x : number +>y : number +} + +=== tests/cases/conformance/internalModules/DeclarationMerging/function.d.ts === +declare function Point(): { x: number; y: number; } +>Point : typeof Point +>x : number +>y : number + +=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts === +var cl: { x: number; y: number; } +>cl : { x: number; y: number; } +>x : number +>y : number + +var cl = Point(); +>cl : { x: number; y: number; } +>Point() : { x: number; y: number; } +>Point : typeof Point + +var cl = Point.Origin; +>cl : { x: number; y: number; } +>Point.Origin : { x: number; y: number; } +>Point : typeof Point +>Origin : { x: number; y: number; } + diff --git a/tests/baselines/reference/AmbientModuleAndAmbientWithSameNameAndCommonRoot.types b/tests/baselines/reference/AmbientModuleAndAmbientWithSameNameAndCommonRoot.types new file mode 100644 index 00000000000..ff49e1c530f --- /dev/null +++ b/tests/baselines/reference/AmbientModuleAndAmbientWithSameNameAndCommonRoot.types @@ -0,0 +1,59 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/module.d.ts === +declare module A { +>A : typeof A + + export module Point { +>Point : typeof Point + + export var Origin: { +>Origin : { x: number; y: number; } + + x: number; +>x : number + + y: number; +>y : number + } + } +} + +=== tests/cases/conformance/internalModules/DeclarationMerging/class.d.ts === +declare module A { +>A : typeof A + + export class Point { +>Point : Point + + constructor(x: number, y: number); +>x : number +>y : number + + x: number; +>x : number + + y: number; +>y : number + } +} + +=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts === +var p: { x: number; y: number; } +>p : { x: number; y: number; } +>x : number +>y : number + +var p = A.Point.Origin; +>p : { x: number; y: number; } +>A.Point.Origin : { x: number; y: number; } +>A.Point : typeof Point +>A : typeof A +>Point : typeof Point +>Origin : { x: number; y: number; } + +var p = new A.Point(0, 0); // unexpected error here, bug 840000 +>p : { x: number; y: number; } +>new A.Point(0, 0) : Point +>A.Point : typeof Point +>A : typeof A +>Point : typeof Point + diff --git a/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.types b/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.types new file mode 100644 index 00000000000..b928b699b95 --- /dev/null +++ b/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.types @@ -0,0 +1,53 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/module.d.ts === +declare module A { +>A : typeof A + + export module Point { +>Point : typeof Point + + export var Origin: { +>Origin : { x: number; y: number; } + + x: number; +>x : number + + y: number; +>y : number + } + } +} + +=== tests/cases/conformance/internalModules/DeclarationMerging/classPoint.ts === +module A { +>A : typeof A + + export class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + } +} + +=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts === +var p: { x: number; y: number; } +>p : { x: number; y: number; } +>x : number +>y : number + +var p = A.Point.Origin; +>p : { x: number; y: number; } +>A.Point.Origin : { x: number; y: number; } +>A.Point : typeof Point +>A : typeof A +>Point : typeof Point +>Origin : { x: number; y: number; } + +var p = new A.Point(0, 0); // unexpected error here, bug 840000 +>p : { x: number; y: number; } +>new A.Point(0, 0) : Point +>A.Point : typeof Point +>A : typeof A +>Point : typeof Point + diff --git a/tests/baselines/reference/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot.types b/tests/baselines/reference/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot.types new file mode 100644 index 00000000000..cf4aeb6bcc0 --- /dev/null +++ b/tests/baselines/reference/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/module.d.ts === +declare module Point { +>Point : typeof Point + + export var Origin: { x: number; y: number; } +>Origin : { x: number; y: number; } +>x : number +>y : number +} + +=== tests/cases/conformance/internalModules/DeclarationMerging/function.ts === +function Point() { +>Point : typeof Point + + return { x: 0, y: 0 }; +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number +} + +=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts === +var cl: { x: number; y: number; } +>cl : { x: number; y: number; } +>x : number +>y : number + +var cl = Point(); +>cl : { x: number; y: number; } +>Point() : { x: number; y: number; } +>Point : typeof Point + +var cl = Point.Origin; +>cl : { x: number; y: number; } +>Point.Origin : { x: number; y: number; } +>Point : typeof Point +>Origin : { x: number; y: number; } + diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.types b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.types new file mode 100644 index 00000000000..3ea1919ecae --- /dev/null +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.types @@ -0,0 +1,49 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts === +class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + + static Origin(): Point { return { x: 0, y: 0 }; } +>Origin : () => Point +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number +} + +module Point { +>Point : typeof Point + + function Origin() { return ""; }// not an error, since not exported +>Origin : () => string +} + + +module A { +>A : typeof A + + export class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + + static Origin(): Point { return { x: 0, y: 0 }; } +>Origin : () => Point +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number + } + + export module Point { +>Point : typeof Point + + function Origin() { return ""; }// not an error since not exported +>Origin : () => string + } +} diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.types b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.types new file mode 100644 index 00000000000..827089847e2 --- /dev/null +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.types @@ -0,0 +1,49 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts === +class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + + static Origin: Point = { x: 0, y: 0 }; +>Origin : Point +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number +} + +module Point { +>Point : typeof Point + + var Origin = ""; // not an error, since not exported +>Origin : string +} + + +module A { +>A : typeof A + + export class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + + static Origin: Point = { x: 0, y: 0 }; +>Origin : Point +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number + } + + export module Point { +>Point : typeof Point + + var Origin = ""; // not an error since not exported +>Origin : string + } +} diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStringIndexerAndExportedFunctionWithTypeIncompatibleWithIndexer.types b/tests/baselines/reference/ClassAndModuleThatMergeWithStringIndexerAndExportedFunctionWithTypeIncompatibleWithIndexer.types new file mode 100644 index 00000000000..4375eaa3ffb --- /dev/null +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStringIndexerAndExportedFunctionWithTypeIncompatibleWithIndexer.types @@ -0,0 +1,3 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStringIndexerAndExportedFunctionWithTypeIncompatibleWithIndexer.ts === + +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.types b/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.types new file mode 100644 index 00000000000..50768c8c2f9 --- /dev/null +++ b/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.types @@ -0,0 +1,43 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot.ts === +enum enumdule { +>enumdule : enumdule + + Red, Blue +>Red : enumdule +>Blue : enumdule +} + +module enumdule { +>enumdule : typeof enumdule + + export class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + } +} + +var x: enumdule; +>x : enumdule +>enumdule : enumdule + +var x = enumdule.Red; +>x : enumdule +>enumdule.Red : enumdule +>enumdule : typeof enumdule +>Red : enumdule + +var y: { x: number; y: number }; +>y : { x: number; y: number; } +>x : number +>y : number + +var y = new enumdule.Point(0, 0); +>y : { x: number; y: number; } +>new enumdule.Point(0, 0) : Point +>enumdule.Point : typeof Point +>enumdule : typeof enumdule +>Point : typeof Point + diff --git a/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.types b/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.types new file mode 100644 index 00000000000..6d69109e542 --- /dev/null +++ b/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.types @@ -0,0 +1,38 @@ +=== tests/cases/conformance/internalModules/exportDeclarations/ExportClassWhichExtendsInterfaceWithInaccessibleType.ts === +module A { +>A : typeof A + + interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + + fromOrigin(p: Point): number; +>fromOrigin : (p: Point) => number +>p : Point +>Point : Point + } + + export class Point2d implements Point { +>Point2d : Point2d +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + + fromOrigin(p: Point) { +>fromOrigin : (p: Point) => number +>p : Point +>Point : Point + + return 1; + } + } +} + + diff --git a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.types b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.types new file mode 100644 index 00000000000..17b4a25cde3 --- /dev/null +++ b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.types @@ -0,0 +1,50 @@ +=== tests/cases/conformance/internalModules/exportDeclarations/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts === +module A { +>A : typeof A + + export class Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + + export var Origin: Point = { x: 0, y: 0 }; +>Origin : Point +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number + + export class Point3d extends Point { +>Point3d : Point3d +>Point : Point + + z: number; +>z : number + } + + export var Origin3d: Point3d = { x: 0, y: 0, z: 0 }; +>Origin3d : Point3d +>Point3d : Point3d +>{ x: 0, y: 0, z: 0 } : { x: number; y: number; z: number; } +>x : number +>y : number +>z : number + + export class Line{ +>Line : Line +>TPoint : TPoint +>Point : Point + + constructor(public start: TPoint, public end: TPoint) { } +>start : TPoint +>TPoint : TPoint +>end : TPoint +>TPoint : TPoint + } +} + diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.types b/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.types new file mode 100644 index 00000000000..451db7f92a8 --- /dev/null +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/internalModules/exportDeclarations/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.ts === +module A { +>A : typeof A + + class Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + + export class points { +>points : points + + [idx: number]: Point; +>idx : number +>Point : Point + + [idx: string]: Point; +>idx : string +>Point : Point + } +} + + diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.types b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.types new file mode 100644 index 00000000000..238026d64ff --- /dev/null +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.types @@ -0,0 +1,60 @@ +=== tests/cases/conformance/internalModules/exportDeclarations/ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts === +module A { +>A : typeof A + + class Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + + export var Origin: Point = { x: 0, y: 0 }; +>Origin : Point +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number + + export class Point3d extends Point { +>Point3d : Point3d +>Point : Point + + z: number; +>z : number + } + + export var Origin3d: Point3d = { x: 0, y: 0, z: 0 }; +>Origin3d : Point3d +>Point3d : Point3d +>{ x: 0, y: 0, z: 0 } : { x: number; y: number; z: number; } +>x : number +>y : number +>z : number + + export class Line{ +>Line : Line +>TPoint : TPoint +>Point : Point + + constructor(public start: TPoint, public end: TPoint) { } +>start : TPoint +>TPoint : TPoint +>end : TPoint +>TPoint : TPoint + + static fromorigin2d(p: Point): Line{ +>fromorigin2d : (p: Point) => Line +>p : Point +>Point : Point +>Line : Line +>Point : Point + + return null; + } + } +} + diff --git a/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.types b/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.types new file mode 100644 index 00000000000..ac1845a533c --- /dev/null +++ b/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.types @@ -0,0 +1,39 @@ +=== tests/cases/conformance/internalModules/exportDeclarations/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts === +module A { +>A : typeof A + + export class Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + + export class Line { +>Line : Line + + constructor(public start: Point, public end: Point) { } +>start : Point +>Point : Point +>end : Point +>Point : Point + } + + export function fromOrigin(p: Point): Line { +>fromOrigin : (p: Point) => Line +>p : Point +>Point : Point +>Line : Line + + return new Line({ x: 0, y: 0 }, p); +>new Line({ x: 0, y: 0 }, p) : Line +>Line : typeof Line +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number +>p : Point + } +} diff --git a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.types b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.types new file mode 100644 index 00000000000..3f3a670ee8e --- /dev/null +++ b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.types @@ -0,0 +1,39 @@ +=== tests/cases/conformance/internalModules/exportDeclarations/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts === +module A { +>A : typeof A + + class Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + + export class Line { +>Line : Line + + constructor(public start: Point, public end: Point) { } +>start : Point +>Point : Point +>end : Point +>Point : Point + } + + export function fromOrigin(p: Point): Line { +>fromOrigin : (p: Point) => Line +>p : Point +>Point : Point +>Line : Line + + return new Line({ x: 0, y: 0 }, p); +>new Line({ x: 0, y: 0 }, p) : Line +>Line : typeof Line +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number +>p : Point + } +} diff --git a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.types b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.types new file mode 100644 index 00000000000..7634e2cde3e --- /dev/null +++ b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.types @@ -0,0 +1,39 @@ +=== tests/cases/conformance/internalModules/exportDeclarations/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts === +module A { +>A : typeof A + + export class Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + + class Line { +>Line : Line + + constructor(public start: Point, public end: Point) { } +>start : Point +>Point : Point +>end : Point +>Point : Point + } + + export function fromOrigin(p: Point): Line { +>fromOrigin : (p: Point) => Line +>p : Point +>Point : Point +>Line : Line + + return new Line({ x: 0, y: 0 }, p); +>new Line({ x: 0, y: 0 }, p) : Line +>Line : typeof Line +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number +>p : Point + } +} diff --git a/tests/baselines/reference/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.types b/tests/baselines/reference/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.types new file mode 100644 index 00000000000..f6f4e6a441a --- /dev/null +++ b/tests/baselines/reference/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.types @@ -0,0 +1,58 @@ +=== tests/cases/conformance/internalModules/exportDeclarations/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts === +module A { +>A : typeof A + + export interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + + export var Origin: Point = { x: 0, y: 0 }; +>Origin : Point +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number + + export interface Point3d extends Point { +>Point3d : Point3d +>Point : Point + + z: number; +>z : number + } + + export var Origin3d: Point3d = { x: 0, y: 0, z: 0 }; +>Origin3d : Point3d +>Point3d : Point3d +>{ x: 0, y: 0, z: 0 } : { x: number; y: number; z: number; } +>x : number +>y : number +>z : number + + export interface Line{ +>Line : Line +>TPoint : TPoint +>Point : Point + + new (start: TPoint, end: TPoint); +>start : TPoint +>TPoint : TPoint +>end : TPoint +>TPoint : TPoint + + start: TPoint; +>start : TPoint +>TPoint : TPoint + + end: TPoint; +>end : TPoint +>TPoint : TPoint + } +} + diff --git a/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.types b/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.types new file mode 100644 index 00000000000..8d6c43a9a78 --- /dev/null +++ b/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/internalModules/exportDeclarations/ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.ts === +module A { +>A : A + + interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + + export interface points { +>points : points + + [idx: number]: Point; +>idx : number +>Point : Point + + [idx: string]: Point; +>idx : string +>Point : Point + } +} + + diff --git a/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.types b/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.types new file mode 100644 index 00000000000..53484780474 --- /dev/null +++ b/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.types @@ -0,0 +1,58 @@ +=== tests/cases/conformance/internalModules/exportDeclarations/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts === +module A { +>A : typeof A + + interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + + export var Origin: Point = { x: 0, y: 0 }; +>Origin : Point +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number + + export interface Point3d extends Point { +>Point3d : Point3d +>Point : Point + + z: number; +>z : number + } + + export var Origin3d: Point3d = { x: 0, y: 0, z: 0 }; +>Origin3d : Point3d +>Point3d : Point3d +>{ x: 0, y: 0, z: 0 } : { x: number; y: number; z: number; } +>x : number +>y : number +>z : number + + export interface Line{ +>Line : Line +>TPoint : TPoint +>Point : Point + + new (start: TPoint, end: TPoint); +>start : TPoint +>TPoint : TPoint +>end : TPoint +>TPoint : TPoint + + start: TPoint; +>start : TPoint +>TPoint : TPoint + + end: TPoint; +>end : TPoint +>TPoint : TPoint + } +} + diff --git a/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.types b/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.types new file mode 100644 index 00000000000..a3a80cb06ad --- /dev/null +++ b/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/internalModules/exportDeclarations/ExportModuleWithAccessibleTypesOnItsExportedMembers.ts === +module A { +>A : typeof A + + export class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + } + + export module B { +>B : typeof B + + export var Origin: Point = new Point(0, 0); +>Origin : Point +>Point : Point +>new Point(0, 0) : Point +>Point : typeof Point + + export class Line { +>Line : Line + + constructor(start: Point, end: Point) { +>start : Point +>Point : Point +>end : Point +>Point : Point + + } + + static fromOrigin(p: Point) { +>fromOrigin : (p: Point) => Line +>p : Point +>Point : Point + + return new Line({ x: 0, y: 0 }, p); +>new Line({ x: 0, y: 0 }, p) : Line +>Line : typeof Line +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number +>p : Point + } + } + } +} diff --git a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.types b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.types new file mode 100644 index 00000000000..82bdf732173 --- /dev/null +++ b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.types @@ -0,0 +1,30 @@ +=== tests/cases/conformance/internalModules/exportDeclarations/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.ts === +module A { +>A : typeof A + + class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + } + + export var Origin: Point = { x: 0, y: 0 }; +>Origin : Point +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number + + export var Unity = { start: new Point(0, 0), end: new Point(1, 0) }; +>Unity : { start: Point; end: Point; } +>{ start: new Point(0, 0), end: new Point(1, 0) } : { start: Point; end: Point; } +>start : Point +>new Point(0, 0) : Point +>Point : typeof Point +>end : Point +>new Point(1, 0) : Point +>Point : typeof Point +} + diff --git a/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.types b/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.types new file mode 100644 index 00000000000..e7624436819 --- /dev/null +++ b/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/internalModules/exportDeclarations/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts === +module A { +>A : typeof A + + class B { +>B : B + + id: number; +>id : number + } + + export var beez: Array; +>beez : B[] +>Array : Array +>B : B + + export var beez2 = new Array(); +>beez2 : B[] +>new Array() : B[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } +>B : B +} diff --git a/tests/baselines/reference/ExportVariableWithAccessibleTypeInTypeAnnotation.types b/tests/baselines/reference/ExportVariableWithAccessibleTypeInTypeAnnotation.types new file mode 100644 index 00000000000..945a4be6fe5 --- /dev/null +++ b/tests/baselines/reference/ExportVariableWithAccessibleTypeInTypeAnnotation.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/internalModules/exportDeclarations/ExportVariableWithAccessibleTypeInTypeAnnotation.ts === +module A { +>A : typeof A + + export interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + + // valid since Point is exported + export var Origin: Point = { x: 0, y: 0 }; +>Origin : Point +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number +} + diff --git a/tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.types b/tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.types new file mode 100644 index 00000000000..9ae05f87416 --- /dev/null +++ b/tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/internalModules/exportDeclarations/ExportVariableWithInaccessibleTypeInTypeAnnotation.ts === +module A { +>A : typeof A + + export interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + + // valid since Point is exported + export var Origin: Point = { x: 0, y: 0 }; +>Origin : Point +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number + + interface Point3d extends Point { +>Point3d : Point3d +>Point : Point + + z: number; +>z : number + } + + // invalid Point3d is not exported + export var Origin3d: Point3d = { x: 0, y: 0, z: 0 }; +>Origin3d : Point3d +>Point3d : Point3d +>{ x: 0, y: 0, z: 0 } : { x: number; y: number; z: number; } +>x : number +>y : number +>z : number +} + diff --git a/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.types b/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.types new file mode 100644 index 00000000000..3110020b9bc --- /dev/null +++ b/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.types @@ -0,0 +1,54 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/function.ts === +module A { +>A : typeof A + + export function Point() { +>Point : () => { x: number; y: number; } + + return { x: 0, y: 0 }; +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number + } +} + +=== tests/cases/conformance/internalModules/DeclarationMerging/module.ts === +module B { +>B : typeof B + + export module Point { +>Point : typeof Point + + export var Origin = { x: 0, y: 0 }; +>Origin : { x: number; y: number; } +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number + } +} + +=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts === +var fn: () => { x: number; y: number }; +>fn : () => { x: number; y: number; } +>x : number +>y : number + +var fn = A.Point; +>fn : () => { x: number; y: number; } +>A.Point : () => { x: number; y: number; } +>A : typeof A +>Point : () => { x: number; y: number; } + +var cl: { x: number; y: number; } +>cl : { x: number; y: number; } +>x : number +>y : number + +var cl = B.Point.Origin; +>cl : { x: number; y: number; } +>B.Point.Origin : { x: number; y: number; } +>B.Point : typeof Point +>B : typeof B +>Point : typeof Point +>Origin : { x: number; y: number; } + diff --git a/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.types b/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.types new file mode 100644 index 00000000000..c33be647018 --- /dev/null +++ b/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.types @@ -0,0 +1,43 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot.ts === +module enumdule { +>enumdule : typeof enumdule + + export class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + } +} + +enum enumdule { +>enumdule : enumdule + + Red, Blue +>Red : enumdule +>Blue : enumdule +} + +var x: enumdule; +>x : enumdule +>enumdule : enumdule + +var x = enumdule.Red; +>x : enumdule +>enumdule.Red : enumdule +>enumdule : typeof enumdule +>Red : enumdule + +var y: { x: number; y: number }; +>y : { x: number; y: number; } +>x : number +>y : number + +var y = new enumdule.Point(0, 0); +>y : { x: number; y: number; } +>new enumdule.Point(0, 0) : Point +>enumdule.Point : typeof Point +>enumdule : typeof enumdule +>Point : typeof Point + diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.types b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.types new file mode 100644 index 00000000000..9fc4a86e362 --- /dev/null +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.types @@ -0,0 +1,97 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts === +module A { +>A : typeof A + + export class Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } +} + +module A { +>A : typeof A + + class Point { +>Point : Point + + fromCarthesian(p: A.Point) { +>fromCarthesian : (p: Point) => { x: number; y: number; } +>p : Point +>A : A +>Point : Point + + return { x: p.x, y: p.y }; +>{ x: p.x, y: p.y } : { x: number; y: number; } +>x : number +>p.x : number +>p : Point +>x : number +>y : number +>p.y : number +>p : Point +>y : number + } + } +} + +// ensure merges as expected +var p: { x: number; y: number; }; +>p : { x: number; y: number; } +>x : number +>y : number + +var p: A.Point; +>p : { x: number; y: number; } +>A : A +>Point : Point + +module X.Y.Z { +>X : typeof X +>Y : typeof Y +>Z : typeof Z + + export class Line { +>Line : Line + + length: number; +>length : number + } +} + +module X { +>X : typeof X + + export module Y { +>Y : typeof Y + + export module Z { +>Z : typeof Z + + class Line { +>Line : Line + + name: string; +>name : string + } + } + } +} + +// ensure merges as expected +var l: { length: number; } +>l : { length: number; } +>length : number + +var l: X.Y.Z.Line; +>l : { length: number; } +>X : X +>Y : Y +>Z : Z +>Line : Line + + diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.types b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.types new file mode 100644 index 00000000000..c589eae642f --- /dev/null +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.types @@ -0,0 +1,103 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts === +module A { +>A : A + + export interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + + toCarth(): Point; +>toCarth : () => Point +>Point : Point + } +} + +module A { +>A : A + + interface Point { +>Point : Point + + fromCarth(): Point; +>fromCarth : () => Point +>Point : Point + } +} + +// ensure merges as expected +var p: { x: number; y: number; toCarth(): A.Point; }; +>p : { x: number; y: number; toCarth(): Point; } +>x : number +>y : number +>toCarth : () => Point +>A : A +>Point : Point + +var p: A.Point; +>p : { x: number; y: number; toCarth(): Point; } +>A : A +>Point : Point + +module X.Y.Z { +>X : X +>Y : Y +>Z : Z + + export interface Line { +>Line : Line + + new (start: A.Point, end: A.Point); +>start : Point +>A : A +>Point : Point +>end : Point +>A : A +>Point : Point + } +} + +module X { +>X : X + + export module Y.Z { +>Y : Y +>Z : Z + + interface Line { +>Line : Line + + start: A.Point; +>start : Point +>A : A +>Point : Point + + end: A.Point; +>end : Point +>A : A +>Point : Point + } + } +} + +// ensure merges as expected +var l: { new (s: A.Point, e: A.Point); } +>l : new (s: Point, e: Point) => any +>s : Point +>A : A +>Point : Point +>e : Point +>A : A +>Point : Point + +var l: X.Y.Z.Line; +>l : new (s: Point, e: Point) => any +>X : X +>Y : Y +>Z : Z +>Line : Line + diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.types b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.types new file mode 100644 index 00000000000..44472c4da6b --- /dev/null +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.types @@ -0,0 +1,125 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts === +module A { +>A : typeof A + + export interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + + export module Utils { +>Utils : typeof Utils + + export function mirror(p: T) { +>mirror : (p: T) => { x: number; y: number; } +>T : T +>Point : Point +>p : T +>T : T + + return { x: p.y, y: p.x }; +>{ x: p.y, y: p.x } : { x: number; y: number; } +>x : number +>p.y : number +>p : T +>y : number +>y : number +>p.x : number +>p : T +>x : number + } + } + export var Origin: Point = { x: 0, y: 0 }; +>Origin : Point +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number +} + +=== tests/cases/conformance/internalModules/DeclarationMerging/part2.ts === +module A { +>A : typeof A + + // not a collision, since we don't export + var Origin: string = "0,0"; +>Origin : string + + export module Utils { +>Utils : typeof Utils + + export class Plane { +>Plane : Plane + + constructor(public tl: Point, public br: Point) { } +>tl : Point +>Point : Point +>br : Point +>Point : Point + } + } +} + +=== tests/cases/conformance/internalModules/DeclarationMerging/part3.ts === +// test the merging actually worked + +var o: { x: number; y: number }; +>o : { x: number; y: number; } +>x : number +>y : number + +var o: A.Point; +>o : { x: number; y: number; } +>A : A +>Point : Point + +var o = A.Origin; +>o : { x: number; y: number; } +>A.Origin : Point +>A : typeof A +>Origin : Point + +var o = A.Utils.mirror(o); +>o : { x: number; y: number; } +>A.Utils.mirror(o) : { x: number; y: number; } +>A.Utils.mirror : (p: T) => { x: number; y: number; } +>A.Utils : typeof Utils +>A : typeof A +>Utils : typeof Utils +>mirror : (p: T) => { x: number; y: number; } +>o : { x: number; y: number; } + +var p: { tl: A.Point; br: A.Point }; +>p : { tl: Point; br: Point; } +>tl : Point +>A : A +>Point : Point +>br : Point +>A : A +>Point : Point + +var p: A.Utils.Plane; +>p : { tl: Point; br: Point; } +>A : A +>Utils : Utils +>Plane : Plane + +var p = new A.Utils.Plane(o, { x: 1, y: 1 }); +>p : { tl: Point; br: Point; } +>new A.Utils.Plane(o, { x: 1, y: 1 }) : Plane +>A.Utils.Plane : typeof Plane +>A.Utils : typeof Utils +>A : typeof A +>Utils : typeof Utils +>Plane : typeof Plane +>o : { x: number; y: number; } +>{ x: 1, y: 1 } : { x: number; y: number; } +>x : number +>y : number + + diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.types b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.types new file mode 100644 index 00000000000..6a3bc7d15bd --- /dev/null +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.types @@ -0,0 +1,112 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts === +module A { +>A : A + + export interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + + toCarth(): Point; +>toCarth : () => Point +>Point : Point + } +} + +module A { +>A : A + + export interface Point { +>Point : Point + + fromCarth(): Point; +>fromCarth : () => Point +>Point : Point + } +} + +// ensure merges as expected +var p: { x: number; y: number; toCarth(): A.Point; fromCarth(): A.Point; }; +>p : { x: number; y: number; toCarth(): Point; fromCarth(): Point; } +>x : number +>y : number +>toCarth : () => Point +>A : A +>Point : Point +>fromCarth : () => Point +>A : A +>Point : Point + +var p: A.Point; +>p : { x: number; y: number; toCarth(): Point; fromCarth(): Point; } +>A : A +>Point : Point + +module X.Y.Z { +>X : X +>Y : Y +>Z : Z + + export interface Line { +>Line : Line + + new (start: A.Point, end: A.Point); +>start : Point +>A : A +>Point : Point +>end : Point +>A : A +>Point : Point + } +} + +module X { +>X : X + + export module Y.Z { +>Y : Y +>Z : Z + + export interface Line { +>Line : Line + + start: A.Point; +>start : Point +>A : A +>Point : Point + + end: A.Point; +>end : Point +>A : A +>Point : Point + } + } +} + +// ensure merges as expected +var l: { start: A.Point; end: A.Point; new (s: A.Point, e: A.Point); } +>l : { new (s: Point, e: Point): any; start: Point; end: Point; } +>start : Point +>A : A +>Point : Point +>end : Point +>A : A +>Point : Point +>s : Point +>A : A +>Point : Point +>e : Point +>A : A +>Point : Point + +var l: X.Y.Z.Line; +>l : { new (s: Point, e: Point): any; start: Point; end: Point; } +>X : X +>Y : Y +>Z : Z +>Line : Line + diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.types b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.types new file mode 100644 index 00000000000..3903b181a03 --- /dev/null +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.types @@ -0,0 +1,76 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts === +module A.B { +>A : typeof A +>B : typeof B + + export var x: number; +>x : number +} + +module A{ +>A : typeof A + + module B { +>B : typeof B + + export var x: string; +>x : string + } +} + +// ensure the right var decl is exported +var x: number; +>x : number + +var x = A.B.x; +>x : number +>A.B.x : number +>A.B : typeof B +>A : typeof A +>B : typeof B +>x : number + +module X.Y.Z { +>X : typeof X +>Y : typeof Y +>Z : typeof Z + + export class Line { +>Line : Line + + length: number; +>length : number + } +} + +module X { +>X : typeof X + + export module Y { +>Y : typeof Y + + module Z { +>Z : typeof Z + + export class Line { +>Line : Line + + name: string; +>name : string + } + } + } +} + +// make sure merging works as expected +var l: { length: number }; +>l : { length: number; } +>length : number + +var l: X.Y.Z.Line; +>l : { length: number; } +>X : X +>Y : Y +>Z : Z +>Line : Line + diff --git a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.types b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.types new file mode 100644 index 00000000000..15f596622e7 --- /dev/null +++ b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.types @@ -0,0 +1,78 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts === +module Root { +>Root : typeof Root + + export module A { +>A : typeof A + + export interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + + export module Utils { +>Utils : typeof Utils + + export function mirror(p: T) { +>mirror : (p: T) => { x: number; y: number; } +>T : T +>Point : Point +>p : T +>T : T + + return { x: p.y, y: p.x }; +>{ x: p.y, y: p.x } : { x: number; y: number; } +>x : number +>p.y : number +>p : T +>y : number +>y : number +>p.x : number +>p : T +>x : number + } + } + } +} + +=== tests/cases/conformance/internalModules/DeclarationMerging/part2.ts === +module otherRoot { +>otherRoot : typeof otherRoot + + export module A { +>A : typeof A + + // have to be fully qualified since in different root + export var Origin: Root.A.Point = { x: 0, y: 0 }; +>Origin : Point +>Root : Root +>A : A +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number + + export module Utils { +>Utils : typeof Utils + + export class Plane { +>Plane : Plane + + constructor(public tl: Root.A.Point, public br: Root.A.Point) { } +>tl : Point +>Root : Root +>A : A +>Point : Point +>br : Point +>Root : Root +>A : A +>Point : Point + } + } + } +} diff --git a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.types b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.types new file mode 100644 index 00000000000..0bcc1b750c8 --- /dev/null +++ b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.types @@ -0,0 +1,122 @@ +=== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts === +module A { +>A : typeof A + + export interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + + export module Utils { +>Utils : typeof Utils + + export function mirror(p: T) { +>mirror : (p: T) => { x: number; y: number; } +>T : T +>Point : Point +>p : T +>T : T + + return { x: p.y, y: p.x }; +>{ x: p.y, y: p.x } : { x: number; y: number; } +>x : number +>p.y : number +>p : T +>y : number +>y : number +>p.x : number +>p : T +>x : number + } + } +} + +=== tests/cases/conformance/internalModules/DeclarationMerging/part2.ts === +module A { +>A : typeof A + + export var Origin: Point = { x: 0, y: 0 }; +>Origin : Point +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number + + export module Utils { +>Utils : typeof Utils + + export class Plane { +>Plane : Plane + + constructor(public tl: Point, public br: Point) { } +>tl : Point +>Point : Point +>br : Point +>Point : Point + } + } +} + +=== tests/cases/conformance/internalModules/DeclarationMerging/part3.ts === +// test the merging actually worked + +var o: { x: number; y: number }; +>o : { x: number; y: number; } +>x : number +>y : number + +var o: A.Point; +>o : { x: number; y: number; } +>A : A +>Point : Point + +var o = A.Origin; +>o : { x: number; y: number; } +>A.Origin : Point +>A : typeof A +>Origin : Point + +var o = A.Utils.mirror(o); +>o : { x: number; y: number; } +>A.Utils.mirror(o) : { x: number; y: number; } +>A.Utils.mirror : (p: T) => { x: number; y: number; } +>A.Utils : typeof Utils +>A : typeof A +>Utils : typeof Utils +>mirror : (p: T) => { x: number; y: number; } +>o : { x: number; y: number; } + +var p: { tl: A.Point; br: A.Point }; +>p : { tl: Point; br: Point; } +>tl : Point +>A : A +>Point : Point +>br : Point +>A : A +>Point : Point + +var p: A.Utils.Plane; +>p : { tl: Point; br: Point; } +>A : A +>Utils : Utils +>Plane : Plane + +var p = new A.Utils.Plane(o, { x: 1, y: 1 }); +>p : { tl: Point; br: Point; } +>new A.Utils.Plane(o, { x: 1, y: 1 }) : Plane +>A.Utils.Plane : typeof Plane +>A.Utils : typeof Utils +>A : typeof A +>Utils : typeof Utils +>Plane : typeof Plane +>o : { x: number; y: number; } +>{ x: 1, y: 1 } : { x: number; y: number; } +>x : number +>y : number + + diff --git a/tests/baselines/reference/acceptableAlias1.types b/tests/baselines/reference/acceptableAlias1.types new file mode 100644 index 00000000000..a73e416a11c --- /dev/null +++ b/tests/baselines/reference/acceptableAlias1.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/acceptableAlias1.ts === +module M { +>M : typeof M + + export module N { +>N : N + } + export import X = N; +>X : X +>N : N +} + +import r = M.X; +>r : r +>M : M +>X : X + diff --git a/tests/baselines/reference/accessOverriddenBaseClassMember1.types b/tests/baselines/reference/accessOverriddenBaseClassMember1.types new file mode 100644 index 00000000000..89701992cae --- /dev/null +++ b/tests/baselines/reference/accessOverriddenBaseClassMember1.types @@ -0,0 +1,52 @@ +=== tests/cases/compiler/accessOverriddenBaseClassMember1.ts === +class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + + public toString() { +>toString : () => string + + return "x=" + this.x + " y=" + this.y; +>"x=" + this.x + " y=" + this.y : string +>"x=" + this.x + " y=" : string +>"x=" + this.x : string +>this.x : number +>this : Point +>x : number +>this.y : number +>this : Point +>y : number + } +} +class ColoredPoint extends Point { +>ColoredPoint : ColoredPoint +>Point : Point + + constructor(x: number, y: number, public color: string) { +>x : number +>y : number +>color : string + + super(x, y); +>super(x, y) : void +>x : number +>y : number + } + public toString() { +>toString : () => string + + return super.toString() + " color=" + this.color; +>super.toString() + " color=" + this.color : string +>super.toString() + " color=" : string +>super.toString() : string +>super.toString : () => string +>toString : () => string +>this.color : string +>this : ColoredPoint +>color : string + } +} + diff --git a/tests/baselines/reference/accessorWithES5.types b/tests/baselines/reference/accessorWithES5.types new file mode 100644 index 00000000000..8753eb64ae4 --- /dev/null +++ b/tests/baselines/reference/accessorWithES5.types @@ -0,0 +1,41 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES5.ts === + +class C { +>C : C + + get x() { +>x : number + + return 1; + } +} + +class D { +>D : D + + set x(v) { +>x : any +>v : any + } +} + +var x = { +>x : { a: number; } +>{ + get a() { return 1 } +} : { a: number; } + + get a() { return 1 } +>a : number +} + +var y = { +>y : { b: any; } +>{ + set b(v) { } +} : { b: any; } + + set b(v) { } +>b : any +>v : any +} diff --git a/tests/baselines/reference/addMoreCallSignaturesToBaseSignature.types b/tests/baselines/reference/addMoreCallSignaturesToBaseSignature.types new file mode 100644 index 00000000000..212186ace77 --- /dev/null +++ b/tests/baselines/reference/addMoreCallSignaturesToBaseSignature.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/addMoreCallSignaturesToBaseSignature.ts === +interface Foo { +>Foo : Foo + + (): string; +} + +interface Bar extends Foo { +>Bar : Bar +>Foo : Foo + + (key: string): string; +>key : string +} + +var a: Bar; +>a : Bar +>Bar : Bar + +var kitty = a(); +>kitty : string +>a() : string +>a : Bar + diff --git a/tests/baselines/reference/addMoreCallSignaturesToBaseSignature2.types b/tests/baselines/reference/addMoreCallSignaturesToBaseSignature2.types new file mode 100644 index 00000000000..a80986c8cd1 --- /dev/null +++ b/tests/baselines/reference/addMoreCallSignaturesToBaseSignature2.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/addMoreCallSignaturesToBaseSignature2.ts === +interface Foo { +>Foo : Foo + + (bar:number): string; +>bar : number +} + +interface Bar extends Foo { +>Bar : Bar +>Foo : Foo + + (key: string): string; +>key : string +} + +var a: Bar; +>a : Bar +>Bar : Bar + +var kitty = a(1); +>kitty : string +>a(1) : string +>a : Bar + diff --git a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.types b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.types new file mode 100644 index 00000000000..da534c68ad6 --- /dev/null +++ b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.types @@ -0,0 +1,168 @@ +=== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType.ts === +function foo() { } +>foo : () => void + +class C { +>C : C + + public a: string; +>a : string + + static foo() { } +>foo : () => void +} +enum E { a, b, c } +>E : E +>a : E +>b : E +>c : E + +module M { export var a } +>M : typeof M +>a : any + +var a: any; +>a : any + +var b: boolean; +>b : boolean + +var c: number; +>c : number + +var d: string; +>d : string + +var e: Object; +>e : Object +>Object : Object + +// any as left operand, result is type Any except plusing string +var r1 = a + a; +>r1 : any +>a + a : any +>a : any +>a : any + +var r2 = a + b; +>r2 : any +>a + b : any +>a : any +>b : boolean + +var r3 = a + c; +>r3 : any +>a + c : any +>a : any +>c : number + +var r4 = a + d; +>r4 : string +>a + d : string +>a : any +>d : string + +var r5 = a + e; +>r5 : any +>a + e : any +>a : any +>e : Object + +// any as right operand, result is type Any except plusing string +var r6 = b + a; +>r6 : any +>b + a : any +>b : boolean +>a : any + +var r7 = c + a; +>r7 : any +>c + a : any +>c : number +>a : any + +var r8 = d + a; +>r8 : string +>d + a : string +>d : string +>a : any + +var r9 = e + a; +>r9 : any +>e + a : any +>e : Object +>a : any + +// other cases +var r10 = a + foo; +>r10 : any +>a + foo : any +>a : any +>foo : () => void + +var r11 = a + foo(); +>r11 : any +>a + foo() : any +>a : any +>foo() : void +>foo : () => void + +var r12 = a + C; +>r12 : any +>a + C : any +>a : any +>C : typeof C + +var r13 = a + new C(); +>r13 : any +>a + new C() : any +>a : any +>new C() : C +>C : typeof C + +var r14 = a + E; +>r14 : any +>a + E : any +>a : any +>E : typeof E + +var r15 = a + E.a; +>r15 : any +>a + E.a : any +>a : any +>E.a : E +>E : typeof E +>a : E + +var r16 = a + M; +>r16 : any +>a + M : any +>a : any +>M : typeof M + +var r17 = a + ''; +>r17 : string +>a + '' : string +>a : any + +var r18 = a + 123; +>r18 : any +>a + 123 : any +>a : any + +var r19 = a + { a: '' }; +>r19 : any +>a + { a: '' } : any +>a : any +>{ a: '' } : { a: string; } +>a : string + +var r20 = a + ((a: string) => { return a }); +>r20 : any +>a + ((a: string) => { return a }) : any +>a : any +>((a: string) => { return a }) : (a: string) => string +>(a: string) => { return a } : (a: string) => string +>a : string +>a : string + diff --git a/tests/baselines/reference/additionOperatorWithNullValueAndValidOperator.types b/tests/baselines/reference/additionOperatorWithNullValueAndValidOperator.types new file mode 100644 index 00000000000..4dade89f5e4 --- /dev/null +++ b/tests/baselines/reference/additionOperatorWithNullValueAndValidOperator.types @@ -0,0 +1,107 @@ +=== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator.ts === +// If one operand is the null or undefined value, it is treated as having the type of the other operand. + +enum E { a, b, c } +>E : E +>a : E +>b : E +>c : E + +var a: any; +>a : any + +var b: number; +>b : number + +var c: E; +>c : E +>E : E + +var d: string; +>d : string + +// null + any +var r1: any = null + a; +>r1 : any +>null + a : any +>a : any + +var r2: any = a + null; +>r2 : any +>a + null : any +>a : any + +// null + number/enum +var r3 = null + b; +>r3 : number +>null + b : number +>b : number + +var r4 = null + 1; +>r4 : number +>null + 1 : number + +var r5 = null + c; +>r5 : number +>null + c : number +>c : E + +var r6 = null + E.a; +>r6 : number +>null + E.a : number +>E.a : E +>E : typeof E +>a : E + +var r7 = null + E['a']; +>r7 : number +>null + E['a'] : number +>E['a'] : E +>E : typeof E + +var r8 = b + null; +>r8 : number +>b + null : number +>b : number + +var r9 = 1 + null; +>r9 : number +>1 + null : number + +var r10 = c + null +>r10 : number +>c + null : number +>c : E + +var r11 = E.a + null; +>r11 : number +>E.a + null : number +>E.a : E +>E : typeof E +>a : E + +var r12 = E['a'] + null; +>r12 : number +>E['a'] + null : number +>E['a'] : E +>E : typeof E + +// null + string +var r13 = null + d; +>r13 : string +>null + d : string +>d : string + +var r14 = null + ''; +>r14 : string +>null + '' : string + +var r15 = d + null; +>r15 : string +>d + null : string +>d : string + +var r16 = '' + null; +>r16 : string +>'' + null : string + diff --git a/tests/baselines/reference/additionOperatorWithNumberAndEnum.types b/tests/baselines/reference/additionOperatorWithNumberAndEnum.types new file mode 100644 index 00000000000..268f74b69ff --- /dev/null +++ b/tests/baselines/reference/additionOperatorWithNumberAndEnum.types @@ -0,0 +1,67 @@ +=== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum.ts === +enum E { a, b } +>E : E +>a : E +>b : E + +var a: number; +>a : number + +var b: E; +>b : E +>E : E + +var r1 = a + a; +>r1 : number +>a + a : number +>a : number +>a : number + +var r2 = a + b; +>r2 : number +>a + b : number +>a : number +>b : E + +var r3 = b + a; +>r3 : number +>b + a : number +>b : E +>a : number + +var r4 = b + b; +>r4 : number +>b + b : number +>b : E +>b : E + +var r5 = 0 + a; +>r5 : number +>0 + a : number +>a : number + +var r6 = E.a + 0; +>r6 : number +>E.a + 0 : number +>E.a : E +>E : typeof E +>a : E + +var r7 = E.a + E.b; +>r7 : number +>E.a + E.b : number +>E.a : E +>E : typeof E +>a : E +>E.b : E +>E : typeof E +>b : E + +var r8 = E['a'] + E['b']; +>r8 : number +>E['a'] + E['b'] : number +>E['a'] : E +>E : typeof E +>E['b'] : E +>E : typeof E + diff --git a/tests/baselines/reference/additionOperatorWithStringAndEveryType.types b/tests/baselines/reference/additionOperatorWithStringAndEveryType.types new file mode 100644 index 00000000000..9d5a926c427 --- /dev/null +++ b/tests/baselines/reference/additionOperatorWithStringAndEveryType.types @@ -0,0 +1,158 @@ +=== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType.ts === +enum E { a, b, c } +>E : E +>a : E +>b : E +>c : E + +var a: any; +>a : any + +var b: boolean; +>b : boolean + +var c: number; +>c : number + +var d: string; +>d : string + +var e: Object; +>e : Object +>Object : Object + +var f: void; +>f : void + +var g: E; +>g : E +>E : E + +var x: string; +>x : string + +// string could plus every type, and the result is always string +// string as left operand +var r1 = x + a; +>r1 : string +>x + a : string +>x : string +>a : any + +var r2 = x + b; +>r2 : string +>x + b : string +>x : string +>b : boolean + +var r3 = x + c; +>r3 : string +>x + c : string +>x : string +>c : number + +var r4 = x + d; +>r4 : string +>x + d : string +>x : string +>d : string + +var r5 = x + e; +>r5 : string +>x + e : string +>x : string +>e : Object + +var r6 = x + f; +>r6 : string +>x + f : string +>x : string +>f : void + +var r7 = x + g; +>r7 : string +>x + g : string +>x : string +>g : E + +// string as right operand +var r8 = a + x; +>r8 : string +>a + x : string +>a : any +>x : string + +var r9 = b + x; +>r9 : string +>b + x : string +>b : boolean +>x : string + +var r10 = c + x; +>r10 : string +>c + x : string +>c : number +>x : string + +var r11 = d + x; +>r11 : string +>d + x : string +>d : string +>x : string + +var r12 = e + x; +>r12 : string +>e + x : string +>e : Object +>x : string + +var r13 = f + x; +>r13 : string +>f + x : string +>f : void +>x : string + +var r14 = g + x; +>r14 : string +>g + x : string +>g : E +>x : string + +// other cases +var r15 = x + E; +>r15 : string +>x + E : string +>x : string +>E : typeof E + +var r16 = x + E.a; +>r16 : string +>x + E.a : string +>x : string +>E.a : E +>E : typeof E +>a : E + +var r17 = x + ''; +>r17 : string +>x + '' : string +>x : string + +var r18 = x + 0; +>r18 : string +>x + 0 : string +>x : string + +var r19 = x + { a: '' }; +>r19 : string +>x + { a: '' } : string +>x : string +>{ a: '' } : { a: string; } +>a : string + +var r20 = x + []; +>r20 : string +>x + [] : string +>x : string +>[] : undefined[] + diff --git a/tests/baselines/reference/additionOperatorWithUndefinedValueAndValidOperator.types b/tests/baselines/reference/additionOperatorWithUndefinedValueAndValidOperator.types new file mode 100644 index 00000000000..9a67b25024c --- /dev/null +++ b/tests/baselines/reference/additionOperatorWithUndefinedValueAndValidOperator.types @@ -0,0 +1,123 @@ +=== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator.ts === +// If one operand is the null or undefined value, it is treated as having the type of the other operand. + +enum E { a, b, c } +>E : E +>a : E +>b : E +>c : E + +var a: any; +>a : any + +var b: number; +>b : number + +var c: E; +>c : E +>E : E + +var d: string; +>d : string + +// undefined + any +var r1: any = undefined + a; +>r1 : any +>undefined + a : any +>undefined : undefined +>a : any + +var r2: any = a + undefined; +>r2 : any +>a + undefined : any +>a : any +>undefined : undefined + +// undefined + number/enum +var r3 = undefined + b; +>r3 : number +>undefined + b : number +>undefined : undefined +>b : number + +var r4 = undefined + 1; +>r4 : number +>undefined + 1 : number +>undefined : undefined + +var r5 = undefined + c; +>r5 : number +>undefined + c : number +>undefined : undefined +>c : E + +var r6 = undefined + E.a; +>r6 : number +>undefined + E.a : number +>undefined : undefined +>E.a : E +>E : typeof E +>a : E + +var r7 = undefined + E['a']; +>r7 : number +>undefined + E['a'] : number +>undefined : undefined +>E['a'] : E +>E : typeof E + +var r8 = b + undefined; +>r8 : number +>b + undefined : number +>b : number +>undefined : undefined + +var r9 = 1 + undefined; +>r9 : number +>1 + undefined : number +>undefined : undefined + +var r10 = c + undefined +>r10 : number +>c + undefined : number +>c : E +>undefined : undefined + +var r11 = E.a + undefined; +>r11 : number +>E.a + undefined : number +>E.a : E +>E : typeof E +>a : E +>undefined : undefined + +var r12 = E['a'] + undefined; +>r12 : number +>E['a'] + undefined : number +>E['a'] : E +>E : typeof E +>undefined : undefined + +// undefined + string +var r13 = undefined + d; +>r13 : string +>undefined + d : string +>undefined : undefined +>d : string + +var r14 = undefined + ''; +>r14 : string +>undefined + '' : string +>undefined : undefined + +var r15 = d + undefined; +>r15 : string +>d + undefined : string +>d : string +>undefined : undefined + +var r16 = '' + undefined; +>r16 : string +>'' + undefined : string +>undefined : undefined + diff --git a/tests/baselines/reference/aliasInaccessibleModule.types b/tests/baselines/reference/aliasInaccessibleModule.types new file mode 100644 index 00000000000..482e3f667ac --- /dev/null +++ b/tests/baselines/reference/aliasInaccessibleModule.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/aliasInaccessibleModule.ts === +module M { +>M : typeof M + + module N { +>N : N + } + export import X = N; +>X : X +>N : N +} diff --git a/tests/baselines/reference/aliasInaccessibleModule2.types b/tests/baselines/reference/aliasInaccessibleModule2.types new file mode 100644 index 00000000000..1ad25ae0cf9 --- /dev/null +++ b/tests/baselines/reference/aliasInaccessibleModule2.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/aliasInaccessibleModule2.ts === +module M { +>M : typeof M + + module N { +>N : typeof N + + class C { +>C : C + } + + } + import R = N; +>R : typeof N +>N : typeof N + + export import X = R; +>X : typeof N +>R : typeof N +} diff --git a/tests/baselines/reference/aliasUsageInArray.types b/tests/baselines/reference/aliasUsageInArray.types new file mode 100644 index 00000000000..9903592ffdc --- /dev/null +++ b/tests/baselines/reference/aliasUsageInArray.types @@ -0,0 +1,48 @@ +=== tests/cases/compiler/aliasUsageInArray_main.ts === +import Backbone = require("aliasUsageInArray_backbone"); +>Backbone : typeof "tests/cases/compiler/aliasUsageInArray_backbone" + +import moduleA = require("aliasUsageInArray_moduleA"); +>moduleA : typeof "tests/cases/compiler/aliasUsageInArray_moduleA" + +interface IHasVisualizationModel { +>IHasVisualizationModel : IHasVisualizationModel + + VisualizationModel: typeof Backbone.Model; +>VisualizationModel : typeof Model +>Backbone : typeof "tests/cases/compiler/aliasUsageInArray_backbone" +>Model : typeof Model +} + +var xs: IHasVisualizationModel[] = [moduleA]; +>xs : IHasVisualizationModel[] +>IHasVisualizationModel : IHasVisualizationModel +>[moduleA] : IHasVisualizationModel[] +>moduleA : typeof "tests/cases/compiler/aliasUsageInArray_moduleA" + +var xs2: typeof moduleA[] = [moduleA]; +>xs2 : typeof "tests/cases/compiler/aliasUsageInArray_moduleA"[] +>moduleA : typeof "tests/cases/compiler/aliasUsageInArray_moduleA" +>[moduleA] : typeof "tests/cases/compiler/aliasUsageInArray_moduleA"[] +>moduleA : typeof "tests/cases/compiler/aliasUsageInArray_moduleA" + +=== tests/cases/compiler/aliasUsageInArray_backbone.ts === +export class Model { +>Model : Model + + public someData: string; +>someData : string +} + +=== tests/cases/compiler/aliasUsageInArray_moduleA.ts === +import Backbone = require("aliasUsageInArray_backbone"); +>Backbone : typeof "tests/cases/compiler/aliasUsageInArray_backbone" + +export class VisualizationModel extends Backbone.Model { +>VisualizationModel : VisualizationModel +>Backbone : Backbone +>Model : Model + + // interesting stuff here +} + diff --git a/tests/baselines/reference/aliasUsageInFunctionExpression.types b/tests/baselines/reference/aliasUsageInFunctionExpression.types new file mode 100644 index 00000000000..1ab7065f00f --- /dev/null +++ b/tests/baselines/reference/aliasUsageInFunctionExpression.types @@ -0,0 +1,49 @@ +=== tests/cases/compiler/aliasUsageInFunctionExpression_main.ts === +import Backbone = require("aliasUsageInFunctionExpression_backbone"); +>Backbone : typeof "tests/cases/compiler/aliasUsageInFunctionExpression_backbone" + +import moduleA = require("aliasUsageInFunctionExpression_moduleA"); +>moduleA : typeof "tests/cases/compiler/aliasUsageInFunctionExpression_moduleA" + +interface IHasVisualizationModel { +>IHasVisualizationModel : IHasVisualizationModel + + VisualizationModel: typeof Backbone.Model; +>VisualizationModel : typeof Model +>Backbone : typeof "tests/cases/compiler/aliasUsageInFunctionExpression_backbone" +>Model : typeof Model +} +var f = (x: IHasVisualizationModel) => x; +>f : (x: IHasVisualizationModel) => IHasVisualizationModel +>(x: IHasVisualizationModel) => x : (x: IHasVisualizationModel) => IHasVisualizationModel +>x : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +>x : IHasVisualizationModel + +f = (x) => moduleA; +>f = (x) => moduleA : (x: IHasVisualizationModel) => typeof "tests/cases/compiler/aliasUsageInFunctionExpression_moduleA" +>f : (x: IHasVisualizationModel) => IHasVisualizationModel +>(x) => moduleA : (x: IHasVisualizationModel) => typeof "tests/cases/compiler/aliasUsageInFunctionExpression_moduleA" +>x : IHasVisualizationModel +>moduleA : typeof "tests/cases/compiler/aliasUsageInFunctionExpression_moduleA" + +=== tests/cases/compiler/aliasUsageInFunctionExpression_backbone.ts === +export class Model { +>Model : Model + + public someData: string; +>someData : string +} + +=== tests/cases/compiler/aliasUsageInFunctionExpression_moduleA.ts === +import Backbone = require("aliasUsageInFunctionExpression_backbone"); +>Backbone : typeof "tests/cases/compiler/aliasUsageInFunctionExpression_backbone" + +export class VisualizationModel extends Backbone.Model { +>VisualizationModel : VisualizationModel +>Backbone : Backbone +>Model : Model + + // interesting stuff here +} + diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.types b/tests/baselines/reference/aliasUsageInGenericFunction.types new file mode 100644 index 00000000000..2d357d58ceb --- /dev/null +++ b/tests/baselines/reference/aliasUsageInGenericFunction.types @@ -0,0 +1,63 @@ +=== tests/cases/compiler/aliasUsageInGenericFunction_main.ts === +import Backbone = require("aliasUsageInGenericFunction_backbone"); +>Backbone : typeof "tests/cases/compiler/aliasUsageInGenericFunction_backbone" + +import moduleA = require("aliasUsageInGenericFunction_moduleA"); +>moduleA : typeof "tests/cases/compiler/aliasUsageInGenericFunction_moduleA" + +interface IHasVisualizationModel { +>IHasVisualizationModel : IHasVisualizationModel + + VisualizationModel: typeof Backbone.Model; +>VisualizationModel : typeof Model +>Backbone : typeof "tests/cases/compiler/aliasUsageInGenericFunction_backbone" +>Model : typeof Model +} +function foo(x: T) { +>foo : (x: T) => T +>T : T +>a : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +>x : T +>T : T + + return x; +>x : T +} +var r = foo({ a: moduleA }); +>r : { a: typeof "tests/cases/compiler/aliasUsageInGenericFunction_moduleA"; } +>foo({ a: moduleA }) : { a: typeof "tests/cases/compiler/aliasUsageInGenericFunction_moduleA"; } +>foo : (x: T) => T +>{ a: moduleA } : { a: typeof "tests/cases/compiler/aliasUsageInGenericFunction_moduleA"; } +>a : typeof "tests/cases/compiler/aliasUsageInGenericFunction_moduleA" +>moduleA : moduleA + +var r2 = foo({ a: null }); +>r2 : { a: IHasVisualizationModel; } +>foo({ a: null }) : { a: IHasVisualizationModel; } +>foo : (x: T) => T +>{ a: null } : { a: IHasVisualizationModel; } +>a : IHasVisualizationModel +>null : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel + +=== tests/cases/compiler/aliasUsageInGenericFunction_backbone.ts === +export class Model { +>Model : Model + + public someData: string; +>someData : string +} + +=== tests/cases/compiler/aliasUsageInGenericFunction_moduleA.ts === +import Backbone = require("aliasUsageInGenericFunction_backbone"); +>Backbone : typeof "tests/cases/compiler/aliasUsageInGenericFunction_backbone" + +export class VisualizationModel extends Backbone.Model { +>VisualizationModel : VisualizationModel +>Backbone : Backbone +>Model : Model + + // interesting stuff here +} + diff --git a/tests/baselines/reference/aliasUsageInIndexerOfClass.types b/tests/baselines/reference/aliasUsageInIndexerOfClass.types new file mode 100644 index 00000000000..dab53004c49 --- /dev/null +++ b/tests/baselines/reference/aliasUsageInIndexerOfClass.types @@ -0,0 +1,57 @@ +=== tests/cases/compiler/aliasUsageInIndexerOfClass_main.ts === +import Backbone = require("aliasUsageInIndexerOfClass_backbone"); +>Backbone : typeof "tests/cases/compiler/aliasUsageInIndexerOfClass_backbone" + +import moduleA = require("aliasUsageInIndexerOfClass_moduleA"); +>moduleA : typeof "tests/cases/compiler/aliasUsageInIndexerOfClass_moduleA" + +interface IHasVisualizationModel { +>IHasVisualizationModel : IHasVisualizationModel + + VisualizationModel: typeof Backbone.Model; +>VisualizationModel : typeof Model +>Backbone : typeof "tests/cases/compiler/aliasUsageInIndexerOfClass_backbone" +>Model : typeof Model +} +class N { +>N : N + + [idx: string]: IHasVisualizationModel +>idx : string +>IHasVisualizationModel : IHasVisualizationModel + + x = moduleA; +>x : typeof "tests/cases/compiler/aliasUsageInIndexerOfClass_moduleA" +>moduleA : typeof "tests/cases/compiler/aliasUsageInIndexerOfClass_moduleA" +} +class N2 { +>N2 : N2 + + [idx: string]: typeof moduleA +>idx : string +>moduleA : typeof "tests/cases/compiler/aliasUsageInIndexerOfClass_moduleA" + + x: IHasVisualizationModel; +>x : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +} +=== tests/cases/compiler/aliasUsageInIndexerOfClass_backbone.ts === +export class Model { +>Model : Model + + public someData: string; +>someData : string +} + +=== tests/cases/compiler/aliasUsageInIndexerOfClass_moduleA.ts === +import Backbone = require("aliasUsageInIndexerOfClass_backbone"); +>Backbone : typeof "tests/cases/compiler/aliasUsageInIndexerOfClass_backbone" + +export class VisualizationModel extends Backbone.Model { +>VisualizationModel : VisualizationModel +>Backbone : Backbone +>Model : Model + + // interesting stuff here +} + diff --git a/tests/baselines/reference/aliasUsageInObjectLiteral.types b/tests/baselines/reference/aliasUsageInObjectLiteral.types new file mode 100644 index 00000000000..4fccdbf0c19 --- /dev/null +++ b/tests/baselines/reference/aliasUsageInObjectLiteral.types @@ -0,0 +1,62 @@ +=== tests/cases/compiler/aliasUsageInObjectLiteral_main.ts === +import Backbone = require("aliasUsageInObjectLiteral_backbone"); +>Backbone : typeof "tests/cases/compiler/aliasUsageInObjectLiteral_backbone" + +import moduleA = require("aliasUsageInObjectLiteral_moduleA"); +>moduleA : typeof "tests/cases/compiler/aliasUsageInObjectLiteral_moduleA" + +interface IHasVisualizationModel { +>IHasVisualizationModel : IHasVisualizationModel + + VisualizationModel: typeof Backbone.Model; +>VisualizationModel : typeof Model +>Backbone : typeof "tests/cases/compiler/aliasUsageInObjectLiteral_backbone" +>Model : typeof Model +} +var a: { x: typeof moduleA } = { x: moduleA }; +>a : { x: typeof "tests/cases/compiler/aliasUsageInObjectLiteral_moduleA"; } +>x : typeof "tests/cases/compiler/aliasUsageInObjectLiteral_moduleA" +>moduleA : typeof "tests/cases/compiler/aliasUsageInObjectLiteral_moduleA" +>{ x: moduleA } : { x: typeof "tests/cases/compiler/aliasUsageInObjectLiteral_moduleA"; } +>x : typeof "tests/cases/compiler/aliasUsageInObjectLiteral_moduleA" +>moduleA : moduleA + +var b: { x: IHasVisualizationModel } = { x: moduleA }; +>b : { x: IHasVisualizationModel; } +>x : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +>{ x: moduleA } : { x: typeof "tests/cases/compiler/aliasUsageInObjectLiteral_moduleA"; } +>x : typeof "tests/cases/compiler/aliasUsageInObjectLiteral_moduleA" +>moduleA : moduleA + +var c: { y: { z: IHasVisualizationModel } } = { y: { z: moduleA } }; +>c : { y: { z: IHasVisualizationModel; }; } +>y : { z: IHasVisualizationModel; } +>z : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +>{ y: { z: moduleA } } : { y: { z: typeof "tests/cases/compiler/aliasUsageInObjectLiteral_moduleA"; }; } +>y : { z: typeof "tests/cases/compiler/aliasUsageInObjectLiteral_moduleA"; } +>{ z: moduleA } : { z: typeof "tests/cases/compiler/aliasUsageInObjectLiteral_moduleA"; } +>z : typeof "tests/cases/compiler/aliasUsageInObjectLiteral_moduleA" +>moduleA : moduleA + +=== tests/cases/compiler/aliasUsageInObjectLiteral_backbone.ts === +export class Model { +>Model : Model + + public someData: string; +>someData : string +} + +=== tests/cases/compiler/aliasUsageInObjectLiteral_moduleA.ts === +import Backbone = require("aliasUsageInObjectLiteral_backbone"); +>Backbone : typeof "tests/cases/compiler/aliasUsageInObjectLiteral_backbone" + +export class VisualizationModel extends Backbone.Model { +>VisualizationModel : VisualizationModel +>Backbone : Backbone +>Model : Model + + // interesting stuff here +} + diff --git a/tests/baselines/reference/aliasUsageInOrExpression.types b/tests/baselines/reference/aliasUsageInOrExpression.types new file mode 100644 index 00000000000..45f1fc50302 --- /dev/null +++ b/tests/baselines/reference/aliasUsageInOrExpression.types @@ -0,0 +1,83 @@ +=== tests/cases/compiler/aliasUsageInOrExpression_main.ts === +import Backbone = require("aliasUsageInOrExpression_backbone"); +>Backbone : typeof "tests/cases/compiler/aliasUsageInOrExpression_backbone" + +import moduleA = require("aliasUsageInOrExpression_moduleA"); +>moduleA : typeof "tests/cases/compiler/aliasUsageInOrExpression_moduleA" + +interface IHasVisualizationModel { +>IHasVisualizationModel : IHasVisualizationModel + + VisualizationModel: typeof Backbone.Model; +>VisualizationModel : typeof Model +>Backbone : typeof "tests/cases/compiler/aliasUsageInOrExpression_backbone" +>Model : typeof Model +} +var i: IHasVisualizationModel; +>i : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel + +var d1 = i || moduleA; +>d1 : IHasVisualizationModel +>i || moduleA : IHasVisualizationModel +>i : IHasVisualizationModel +>moduleA : typeof "tests/cases/compiler/aliasUsageInOrExpression_moduleA" + +var d2: IHasVisualizationModel = i || moduleA; +>d2 : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +>i || moduleA : IHasVisualizationModel +>i : IHasVisualizationModel +>moduleA : typeof "tests/cases/compiler/aliasUsageInOrExpression_moduleA" + +var d2: IHasVisualizationModel = moduleA || i; +>d2 : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +>moduleA || i : IHasVisualizationModel +>moduleA : typeof "tests/cases/compiler/aliasUsageInOrExpression_moduleA" +>i : IHasVisualizationModel + +var e: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null || { x: moduleA }; +>e : { x: IHasVisualizationModel; } +>x : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +><{ x: IHasVisualizationModel }>null || { x: moduleA } : { x: IHasVisualizationModel; } +><{ x: IHasVisualizationModel }>null : { x: IHasVisualizationModel; } +>x : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +>{ x: moduleA } : { x: typeof "tests/cases/compiler/aliasUsageInOrExpression_moduleA"; } +>x : typeof "tests/cases/compiler/aliasUsageInOrExpression_moduleA" +>moduleA : moduleA + +var f: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null ? { x: moduleA } : null; +>f : { x: IHasVisualizationModel; } +>x : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +><{ x: IHasVisualizationModel }>null ? { x: moduleA } : null : { x: IHasVisualizationModel; } +><{ x: IHasVisualizationModel }>null : { x: IHasVisualizationModel; } +>x : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +>{ x: moduleA } : { x: typeof "tests/cases/compiler/aliasUsageInOrExpression_moduleA"; } +>x : typeof "tests/cases/compiler/aliasUsageInOrExpression_moduleA" +>moduleA : moduleA + +=== tests/cases/compiler/aliasUsageInOrExpression_backbone.ts === +export class Model { +>Model : Model + + public someData: string; +>someData : string +} + +=== tests/cases/compiler/aliasUsageInOrExpression_moduleA.ts === +import Backbone = require("aliasUsageInOrExpression_backbone"); +>Backbone : typeof "tests/cases/compiler/aliasUsageInOrExpression_backbone" + +export class VisualizationModel extends Backbone.Model { +>VisualizationModel : VisualizationModel +>Backbone : Backbone +>Model : Model + + // interesting stuff here +} + diff --git a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.types b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.types new file mode 100644 index 00000000000..808a1d7e83b --- /dev/null +++ b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.types @@ -0,0 +1,53 @@ +=== tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_main.ts === +import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone"); +>Backbone : typeof "tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_backbone" + +import moduleA = require("aliasUsageInTypeArgumentOfExtendsClause_moduleA"); +>moduleA : typeof "tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_moduleA" + +interface IHasVisualizationModel { +>IHasVisualizationModel : IHasVisualizationModel + + VisualizationModel: typeof Backbone.Model; +>VisualizationModel : typeof Model +>Backbone : typeof "tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_backbone" +>Model : typeof Model +} +class C { +>C : C +>T : T +>IHasVisualizationModel : IHasVisualizationModel + + x: T; +>x : T +>T : T +} +class D extends C { +>D : D +>C : C +>IHasVisualizationModel : IHasVisualizationModel + + x = moduleA; +>x : typeof "tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_moduleA" +>moduleA : typeof "tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_moduleA" +} +=== tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_backbone.ts === +export class Model { +>Model : Model + + public someData: string; +>someData : string +} + +=== tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts === +import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone"); +>Backbone : typeof "tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_backbone" + +export class VisualizationModel extends Backbone.Model { +>VisualizationModel : VisualizationModel +>Backbone : Backbone +>Model : Model + + // interesting stuff here +} + diff --git a/tests/baselines/reference/aliasUsageInVarAssignment.types b/tests/baselines/reference/aliasUsageInVarAssignment.types new file mode 100644 index 00000000000..a258652d6c9 --- /dev/null +++ b/tests/baselines/reference/aliasUsageInVarAssignment.types @@ -0,0 +1,44 @@ +=== tests/cases/compiler/aliasUsageInVarAssignment_main.ts === +import Backbone = require("aliasUsageInVarAssignment_backbone"); +>Backbone : typeof "tests/cases/compiler/aliasUsageInVarAssignment_backbone" + +import moduleA = require("aliasUsageInVarAssignment_moduleA"); +>moduleA : typeof "tests/cases/compiler/aliasUsageInVarAssignment_moduleA" + +interface IHasVisualizationModel { +>IHasVisualizationModel : IHasVisualizationModel + + VisualizationModel: typeof Backbone.Model; +>VisualizationModel : typeof Model +>Backbone : typeof "tests/cases/compiler/aliasUsageInVarAssignment_backbone" +>Model : typeof Model +} +var i: IHasVisualizationModel; +>i : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel + +var m: typeof moduleA = i; +>m : typeof "tests/cases/compiler/aliasUsageInVarAssignment_moduleA" +>moduleA : typeof "tests/cases/compiler/aliasUsageInVarAssignment_moduleA" +>i : IHasVisualizationModel + +=== tests/cases/compiler/aliasUsageInVarAssignment_backbone.ts === +export class Model { +>Model : Model + + public someData: string; +>someData : string +} + +=== tests/cases/compiler/aliasUsageInVarAssignment_moduleA.ts === +import Backbone = require("aliasUsageInVarAssignment_backbone"); +>Backbone : typeof "tests/cases/compiler/aliasUsageInVarAssignment_backbone" + +export class VisualizationModel extends Backbone.Model { +>VisualizationModel : VisualizationModel +>Backbone : Backbone +>Model : Model + + // interesting stuff here +} + diff --git a/tests/baselines/reference/aliasUsedAsNameValue.types b/tests/baselines/reference/aliasUsedAsNameValue.types new file mode 100644 index 00000000000..3eebbdce7fd --- /dev/null +++ b/tests/baselines/reference/aliasUsedAsNameValue.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/aliasUsedAsNameValue_2.ts === +/// +/// +import mod = require("aliasUsedAsNameValue_0"); +>mod : typeof "tests/cases/compiler/aliasUsedAsNameValue_0" + +import b = require("aliasUsedAsNameValue_1"); +>b : typeof "tests/cases/compiler/aliasUsedAsNameValue_1" + +export var a = function () { +>a : () => void +>function () { + //var x = mod.id; // TODO needed hack that mod is loaded + b.b(mod); +} : () => void + + //var x = mod.id; // TODO needed hack that mod is loaded + b.b(mod); +>b.b(mod) : any +>b.b : (a: any) => any +>b : typeof "tests/cases/compiler/aliasUsedAsNameValue_1" +>b : (a: any) => any +>mod : typeof "tests/cases/compiler/aliasUsedAsNameValue_0" +} + +=== tests/cases/compiler/aliasUsedAsNameValue_0.ts === +export var id: number; +>id : number + +=== tests/cases/compiler/aliasUsedAsNameValue_1.ts === +export function b(a: any): any { return null; } +>b : (a: any) => any +>a : any + diff --git a/tests/baselines/reference/ambientClassDeclarationWithExtends.types b/tests/baselines/reference/ambientClassDeclarationWithExtends.types new file mode 100644 index 00000000000..7609856882b --- /dev/null +++ b/tests/baselines/reference/ambientClassDeclarationWithExtends.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/ambientClassDeclarationWithExtends.ts === +declare class A { } +>A : A + +declare class B extends A { } +>B : B +>A : A + diff --git a/tests/baselines/reference/ambientDeclarations.types b/tests/baselines/reference/ambientDeclarations.types new file mode 100644 index 00000000000..38814405521 --- /dev/null +++ b/tests/baselines/reference/ambientDeclarations.types @@ -0,0 +1,168 @@ +=== tests/cases/conformance/ambient/ambientDeclarations.ts === +// Ambient variable without type annotation +declare var n; +>n : any + +// Ambient variable with type annotation +declare var m: string; +>m : string + +// Ambient function with no type annotations +declare function fn1(); +>fn1 : () => any + +// Ambient function with type annotations +declare function fn2(n: string): number; +>fn2 : (n: string) => number +>n : string + +// Ambient function with valid overloads +declare function fn3(n: string): number; +>fn3 : (n: string) => number +>n : string + +declare function fn4(n: number, y: number): string; +>fn4 : (n: number, y: number) => string +>n : number +>y : number + +// Ambient function with optional parameters +declare function fn5(x, y?); +>fn5 : (x: any, y?: any) => any +>x : any +>y : any + +declare function fn6(e?); +>fn6 : (e?: any) => any +>e : any + +declare function fn7(x, y?, ...z); +>fn7 : (x: any, y?: any, ...z: any[]) => any +>x : any +>y : any +>z : any[] + +declare function fn8(y?, ...z: number[]); +>fn8 : (y?: any, ...z: number[]) => any +>y : any +>z : number[] + +declare function fn9(...q: {}[]); +>fn9 : (...q: {}[]) => any +>q : {}[] + +declare function fn10(...q: T[]); +>fn10 : (...q: T[]) => any +>T : T +>q : T[] +>T : T + +// Ambient class +declare class cls { +>cls : cls + + constructor(); + method(): cls; +>method : () => cls +>cls : cls + + static static(p): number; +>static : (p: any) => number +>p : any + + static q; +>q : any + + private fn(); +>fn : () => any + + private static fns(); +>fns : () => any +} + +// Ambient enum +declare enum E1 { +>E1 : E1 + + x, +>x : E1 + + y, +>y : E1 + + z +>z : E1 +} + +// Ambient enum with integer literal initializer +declare enum E2 { +>E2 : E2 + + q, +>q : E2 + + a = 1, +>a : E2 + + b, +>b : E2 + + c = 2, +>c : E2 + + d +>d : E2 +} + +// Ambient enum members are always exported with or without export keyword +declare enum E3 { +>E3 : E3 + + A +>A : E3 +} +declare module E3 { +>E3 : typeof E3 + + var B; +>B : any +} +var x = E3.B; +>x : any +>E3.B : any +>E3 : typeof E3 +>B : any + +// Ambient module +declare module M1 { +>M1 : typeof M1 + + var x; +>x : any + + function fn(): number; +>fn : () => number +} + +// Ambient module members are always exported with or without export keyword +var p = M1.x; +>p : any +>M1.x : any +>M1 : typeof M1 +>x : any + +var q = M1.fn(); +>q : number +>M1.fn() : number +>M1.fn : () => number +>M1 : typeof M1 +>fn : () => number + +// Ambient external module in the global module +// Ambient external module with a string literal name that is a top level external module name +declare module 'external1' { + var q; +>q : any +} + + diff --git a/tests/baselines/reference/ambientEnumElementInitializer1.types b/tests/baselines/reference/ambientEnumElementInitializer1.types new file mode 100644 index 00000000000..da80015cbd5 --- /dev/null +++ b/tests/baselines/reference/ambientEnumElementInitializer1.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/ambientEnumElementInitializer1.ts === +declare enum E { +>E : E + + e = 3 +>e : E +} diff --git a/tests/baselines/reference/ambientEnumElementInitializer2.types b/tests/baselines/reference/ambientEnumElementInitializer2.types new file mode 100644 index 00000000000..cb1414630b9 --- /dev/null +++ b/tests/baselines/reference/ambientEnumElementInitializer2.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/ambientEnumElementInitializer2.ts === +declare enum E { +>E : E + + e = -3 // Negative +>e : E +>-3 : number +} diff --git a/tests/baselines/reference/ambientEnumElementInitializer4.types b/tests/baselines/reference/ambientEnumElementInitializer4.types new file mode 100644 index 00000000000..566c03103a1 --- /dev/null +++ b/tests/baselines/reference/ambientEnumElementInitializer4.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/ambientEnumElementInitializer4.ts === +declare enum E { +>E : E + + e = 0xA +>e : E +} diff --git a/tests/baselines/reference/ambientEnumElementInitializer5.types b/tests/baselines/reference/ambientEnumElementInitializer5.types new file mode 100644 index 00000000000..3b6198f0e24 --- /dev/null +++ b/tests/baselines/reference/ambientEnumElementInitializer5.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/ambientEnumElementInitializer5.ts === +declare enum E { +>E : E + + e = -0xA +>e : E +>-0xA : number +} diff --git a/tests/baselines/reference/ambientEnumElementInitializer6.types b/tests/baselines/reference/ambientEnumElementInitializer6.types new file mode 100644 index 00000000000..3a38fd6912d --- /dev/null +++ b/tests/baselines/reference/ambientEnumElementInitializer6.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/ambientEnumElementInitializer6.ts === +declare module M { +>M : typeof M + + enum E { +>E : E + + e = 3 +>e : E + } +} diff --git a/tests/baselines/reference/ambientExternalModuleReopen.types b/tests/baselines/reference/ambientExternalModuleReopen.types new file mode 100644 index 00000000000..842d634344c --- /dev/null +++ b/tests/baselines/reference/ambientExternalModuleReopen.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/ambientExternalModuleReopen.ts === +declare module "fs" { + var x: string; +>x : string +} +declare module 'fs' { + var y: number; +>y : number +} diff --git a/tests/baselines/reference/ambientExternalModuleWithInternalImportDeclaration.types b/tests/baselines/reference/ambientExternalModuleWithInternalImportDeclaration.types new file mode 100644 index 00000000000..ae37e5b7581 --- /dev/null +++ b/tests/baselines/reference/ambientExternalModuleWithInternalImportDeclaration.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/ambientExternalModuleWithInternalImportDeclaration_1.ts === +/// +import A = require('M'); +>A : typeof C + +var c = new A(); +>c : C +>new A() : C +>A : typeof C + +=== tests/cases/compiler/ambientExternalModuleWithInternalImportDeclaration_0.ts === +declare module 'M' { + module C { +>C : typeof C + + export var f: number; +>f : number + } + class C { +>C : C + + foo(): void; +>foo : () => void + } + import X = C; +>X : typeof C +>C : C + + export = X; +>X : C + +} + diff --git a/tests/baselines/reference/ambientExternalModuleWithoutInternalImportDeclaration.types b/tests/baselines/reference/ambientExternalModuleWithoutInternalImportDeclaration.types new file mode 100644 index 00000000000..d23f33402bc --- /dev/null +++ b/tests/baselines/reference/ambientExternalModuleWithoutInternalImportDeclaration.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/ambientExternalModuleWithoutInternalImportDeclaration_1.ts === +/// +import A = require('M'); +>A : typeof C + +var c = new A(); +>c : C +>new A() : C +>A : typeof C + +=== tests/cases/compiler/ambientExternalModuleWithoutInternalImportDeclaration_0.ts === +declare module 'M' { + module C { +>C : typeof C + + export var f: number; +>f : number + } + class C { +>C : C + + foo(): void; +>foo : () => void + } + export = C; +>C : C + +} + diff --git a/tests/baselines/reference/ambientFundule.types b/tests/baselines/reference/ambientFundule.types new file mode 100644 index 00000000000..edd2290859c --- /dev/null +++ b/tests/baselines/reference/ambientFundule.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/ambientFundule.ts === +declare function f(); +>f : typeof f + +declare module f { var x } +>f : typeof f +>x : any + +declare function f(x); +>f : typeof f +>x : any + diff --git a/tests/baselines/reference/ambientModuleExports.types b/tests/baselines/reference/ambientModuleExports.types new file mode 100644 index 00000000000..bb964bd3927 --- /dev/null +++ b/tests/baselines/reference/ambientModuleExports.types @@ -0,0 +1,63 @@ +=== tests/cases/compiler/ambientModuleExports.ts === +declare module Foo { +>Foo : typeof Foo + + function a():void; +>a : () => void + + var b:number; +>b : number + + class C {} +>C : C +} + +Foo.a(); +>Foo.a() : void +>Foo.a : () => void +>Foo : typeof Foo +>a : () => void + +Foo.b; +>Foo.b : number +>Foo : typeof Foo +>b : number + +var c = new Foo.C(); +>c : C +>new Foo.C() : C +>Foo.C : typeof C +>Foo : typeof Foo +>C : typeof C + +declare module Foo2 { +>Foo2 : typeof Foo2 + + export function a(): void; +>a : () => void + + export var b: number; +>b : number + + export class C { } +>C : C +} + +Foo2.a(); +>Foo2.a() : void +>Foo2.a : () => void +>Foo2 : typeof Foo2 +>a : () => void + +Foo2.b; +>Foo2.b : number +>Foo2 : typeof Foo2 +>b : number + +var c2 = new Foo2.C(); +>c2 : C +>new Foo2.C() : C +>Foo2.C : typeof C +>Foo2 : typeof Foo2 +>C : typeof C + diff --git a/tests/baselines/reference/ambientModuleWithClassDeclarationWithExtends.types b/tests/baselines/reference/ambientModuleWithClassDeclarationWithExtends.types new file mode 100644 index 00000000000..2708946518f --- /dev/null +++ b/tests/baselines/reference/ambientModuleWithClassDeclarationWithExtends.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/ambientModuleWithClassDeclarationWithExtends.ts === +declare module foo { +>foo : typeof foo + + class A { } +>A : A + + class B extends A { } +>B : B +>A : A +} diff --git a/tests/baselines/reference/ambientModules.types b/tests/baselines/reference/ambientModules.types new file mode 100644 index 00000000000..da6d3b77201 --- /dev/null +++ b/tests/baselines/reference/ambientModules.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/ambientModules.ts === +declare module Foo.Bar { export var foo; }; +>Foo : typeof Foo +>Bar : typeof Bar +>foo : any + +Foo.Bar.foo = 5; +>Foo.Bar.foo = 5 : number +>Foo.Bar.foo : any +>Foo.Bar : typeof Bar +>Foo : typeof Foo +>Bar : typeof Bar +>foo : any + diff --git a/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.types b/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.types new file mode 100644 index 00000000000..4e508ba2df5 --- /dev/null +++ b/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.types @@ -0,0 +1,78 @@ +=== tests/cases/compiler/ambiguousCallsWhereReturnTypesAgree.ts === +class TestClass { +>TestClass : TestClass + + public bar(x: string): void; +>bar : { (x: string): void; (x: string[]): void; } +>x : string + + public bar(x: string[]): void; +>bar : { (x: string): void; (x: string[]): void; } +>x : string[] + + public bar(x: any): void { +>bar : { (x: string): void; (x: string[]): void; } +>x : any + + } + + public foo(x: string): void; +>foo : { (x: string): void; (x: string[]): void; } +>x : string + + public foo(x: string[]): void; +>foo : { (x: string): void; (x: string[]): void; } +>x : string[] + + public foo(x: any): void { +>foo : { (x: string): void; (x: string[]): void; } +>x : any + + this.bar(x); // should not error +>this.bar(x) : void +>this.bar : { (x: string): void; (x: string[]): void; } +>this : TestClass +>bar : { (x: string): void; (x: string[]): void; } +>x : any + } +} + +class TestClass2 { +>TestClass2 : TestClass2 + + public bar(x: string): number; +>bar : { (x: string): number; (x: string[]): number; } +>x : string + + public bar(x: string[]): number; +>bar : { (x: string): number; (x: string[]): number; } +>x : string[] + + public bar(x: any): number { +>bar : { (x: string): number; (x: string[]): number; } +>x : any + + return 0; + } + + public foo(x: string): number; +>foo : { (x: string): number; (x: string[]): number; } +>x : string + + public foo(x: string[]): number; +>foo : { (x: string): number; (x: string[]): number; } +>x : string[] + + public foo(x: any): number { +>foo : { (x: string): number; (x: string[]): number; } +>x : any + + return this.bar(x); // should not error +>this.bar(x) : number +>this.bar : { (x: string): number; (x: string[]): number; } +>this : TestClass2 +>bar : { (x: string): number; (x: string[]): number; } +>x : any + } +} + diff --git a/tests/baselines/reference/ambiguousOverloadResolution.types b/tests/baselines/reference/ambiguousOverloadResolution.types new file mode 100644 index 00000000000..dd42b44d7c3 --- /dev/null +++ b/tests/baselines/reference/ambiguousOverloadResolution.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/ambiguousOverloadResolution.ts === +class A { } +>A : A + +class B extends A { x: number; } +>B : B +>A : A +>x : number + +declare function f(p: A, q: B): number; +>f : { (p: A, q: B): number; (p: B, q: A): string; } +>p : A +>A : A +>q : B +>B : B + +declare function f(p: B, q: A): string; +>f : { (p: A, q: B): number; (p: B, q: A): string; } +>p : B +>B : B +>q : A +>A : A + +var x: B; +>x : B +>B : B + +var t: number = f(x, x); // Not an error +>t : number +>f(x, x) : number +>f : { (p: A, q: B): number; (p: B, q: A): string; } +>x : B +>x : B + diff --git a/tests/baselines/reference/amdImportAsPrimaryExpression.types b/tests/baselines/reference/amdImportAsPrimaryExpression.types new file mode 100644 index 00000000000..ac2f63709df --- /dev/null +++ b/tests/baselines/reference/amdImportAsPrimaryExpression.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/externalModules/foo_1.ts === +import foo = require("./foo_0"); +>foo : typeof "tests/cases/conformance/externalModules/foo_0" + +if(foo.E1.A === 0){ +>foo.E1.A === 0 : boolean +>foo.E1.A : E1 +>foo.E1 : typeof E1 +>foo : typeof "tests/cases/conformance/externalModules/foo_0" +>E1 : typeof E1 +>A : E1 + + // Should cause runtime import - interesting optimization possibility, as gets inlined to 0. +} + +=== tests/cases/conformance/externalModules/foo_0.ts === +export enum E1 { +>E1 : E1 + + A,B,C +>A : E1 +>B : E1 +>C : E1 +} + diff --git a/tests/baselines/reference/amdImportNotAsPrimaryExpression.types b/tests/baselines/reference/amdImportNotAsPrimaryExpression.types new file mode 100644 index 00000000000..a3d30f3d03c --- /dev/null +++ b/tests/baselines/reference/amdImportNotAsPrimaryExpression.types @@ -0,0 +1,82 @@ +=== tests/cases/conformance/externalModules/foo_1.ts === +import foo = require("./foo_0"); +>foo : typeof "tests/cases/conformance/externalModules/foo_0" + +// None of the below should cause a runtime dependency on foo_0 +import f = foo.M1; +>f : f +>foo : foo +>M1 : M1 + +var i: f.I2; +>i : I2 +>f : f +>I2 : I2 + +var x: foo.C1 = <{m1: number}>{}; +>x : C1 +>foo : foo +>C1 : C1 +><{m1: number}>{} : { m1: number; } +>m1 : number +>{} : {} + +var y: typeof foo.C1.s1 = false; +>y : boolean +>foo : typeof "tests/cases/conformance/externalModules/foo_0" +>C1 : typeof C1 +>s1 : boolean + +var z: foo.M1.I2; +>z : I2 +>foo : foo +>M1 : M1 +>I2 : I2 + +var e: number = 0; +>e : number +>0 : E1 +>foo : foo +>E1 : E1 + +=== tests/cases/conformance/externalModules/foo_0.ts === +export class C1 { +>C1 : C1 + + m1 = 42; +>m1 : number + + static s1 = true; +>s1 : boolean +} + +export interface I1 { +>I1 : I1 + + name: string; +>name : string + + age: number; +>age : number +} + +export module M1 { +>M1 : M1 + + export interface I2 { +>I2 : I2 + + foo: string; +>foo : string + } +} + +export enum E1 { +>E1 : E1 + + A,B,C +>A : E1 +>B : E1 +>C : E1 +} + diff --git a/tests/baselines/reference/anonterface.types b/tests/baselines/reference/anonterface.types new file mode 100644 index 00000000000..b71f7526b3f --- /dev/null +++ b/tests/baselines/reference/anonterface.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/anonterface.ts === +module M { +>M : typeof M + + export class C { +>C : C + + m(fn:{ (n:number):string; },n2:number):string { +>m : (fn: (n: number) => string, n2: number) => string +>fn : (n: number) => string +>n : number +>n2 : number + + return fn(n2); +>fn(n2) : string +>fn : (n: number) => string +>n2 : number + } + } +} + +var c=new M.C(); +>c : C +>new M.C() : C +>M.C : typeof C +>M : typeof M +>C : typeof C + +c.m(function(n) { return "hello: "+n; },18); +>c.m(function(n) { return "hello: "+n; },18) : string +>c.m : (fn: (n: number) => string, n2: number) => string +>c : C +>m : (fn: (n: number) => string, n2: number) => string +>function(n) { return "hello: "+n; } : (n: number) => string +>n : number +>"hello: "+n : string +>n : number + + + + diff --git a/tests/baselines/reference/anyAsFunctionCall.types b/tests/baselines/reference/anyAsFunctionCall.types new file mode 100644 index 00000000000..6492dce37d2 --- /dev/null +++ b/tests/baselines/reference/anyAsFunctionCall.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/types/any/anyAsFunctionCall.ts === +// any is considered an untyped function call +// can be called except with type arguments which is an error + +var x: any; +>x : any + +var a = x(); +>a : any +>x() : any +>x : any + +var b = x('hello'); +>b : any +>x('hello') : any +>x : any + +var c = x(x); +>c : any +>x(x) : any +>x : any +>x : any + diff --git a/tests/baselines/reference/anyAsReturnTypeForNewOnCall.types b/tests/baselines/reference/anyAsReturnTypeForNewOnCall.types new file mode 100644 index 00000000000..f25cd57831b --- /dev/null +++ b/tests/baselines/reference/anyAsReturnTypeForNewOnCall.types @@ -0,0 +1,35 @@ +=== tests/cases/compiler/anyAsReturnTypeForNewOnCall.ts === +function Point(x, y) { +>Point : (x: any, y: any) => void +>x : any +>y : any + + this.x = x; +>this.x = x : any +>this.x : any +>this : any +>x : any +>x : any + + this.y = y; +>this.y = y : any +>this.y : any +>this : any +>y : any +>y : any + +} + +var o = new Point(3, 4); +>o : any +>new Point(3, 4) : any +>Point : (x: any, y: any) => void + +var xx = o.x; +>xx : any +>o.x : any +>o : any +>x : any + + + diff --git a/tests/baselines/reference/anyAssignabilityInInheritance.types b/tests/baselines/reference/anyAssignabilityInInheritance.types new file mode 100644 index 00000000000..f80d66f7eaa --- /dev/null +++ b/tests/baselines/reference/anyAssignabilityInInheritance.types @@ -0,0 +1,321 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance.ts === +// any is not a subtype of any other types, errors expected on all the below derived classes unless otherwise noted + +interface I { +>I : I + + [x: string]: any; +>x : string + + foo: any; // ok, any identical to itself +>foo : any +} + +var a: any; +>a : any + +declare function foo2(x: number): number; +>foo2 : { (x: number): number; (x: any): any; } +>x : number + +declare function foo2(x: any): any; +>foo2 : { (x: number): number; (x: any): any; } +>x : any + +var r3 = foo2(a); // any, not a subtype of number so it skips that overload, is a subtype of itself so it picks second (if truly ambiguous it would pick first overload) +>r3 : any +>foo2(a) : any +>foo2 : { (x: number): number; (x: any): any; } +>a : any + +declare function foo3(x: string): string; +>foo3 : { (x: string): string; (x: any): any; } +>x : string + +declare function foo3(x: any): any; +>foo3 : { (x: string): string; (x: any): any; } +>x : any + +var r3 = foo3(a); // any +>r3 : any +>foo3(a) : any +>foo3 : { (x: string): string; (x: any): any; } +>a : any + +declare function foo4(x: boolean): boolean; +>foo4 : { (x: boolean): boolean; (x: any): any; } +>x : boolean + +declare function foo4(x: any): any; +>foo4 : { (x: boolean): boolean; (x: any): any; } +>x : any + +var r3 = foo3(a); // any +>r3 : any +>foo3(a) : any +>foo3 : { (x: string): string; (x: any): any; } +>a : any + +declare function foo5(x: Date): Date; +>foo5 : { (x: Date): Date; (x: any): any; } +>x : Date +>Date : Date +>Date : Date + +declare function foo5(x: any): any; +>foo5 : { (x: Date): Date; (x: any): any; } +>x : any + +var r3 = foo3(a); // any +>r3 : any +>foo3(a) : any +>foo3 : { (x: string): string; (x: any): any; } +>a : any + +declare function foo6(x: RegExp): RegExp; +>foo6 : { (x: RegExp): RegExp; (x: any): any; } +>x : RegExp +>RegExp : RegExp +>RegExp : RegExp + +declare function foo6(x: any): any; +>foo6 : { (x: RegExp): RegExp; (x: any): any; } +>x : any + +var r3 = foo3(a); // any +>r3 : any +>foo3(a) : any +>foo3 : { (x: string): string; (x: any): any; } +>a : any + +declare function foo7(x: { bar: number }): { bar: number }; +>foo7 : { (x: { bar: number; }): { bar: number; }; (x: any): any; } +>x : { bar: number; } +>bar : number +>bar : number + +declare function foo7(x: any): any; +>foo7 : { (x: { bar: number; }): { bar: number; }; (x: any): any; } +>x : any + +var r3 = foo3(a); // any +>r3 : any +>foo3(a) : any +>foo3 : { (x: string): string; (x: any): any; } +>a : any + +declare function foo8(x: number[]): number[]; +>foo8 : { (x: number[]): number[]; (x: any): any; } +>x : number[] + +declare function foo8(x: any): any; +>foo8 : { (x: number[]): number[]; (x: any): any; } +>x : any + +var r3 = foo3(a); // any +>r3 : any +>foo3(a) : any +>foo3 : { (x: string): string; (x: any): any; } +>a : any + +interface I8 { foo: string } +>I8 : I8 +>foo : string + +declare function foo9(x: I8): I8; +>foo9 : { (x: I8): I8; (x: any): any; } +>x : I8 +>I8 : I8 +>I8 : I8 + +declare function foo9(x: any): any; +>foo9 : { (x: I8): I8; (x: any): any; } +>x : any + +var r3 = foo3(a); // any +>r3 : any +>foo3(a) : any +>foo3 : { (x: string): string; (x: any): any; } +>a : any + +class A { foo: number; } +>A : A +>foo : number + +declare function foo10(x: A): A; +>foo10 : { (x: A): A; (x: any): any; } +>x : A +>A : A +>A : A + +declare function foo10(x: any): any; +>foo10 : { (x: A): A; (x: any): any; } +>x : any + +var r3 = foo3(a); // any +>r3 : any +>foo3(a) : any +>foo3 : { (x: string): string; (x: any): any; } +>a : any + +class A2 { foo: T; } +>A2 : A2 +>T : T +>foo : T +>T : T + +declare function foo11(x: A2): A2; +>foo11 : { (x: A2): A2; (x: any): any; } +>x : A2 +>A2 : A2 +>A2 : A2 + +declare function foo11(x: any): any; +>foo11 : { (x: A2): A2; (x: any): any; } +>x : any + +var r3 = foo3(a); // any +>r3 : any +>foo3(a) : any +>foo3 : { (x: string): string; (x: any): any; } +>a : any + +declare function foo12(x: (x) => number): (x) => number; +>foo12 : { (x: (x: any) => number): (x: any) => number; (x: any): any; } +>x : (x: any) => number +>x : any +>x : any + +declare function foo12(x: any): any; +>foo12 : { (x: (x: any) => number): (x: any) => number; (x: any): any; } +>x : any + +var r3 = foo3(a); // any +>r3 : any +>foo3(a) : any +>foo3 : { (x: string): string; (x: any): any; } +>a : any + +declare function foo13(x: (x: T) => T): (x: T) => T; +>foo13 : { (x: (x: T) => T): (x: T) => T; (x: any): any; } +>x : (x: T) => T +>T : T +>x : T +>T : T +>T : T +>T : T +>x : T +>T : T +>T : T + +declare function foo13(x: any): any; +>foo13 : { (x: (x: T) => T): (x: T) => T; (x: any): any; } +>x : any + +var r3 = foo3(a); // any +>r3 : any +>foo3(a) : any +>foo3 : { (x: string): string; (x: any): any; } +>a : any + +enum E { A } +>E : E +>A : E + +declare function foo14(x: E): E; +>foo14 : { (x: E): E; (x: any): any; } +>x : E +>E : E +>E : E + +declare function foo14(x: any): any; +>foo14 : { (x: E): E; (x: any): any; } +>x : any + +var r3 = foo3(a); // any +>r3 : any +>foo3(a) : any +>foo3 : { (x: string): string; (x: any): any; } +>a : any + +function f() { } +>f : typeof f + +module f { +>f : typeof f + + export var bar = 1; +>bar : number +} +declare function foo15(x: typeof f): typeof f; +>foo15 : { (x: typeof f): typeof f; (x: any): any; } +>x : typeof f +>f : typeof f +>f : typeof f + +declare function foo15(x: any): any; +>foo15 : { (x: typeof f): typeof f; (x: any): any; } +>x : any + +var r3 = foo3(a); // any +>r3 : any +>foo3(a) : any +>foo3 : { (x: string): string; (x: any): any; } +>a : any + +class CC { baz: string } +>CC : CC +>baz : string + +module CC { +>CC : typeof CC + + export var bar = 1; +>bar : number +} +declare function foo16(x: CC): CC; +>foo16 : { (x: CC): CC; (x: any): any; } +>x : CC +>CC : CC +>CC : CC + +declare function foo16(x: any): any; +>foo16 : { (x: CC): CC; (x: any): any; } +>x : any + +var r3 = foo3(a); // any +>r3 : any +>foo3(a) : any +>foo3 : { (x: string): string; (x: any): any; } +>a : any + +declare function foo17(x: Object): Object; +>foo17 : { (x: Object): Object; (x: any): any; } +>x : Object +>Object : Object +>Object : Object + +declare function foo17(x: any): any; +>foo17 : { (x: Object): Object; (x: any): any; } +>x : any + +var r3 = foo3(a); // any +>r3 : any +>foo3(a) : any +>foo3 : { (x: string): string; (x: any): any; } +>a : any + +declare function foo18(x: {}): {}; +>foo18 : { (x: {}): {}; (x: any): any; } +>x : {} + +declare function foo18(x: any): any; +>foo18 : { (x: {}): {}; (x: any): any; } +>x : any + +var r3 = foo3(a); // any +>r3 : any +>foo3(a) : any +>foo3 : { (x: string): string; (x: any): any; } +>a : any + diff --git a/tests/baselines/reference/anyAssignableToEveryType.types b/tests/baselines/reference/anyAssignableToEveryType.types new file mode 100644 index 00000000000..c2a9b324d96 --- /dev/null +++ b/tests/baselines/reference/anyAssignableToEveryType.types @@ -0,0 +1,156 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType.ts === +var a: any; +>a : any + +class C { +>C : C + + foo: string; +>foo : string +} +var ac: C; +>ac : C +>C : C + +interface I { +>I : I + + foo: string; +>foo : string +} +var ai: I; +>ai : I +>I : I + +enum E { A } +>E : E +>A : E + +var ae: E; +>ae : E +>E : E + +var b: number = a; +>b : number +>a : any + +var c: string = a; +>c : string +>a : any + +var d: boolean = a; +>d : boolean +>a : any + +var e: Date = a; +>e : Date +>Date : Date +>a : any + +var f: any = a; +>f : any +>a : any + +var g: void = a; +>g : void +>a : any + +var h: Object = a; +>h : Object +>Object : Object +>a : any + +var i: {} = a; +>i : {} +>a : any + +var j: () => {} = a; +>j : () => {} +>a : any + +var k: Function = a; +>k : Function +>Function : Function +>a : any + +var l: (x: number) => string = a; +>l : (x: number) => string +>x : number +>a : any + +ac = a; +>ac = a : any +>ac : C +>a : any + +ai = a; +>ai = a : any +>ai : I +>a : any + +ae = a; +>ae = a : any +>ae : E +>a : any + +var m: number[] = a; +>m : number[] +>a : any + +var n: { foo: string } = a; +>n : { foo: string; } +>foo : string +>a : any + +var o: (x: T) => T = a; +>o : (x: T) => T +>T : T +>x : T +>T : T +>T : T +>a : any + +var p: Number = a; +>p : Number +>Number : Number +>a : any + +var q: String = a; +>q : String +>String : String +>a : any + +function foo(x: T, y: U, z: V) { +>foo : (x: T, y: U, z: V) => void +>T : T +>U : U +>V : V +>Date : Date +>x : T +>T : T +>y : U +>U : U +>z : V +>V : V + + x = a; +>x = a : any +>x : T +>a : any + + y = a; +>y = a : any +>y : U +>a : any + + z = a; +>z = a : any +>z : V +>a : any +} + +//function foo(x: T, y: U, z: V) { +// x = a; +// y = a; +// z = a; +//} diff --git a/tests/baselines/reference/anyInferenceAnonymousFunctions.types b/tests/baselines/reference/anyInferenceAnonymousFunctions.types new file mode 100644 index 00000000000..ac249f83414 --- /dev/null +++ b/tests/baselines/reference/anyInferenceAnonymousFunctions.types @@ -0,0 +1,93 @@ +=== tests/cases/compiler/anyInferenceAnonymousFunctions.ts === +var paired: any[]; +>paired : any[] + +paired.reduce(function (a1, a2) { +>paired.reduce(function (a1, a2) { + + return a1.concat({}); + +} , []) : any +>paired.reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; (callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; } +>paired : any[] +>reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; (callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; } +>function (a1, a2) { + + return a1.concat({}); + +} : (a1: any, a2: any) => any +>a1 : any +>a2 : any + + return a1.concat({}); +>a1.concat({}) : any +>a1.concat : any +>a1 : any +>concat : any +>{} : {} + +} , []); +>[] : undefined[] + +paired.reduce((b1, b2) => { +>paired.reduce((b1, b2) => { + + return b1.concat({}); +} , []) : any +>paired.reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; (callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; } +>paired : any[] +>reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; (callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; } +>(b1, b2) => { + + return b1.concat({}); +} : (b1: any, b2: any) => any +>b1 : any +>b2 : any + + return b1.concat({}); +>b1.concat({}) : any +>b1.concat : any +>b1 : any +>concat : any +>{} : {} + +} , []); +>[] : undefined[] + +paired.reduce((b3, b4) => b3.concat({}), []); +>paired.reduce((b3, b4) => b3.concat({}), []) : any +>paired.reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; (callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; } +>paired : any[] +>reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; (callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; } +>(b3, b4) => b3.concat({}) : (b3: any, b4: any) => any +>b3 : any +>b4 : any +>b3.concat({}) : any +>b3.concat : any +>b3 : any +>concat : any +>{} : {} +>[] : undefined[] + +paired.map((c1) => c1.count); +>paired.map((c1) => c1.count) : any[] +>paired.map : (callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[] +>paired : any[] +>map : (callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[] +>(c1) => c1.count : (c1: any) => any +>c1 : any +>c1.count : any +>c1 : any +>count : any + +paired.map(function (c2) { return c2.count; }); +>paired.map(function (c2) { return c2.count; }) : any[] +>paired.map : (callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[] +>paired : any[] +>map : (callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[] +>function (c2) { return c2.count; } : (c2: any) => any +>c2 : any +>c2.count : any +>c2 : any +>count : any + diff --git a/tests/baselines/reference/anyIsAssignableToObject.types b/tests/baselines/reference/anyIsAssignableToObject.types new file mode 100644 index 00000000000..5df5d3b345f --- /dev/null +++ b/tests/baselines/reference/anyIsAssignableToObject.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/anyIsAssignableToObject.ts === +interface P { +>P : P + + p: {}; +>p : {} +} + +interface Q extends P { // Check assignability here. Any is assignable to {} +>Q : Q +>P : P + + p: any; +>p : any +} diff --git a/tests/baselines/reference/anyIsAssignableToVoid.types b/tests/baselines/reference/anyIsAssignableToVoid.types new file mode 100644 index 00000000000..0e1af90971f --- /dev/null +++ b/tests/baselines/reference/anyIsAssignableToVoid.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/anyIsAssignableToVoid.ts === +interface P { +>P : P + + p: void; +>p : void +} + +interface Q extends P { // check assignability here. any is assignable to void. +>Q : Q +>P : P + + p: any; +>p : any +} diff --git a/tests/baselines/reference/anyPlusAny1.types b/tests/baselines/reference/anyPlusAny1.types new file mode 100644 index 00000000000..aeda001eeaa --- /dev/null +++ b/tests/baselines/reference/anyPlusAny1.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/anyPlusAny1.ts === +var x; +>x : any + +x.name = "hello"; +>x.name = "hello" : string +>x.name : any +>x : any +>name : any + +var z = x + x; +>z : any +>x + x : any +>x : any +>x : any + diff --git a/tests/baselines/reference/anyPropertyAccess.types b/tests/baselines/reference/anyPropertyAccess.types new file mode 100644 index 00000000000..5ea20cefdd6 --- /dev/null +++ b/tests/baselines/reference/anyPropertyAccess.types @@ -0,0 +1,43 @@ +=== tests/cases/conformance/types/any/anyPropertyAccess.ts === +var x: any; +>x : any + +var a = x.foo; +>a : any +>x.foo : any +>x : any +>foo : any + +var b = x['foo']; +>b : any +>x['foo'] : any +>x : any + +var c = x['fn'](); +>c : any +>x['fn']() : any +>x['fn'] : any +>x : any + +var d = x.bar.baz; +>d : any +>x.bar.baz : any +>x.bar : any +>x : any +>bar : any +>baz : any + +var e = x[0].foo; +>e : any +>x[0].foo : any +>x[0] : any +>x : any +>foo : any + +var f = x['0'].bar; +>f : any +>x['0'].bar : any +>x['0'] : any +>x : any +>bar : any + diff --git a/tests/baselines/reference/argsInScope.types b/tests/baselines/reference/argsInScope.types new file mode 100644 index 00000000000..010e5624039 --- /dev/null +++ b/tests/baselines/reference/argsInScope.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/argsInScope.ts === +class C { +>C : C + + P(ii:number, j:number, k:number) { +>P : (ii: number, j: number, k: number) => void +>ii : number +>j : number +>k : number + + for (var i = 0; i < arguments.length; i++) { +>i : number +>i < arguments.length : boolean +>i : number +>arguments.length : number +>arguments : IArguments +>length : number +>i++ : number +>i : number + + // WScript.Echo("param: " + arguments[i]); + } + } +} + +var c = new C(); +>c : C +>new C() : C +>C : typeof C + +c.P(1,2,3); +>c.P(1,2,3) : void +>c.P : (ii: number, j: number, k: number) => void +>c : C +>P : (ii: number, j: number, k: number) => void + diff --git a/tests/baselines/reference/arguments.types b/tests/baselines/reference/arguments.types new file mode 100644 index 00000000000..1902e459316 --- /dev/null +++ b/tests/baselines/reference/arguments.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/arguments.ts === +function f() { +>f : () => void + + var x=arguments[12]; +>x : any +>arguments[12] : any +>arguments : IArguments +} diff --git a/tests/baselines/reference/argumentsUsedInObjectLiteralProperty.types b/tests/baselines/reference/argumentsUsedInObjectLiteralProperty.types new file mode 100644 index 00000000000..532412d0c08 --- /dev/null +++ b/tests/baselines/reference/argumentsUsedInObjectLiteralProperty.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/argumentsUsedInObjectLiteralProperty.ts === +class A { +>A : A + + public static createSelectableViewModel(initialState?: any, selectedValue?: any) { +>createSelectableViewModel : (initialState?: any, selectedValue?: any) => { selectedValue: number; } +>initialState : any +>selectedValue : any + + return { +>{ + selectedValue: arguments.length + } : { selectedValue: number; } + + selectedValue: arguments.length +>selectedValue : number +>arguments.length : number +>arguments : IArguments +>length : number + + }; + } +} diff --git a/tests/baselines/reference/arithmeticOperatorWithAnyAndNumber.types b/tests/baselines/reference/arithmeticOperatorWithAnyAndNumber.types new file mode 100644 index 00000000000..f0120f328c4 --- /dev/null +++ b/tests/baselines/reference/arithmeticOperatorWithAnyAndNumber.types @@ -0,0 +1,437 @@ +=== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithAnyAndNumber.ts === +var a: any; +>a : any + +var b: number; +>b : number + +// operator * +var ra1 = a * a; +>ra1 : number +>a * a : number +>a : any +>a : any + +var ra2 = a * b; +>ra2 : number +>a * b : number +>a : any +>b : number + +var ra3 = a * 0; +>ra3 : number +>a * 0 : number +>a : any + +var ra4 = 0 * a; +>ra4 : number +>0 * a : number +>a : any + +var ra5 = 0 * 0; +>ra5 : number +>0 * 0 : number + +var ra6 = b * 0; +>ra6 : number +>b * 0 : number +>b : number + +var ra7 = 0 * b; +>ra7 : number +>0 * b : number +>b : number + +var ra8 = b * b; +>ra8 : number +>b * b : number +>b : number +>b : number + +// operator / +var rb1 = a / a; +>rb1 : number +>a / a : number +>a : any +>a : any + +var rb2 = a / b; +>rb2 : number +>a / b : number +>a : any +>b : number + +var rb3 = a / 0; +>rb3 : number +>a / 0 : number +>a : any + +var rb4 = 0 / a; +>rb4 : number +>0 / a : number +>a : any + +var rb5 = 0 / 0; +>rb5 : number +>0 / 0 : number + +var rb6 = b / 0; +>rb6 : number +>b / 0 : number +>b : number + +var rb7 = 0 / b; +>rb7 : number +>0 / b : number +>b : number + +var rb8 = b / b; +>rb8 : number +>b / b : number +>b : number +>b : number + +// operator % +var rc1 = a % a; +>rc1 : number +>a % a : number +>a : any +>a : any + +var rc2 = a % b; +>rc2 : number +>a % b : number +>a : any +>b : number + +var rc3 = a % 0; +>rc3 : number +>a % 0 : number +>a : any + +var rc4 = 0 % a; +>rc4 : number +>0 % a : number +>a : any + +var rc5 = 0 % 0; +>rc5 : number +>0 % 0 : number + +var rc6 = b % 0; +>rc6 : number +>b % 0 : number +>b : number + +var rc7 = 0 % b; +>rc7 : number +>0 % b : number +>b : number + +var rc8 = b % b; +>rc8 : number +>b % b : number +>b : number +>b : number + +// operator - +var rd1 = a - a; +>rd1 : number +>a - a : number +>a : any +>a : any + +var rd2 = a - b; +>rd2 : number +>a - b : number +>a : any +>b : number + +var rd3 = a - 0; +>rd3 : number +>a - 0 : number +>a : any + +var rd4 = 0 - a; +>rd4 : number +>0 - a : number +>a : any + +var rd5 = 0 - 0; +>rd5 : number +>0 - 0 : number + +var rd6 = b - 0; +>rd6 : number +>b - 0 : number +>b : number + +var rd7 = 0 - b; +>rd7 : number +>0 - b : number +>b : number + +var rd8 = b - b; +>rd8 : number +>b - b : number +>b : number +>b : number + +// operator << +var re1 = a << a; +>re1 : number +>a << a : number +>a : any +>a : any + +var re2 = a << b; +>re2 : number +>a << b : number +>a : any +>b : number + +var re3 = a << 0; +>re3 : number +>a << 0 : number +>a : any + +var re4 = 0 << a; +>re4 : number +>0 << a : number +>a : any + +var re5 = 0 << 0; +>re5 : number +>0 << 0 : number + +var re6 = b << 0; +>re6 : number +>b << 0 : number +>b : number + +var re7 = 0 << b; +>re7 : number +>0 << b : number +>b : number + +var re8 = b << b; +>re8 : number +>b << b : number +>b : number +>b : number + +// operator >> +var rf1 = a >> a; +>rf1 : number +>a >> a : number +>a : any +>a : any + +var rf2 = a >> b; +>rf2 : number +>a >> b : number +>a : any +>b : number + +var rf3 = a >> 0; +>rf3 : number +>a >> 0 : number +>a : any + +var rf4 = 0 >> a; +>rf4 : number +>0 >> a : number +>a : any + +var rf5 = 0 >> 0; +>rf5 : number +>0 >> 0 : number + +var rf6 = b >> 0; +>rf6 : number +>b >> 0 : number +>b : number + +var rf7 = 0 >> b; +>rf7 : number +>0 >> b : number +>b : number + +var rf8 = b >> b; +>rf8 : number +>b >> b : number +>b : number +>b : number + +// operator >>> +var rg1 = a >>> a; +>rg1 : number +>a >>> a : number +>a : any +>a : any + +var rg2 = a >>> b; +>rg2 : number +>a >>> b : number +>a : any +>b : number + +var rg3 = a >>> 0; +>rg3 : number +>a >>> 0 : number +>a : any + +var rg4 = 0 >>> a; +>rg4 : number +>0 >>> a : number +>a : any + +var rg5 = 0 >>> 0; +>rg5 : number +>0 >>> 0 : number + +var rg6 = b >>> 0; +>rg6 : number +>b >>> 0 : number +>b : number + +var rg7 = 0 >>> b; +>rg7 : number +>0 >>> b : number +>b : number + +var rg8 = b >>> b; +>rg8 : number +>b >>> b : number +>b : number +>b : number + +// operator & +var rh1 = a & a; +>rh1 : number +>a & a : number +>a : any +>a : any + +var rh2 = a & b; +>rh2 : number +>a & b : number +>a : any +>b : number + +var rh3 = a & 0; +>rh3 : number +>a & 0 : number +>a : any + +var rh4 = 0 & a; +>rh4 : number +>0 & a : number +>a : any + +var rh5 = 0 & 0; +>rh5 : number +>0 & 0 : number + +var rh6 = b & 0; +>rh6 : number +>b & 0 : number +>b : number + +var rh7 = 0 & b; +>rh7 : number +>0 & b : number +>b : number + +var rh8 = b & b; +>rh8 : number +>b & b : number +>b : number +>b : number + +// operator ^ +var ri1 = a ^ a; +>ri1 : number +>a ^ a : number +>a : any +>a : any + +var ri2 = a ^ b; +>ri2 : number +>a ^ b : number +>a : any +>b : number + +var ri3 = a ^ 0; +>ri3 : number +>a ^ 0 : number +>a : any + +var ri4 = 0 ^ a; +>ri4 : number +>0 ^ a : number +>a : any + +var ri5 = 0 ^ 0; +>ri5 : number +>0 ^ 0 : number + +var ri6 = b ^ 0; +>ri6 : number +>b ^ 0 : number +>b : number + +var ri7 = 0 ^ b; +>ri7 : number +>0 ^ b : number +>b : number + +var ri8 = b ^ b; +>ri8 : number +>b ^ b : number +>b : number +>b : number + +// operator | +var rj1 = a | a; +>rj1 : number +>a | a : number +>a : any +>a : any + +var rj2 = a | b; +>rj2 : number +>a | b : number +>a : any +>b : number + +var rj3 = a | 0; +>rj3 : number +>a | 0 : number +>a : any + +var rj4 = 0 | a; +>rj4 : number +>0 | a : number +>a : any + +var rj5 = 0 | 0; +>rj5 : number +>0 | 0 : number + +var rj6 = b | 0; +>rj6 : number +>b | 0 : number +>b : number + +var rj7 = 0 | b; +>rj7 : number +>0 | b : number +>b : number + +var rj8 = b | b; +>rj8 : number +>b | b : number +>b : number +>b : number + diff --git a/tests/baselines/reference/arithmeticOperatorWithEnum.types b/tests/baselines/reference/arithmeticOperatorWithEnum.types new file mode 100644 index 00000000000..2f4ebce8f32 --- /dev/null +++ b/tests/baselines/reference/arithmeticOperatorWithEnum.types @@ -0,0 +1,893 @@ +=== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum.ts === +// operands of an enum type are treated as having the primitive type Number. + +enum E { +>E : E + + a, +>a : E + + b +>b : E +} + +var a: any; +>a : any + +var b: number; +>b : number + +var c: E; +>c : E +>E : E + +// operator * +var ra1 = c * a; +>ra1 : number +>c * a : number +>c : E +>a : any + +var ra2 = c * b; +>ra2 : number +>c * b : number +>c : E +>b : number + +var ra3 = c * c; +>ra3 : number +>c * c : number +>c : E +>c : E + +var ra4 = a * c; +>ra4 : number +>a * c : number +>a : any +>c : E + +var ra5 = b * c; +>ra5 : number +>b * c : number +>b : number +>c : E + +var ra6 = E.a * a; +>ra6 : number +>E.a * a : number +>E.a : E +>E : typeof E +>a : E +>a : any + +var ra7 = E.a * b; +>ra7 : number +>E.a * b : number +>E.a : E +>E : typeof E +>a : E +>b : number + +var ra8 = E.a * E.b; +>ra8 : number +>E.a * E.b : number +>E.a : E +>E : typeof E +>a : E +>E.b : E +>E : typeof E +>b : E + +var ra9 = E.a * 1; +>ra9 : number +>E.a * 1 : number +>E.a : E +>E : typeof E +>a : E + +var ra10 = a * E.b; +>ra10 : number +>a * E.b : number +>a : any +>E.b : E +>E : typeof E +>b : E + +var ra11 = b * E.b; +>ra11 : number +>b * E.b : number +>b : number +>E.b : E +>E : typeof E +>b : E + +var ra12 = 1 * E.b; +>ra12 : number +>1 * E.b : number +>E.b : E +>E : typeof E +>b : E + +// operator / +var rb1 = c / a; +>rb1 : number +>c / a : number +>c : E +>a : any + +var rb2 = c / b; +>rb2 : number +>c / b : number +>c : E +>b : number + +var rb3 = c / c; +>rb3 : number +>c / c : number +>c : E +>c : E + +var rb4 = a / c; +>rb4 : number +>a / c : number +>a : any +>c : E + +var rb5 = b / c; +>rb5 : number +>b / c : number +>b : number +>c : E + +var rb6 = E.a / a; +>rb6 : number +>E.a / a : number +>E.a : E +>E : typeof E +>a : E +>a : any + +var rb7 = E.a / b; +>rb7 : number +>E.a / b : number +>E.a : E +>E : typeof E +>a : E +>b : number + +var rb8 = E.a / E.b; +>rb8 : number +>E.a / E.b : number +>E.a : E +>E : typeof E +>a : E +>E.b : E +>E : typeof E +>b : E + +var rb9 = E.a / 1; +>rb9 : number +>E.a / 1 : number +>E.a : E +>E : typeof E +>a : E + +var rb10 = a / E.b; +>rb10 : number +>a / E.b : number +>a : any +>E.b : E +>E : typeof E +>b : E + +var rb11 = b / E.b; +>rb11 : number +>b / E.b : number +>b : number +>E.b : E +>E : typeof E +>b : E + +var rb12 = 1 / E.b; +>rb12 : number +>1 / E.b : number +>E.b : E +>E : typeof E +>b : E + +// operator % +var rc1 = c % a; +>rc1 : number +>c % a : number +>c : E +>a : any + +var rc2 = c % b; +>rc2 : number +>c % b : number +>c : E +>b : number + +var rc3 = c % c; +>rc3 : number +>c % c : number +>c : E +>c : E + +var rc4 = a % c; +>rc4 : number +>a % c : number +>a : any +>c : E + +var rc5 = b % c; +>rc5 : number +>b % c : number +>b : number +>c : E + +var rc6 = E.a % a; +>rc6 : number +>E.a % a : number +>E.a : E +>E : typeof E +>a : E +>a : any + +var rc7 = E.a % b; +>rc7 : number +>E.a % b : number +>E.a : E +>E : typeof E +>a : E +>b : number + +var rc8 = E.a % E.b; +>rc8 : number +>E.a % E.b : number +>E.a : E +>E : typeof E +>a : E +>E.b : E +>E : typeof E +>b : E + +var rc9 = E.a % 1; +>rc9 : number +>E.a % 1 : number +>E.a : E +>E : typeof E +>a : E + +var rc10 = a % E.b; +>rc10 : number +>a % E.b : number +>a : any +>E.b : E +>E : typeof E +>b : E + +var rc11 = b % E.b; +>rc11 : number +>b % E.b : number +>b : number +>E.b : E +>E : typeof E +>b : E + +var rc12 = 1 % E.b; +>rc12 : number +>1 % E.b : number +>E.b : E +>E : typeof E +>b : E + +// operator - +var rd1 = c - a; +>rd1 : number +>c - a : number +>c : E +>a : any + +var rd2 = c - b; +>rd2 : number +>c - b : number +>c : E +>b : number + +var rd3 = c - c; +>rd3 : number +>c - c : number +>c : E +>c : E + +var rd4 = a - c; +>rd4 : number +>a - c : number +>a : any +>c : E + +var rd5 = b - c; +>rd5 : number +>b - c : number +>b : number +>c : E + +var rd6 = E.a - a; +>rd6 : number +>E.a - a : number +>E.a : E +>E : typeof E +>a : E +>a : any + +var rd7 = E.a - b; +>rd7 : number +>E.a - b : number +>E.a : E +>E : typeof E +>a : E +>b : number + +var rd8 = E.a - E.b; +>rd8 : number +>E.a - E.b : number +>E.a : E +>E : typeof E +>a : E +>E.b : E +>E : typeof E +>b : E + +var rd9 = E.a - 1; +>rd9 : number +>E.a - 1 : number +>E.a : E +>E : typeof E +>a : E + +var rd10 = a - E.b; +>rd10 : number +>a - E.b : number +>a : any +>E.b : E +>E : typeof E +>b : E + +var rd11 = b - E.b; +>rd11 : number +>b - E.b : number +>b : number +>E.b : E +>E : typeof E +>b : E + +var rd12 = 1 - E.b; +>rd12 : number +>1 - E.b : number +>E.b : E +>E : typeof E +>b : E + +// operator << +var re1 = c << a; +>re1 : number +>c << a : number +>c : E +>a : any + +var re2 = c << b; +>re2 : number +>c << b : number +>c : E +>b : number + +var re3 = c << c; +>re3 : number +>c << c : number +>c : E +>c : E + +var re4 = a << c; +>re4 : number +>a << c : number +>a : any +>c : E + +var re5 = b << c; +>re5 : number +>b << c : number +>b : number +>c : E + +var re6 = E.a << a; +>re6 : number +>E.a << a : number +>E.a : E +>E : typeof E +>a : E +>a : any + +var re7 = E.a << b; +>re7 : number +>E.a << b : number +>E.a : E +>E : typeof E +>a : E +>b : number + +var re8 = E.a << E.b; +>re8 : number +>E.a << E.b : number +>E.a : E +>E : typeof E +>a : E +>E.b : E +>E : typeof E +>b : E + +var re9 = E.a << 1; +>re9 : number +>E.a << 1 : number +>E.a : E +>E : typeof E +>a : E + +var re10 = a << E.b; +>re10 : number +>a << E.b : number +>a : any +>E.b : E +>E : typeof E +>b : E + +var re11 = b << E.b; +>re11 : number +>b << E.b : number +>b : number +>E.b : E +>E : typeof E +>b : E + +var re12 = 1 << E.b; +>re12 : number +>1 << E.b : number +>E.b : E +>E : typeof E +>b : E + +// operator >> +var rf1 = c >> a; +>rf1 : number +>c >> a : number +>c : E +>a : any + +var rf2 = c >> b; +>rf2 : number +>c >> b : number +>c : E +>b : number + +var rf3 = c >> c; +>rf3 : number +>c >> c : number +>c : E +>c : E + +var rf4 = a >> c; +>rf4 : number +>a >> c : number +>a : any +>c : E + +var rf5 = b >> c; +>rf5 : number +>b >> c : number +>b : number +>c : E + +var rf6 = E.a >> a; +>rf6 : number +>E.a >> a : number +>E.a : E +>E : typeof E +>a : E +>a : any + +var rf7 = E.a >> b; +>rf7 : number +>E.a >> b : number +>E.a : E +>E : typeof E +>a : E +>b : number + +var rf8 = E.a >> E.b; +>rf8 : number +>E.a >> E.b : number +>E.a : E +>E : typeof E +>a : E +>E.b : E +>E : typeof E +>b : E + +var rf9 = E.a >> 1; +>rf9 : number +>E.a >> 1 : number +>E.a : E +>E : typeof E +>a : E + +var rf10 = a >> E.b; +>rf10 : number +>a >> E.b : number +>a : any +>E.b : E +>E : typeof E +>b : E + +var rf11 = b >> E.b; +>rf11 : number +>b >> E.b : number +>b : number +>E.b : E +>E : typeof E +>b : E + +var rf12 = 1 >> E.b; +>rf12 : number +>1 >> E.b : number +>E.b : E +>E : typeof E +>b : E + +// operator >>> +var rg1 = c >>> a; +>rg1 : number +>c >>> a : number +>c : E +>a : any + +var rg2 = c >>> b; +>rg2 : number +>c >>> b : number +>c : E +>b : number + +var rg3 = c >>> c; +>rg3 : number +>c >>> c : number +>c : E +>c : E + +var rg4 = a >>> c; +>rg4 : number +>a >>> c : number +>a : any +>c : E + +var rg5 = b >>> c; +>rg5 : number +>b >>> c : number +>b : number +>c : E + +var rg6 = E.a >>> a; +>rg6 : number +>E.a >>> a : number +>E.a : E +>E : typeof E +>a : E +>a : any + +var rg7 = E.a >>> b; +>rg7 : number +>E.a >>> b : number +>E.a : E +>E : typeof E +>a : E +>b : number + +var rg8 = E.a >>> E.b; +>rg8 : number +>E.a >>> E.b : number +>E.a : E +>E : typeof E +>a : E +>E.b : E +>E : typeof E +>b : E + +var rg9 = E.a >>> 1; +>rg9 : number +>E.a >>> 1 : number +>E.a : E +>E : typeof E +>a : E + +var rg10 = a >>> E.b; +>rg10 : number +>a >>> E.b : number +>a : any +>E.b : E +>E : typeof E +>b : E + +var rg11 = b >>> E.b; +>rg11 : number +>b >>> E.b : number +>b : number +>E.b : E +>E : typeof E +>b : E + +var rg12 = 1 >>> E.b; +>rg12 : number +>1 >>> E.b : number +>E.b : E +>E : typeof E +>b : E + +// operator & +var rh1 = c & a; +>rh1 : number +>c & a : number +>c : E +>a : any + +var rh2 = c & b; +>rh2 : number +>c & b : number +>c : E +>b : number + +var rh3 = c & c; +>rh3 : number +>c & c : number +>c : E +>c : E + +var rh4 = a & c; +>rh4 : number +>a & c : number +>a : any +>c : E + +var rh5 = b & c; +>rh5 : number +>b & c : number +>b : number +>c : E + +var rh6 = E.a & a; +>rh6 : number +>E.a & a : number +>E.a : E +>E : typeof E +>a : E +>a : any + +var rh7 = E.a & b; +>rh7 : number +>E.a & b : number +>E.a : E +>E : typeof E +>a : E +>b : number + +var rh8 = E.a & E.b; +>rh8 : number +>E.a & E.b : number +>E.a : E +>E : typeof E +>a : E +>E.b : E +>E : typeof E +>b : E + +var rh9 = E.a & 1; +>rh9 : number +>E.a & 1 : number +>E.a : E +>E : typeof E +>a : E + +var rh10 = a & E.b; +>rh10 : number +>a & E.b : number +>a : any +>E.b : E +>E : typeof E +>b : E + +var rh11 = b & E.b; +>rh11 : number +>b & E.b : number +>b : number +>E.b : E +>E : typeof E +>b : E + +var rh12 = 1 & E.b; +>rh12 : number +>1 & E.b : number +>E.b : E +>E : typeof E +>b : E + +// operator ^ +var ri1 = c ^ a; +>ri1 : number +>c ^ a : number +>c : E +>a : any + +var ri2 = c ^ b; +>ri2 : number +>c ^ b : number +>c : E +>b : number + +var ri3 = c ^ c; +>ri3 : number +>c ^ c : number +>c : E +>c : E + +var ri4 = a ^ c; +>ri4 : number +>a ^ c : number +>a : any +>c : E + +var ri5 = b ^ c; +>ri5 : number +>b ^ c : number +>b : number +>c : E + +var ri6 = E.a ^ a; +>ri6 : number +>E.a ^ a : number +>E.a : E +>E : typeof E +>a : E +>a : any + +var ri7 = E.a ^ b; +>ri7 : number +>E.a ^ b : number +>E.a : E +>E : typeof E +>a : E +>b : number + +var ri8 = E.a ^ E.b; +>ri8 : number +>E.a ^ E.b : number +>E.a : E +>E : typeof E +>a : E +>E.b : E +>E : typeof E +>b : E + +var ri9 = E.a ^ 1; +>ri9 : number +>E.a ^ 1 : number +>E.a : E +>E : typeof E +>a : E + +var ri10 = a ^ E.b; +>ri10 : number +>a ^ E.b : number +>a : any +>E.b : E +>E : typeof E +>b : E + +var ri11 = b ^ E.b; +>ri11 : number +>b ^ E.b : number +>b : number +>E.b : E +>E : typeof E +>b : E + +var ri12 = 1 ^ E.b; +>ri12 : number +>1 ^ E.b : number +>E.b : E +>E : typeof E +>b : E + +// operator | +var rj1 = c | a; +>rj1 : number +>c | a : number +>c : E +>a : any + +var rj2 = c | b; +>rj2 : number +>c | b : number +>c : E +>b : number + +var rj3 = c | c; +>rj3 : number +>c | c : number +>c : E +>c : E + +var rj4 = a | c; +>rj4 : number +>a | c : number +>a : any +>c : E + +var rj5 = b | c; +>rj5 : number +>b | c : number +>b : number +>c : E + +var rj6 = E.a | a; +>rj6 : number +>E.a | a : number +>E.a : E +>E : typeof E +>a : E +>a : any + +var rj7 = E.a | b; +>rj7 : number +>E.a | b : number +>E.a : E +>E : typeof E +>a : E +>b : number + +var rj8 = E.a | E.b; +>rj8 : number +>E.a | E.b : number +>E.a : E +>E : typeof E +>a : E +>E.b : E +>E : typeof E +>b : E + +var rj9 = E.a | 1; +>rj9 : number +>E.a | 1 : number +>E.a : E +>E : typeof E +>a : E + +var rj10 = a | E.b; +>rj10 : number +>a | E.b : number +>a : any +>E.b : E +>E : typeof E +>b : E + +var rj11 = b | E.b; +>rj11 : number +>b | E.b : number +>b : number +>E.b : E +>E : typeof E +>b : E + +var rj12 = 1 | E.b; +>rj12 : number +>1 | E.b : number +>E.b : E +>E : typeof E +>b : E + diff --git a/tests/baselines/reference/arithmeticOperatorWithNullValueAndValidOperands.types b/tests/baselines/reference/arithmeticOperatorWithNullValueAndValidOperands.types new file mode 100644 index 00000000000..711ccd0c66c --- /dev/null +++ b/tests/baselines/reference/arithmeticOperatorWithNullValueAndValidOperands.types @@ -0,0 +1,450 @@ +=== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts === +// If one operand is the null or undefined value, it is treated as having the type of the +// other operand. + +enum E { +>E : E + + a, +>a : E + + b +>b : E +} + +var a: any; +>a : any + +var b: number; +>b : number + +// operator * +var ra1 = null * a; +>ra1 : number +>null * a : number +>a : any + +var ra2 = null * b; +>ra2 : number +>null * b : number +>b : number + +var ra3 = null * 1; +>ra3 : number +>null * 1 : number + +var ra4 = null * E.a; +>ra4 : number +>null * E.a : number +>E.a : E +>E : typeof E +>a : E + +var ra5 = a * null; +>ra5 : number +>a * null : number +>a : any + +var ra6 = b * null; +>ra6 : number +>b * null : number +>b : number + +var ra7 = 0 * null; +>ra7 : number +>0 * null : number + +var ra8 = E.b * null; +>ra8 : number +>E.b * null : number +>E.b : E +>E : typeof E +>b : E + +// operator / +var rb1 = null / a; +>rb1 : number +>null / a : number +>a : any + +var rb2 = null / b; +>rb2 : number +>null / b : number +>b : number + +var rb3 = null / 1; +>rb3 : number +>null / 1 : number + +var rb4 = null / E.a; +>rb4 : number +>null / E.a : number +>E.a : E +>E : typeof E +>a : E + +var rb5 = a / null; +>rb5 : number +>a / null : number +>a : any + +var rb6 = b / null; +>rb6 : number +>b / null : number +>b : number + +var rb7 = 0 / null; +>rb7 : number +>0 / null : number + +var rb8 = E.b / null; +>rb8 : number +>E.b / null : number +>E.b : E +>E : typeof E +>b : E + +// operator % +var rc1 = null % a; +>rc1 : number +>null % a : number +>a : any + +var rc2 = null % b; +>rc2 : number +>null % b : number +>b : number + +var rc3 = null % 1; +>rc3 : number +>null % 1 : number + +var rc4 = null % E.a; +>rc4 : number +>null % E.a : number +>E.a : E +>E : typeof E +>a : E + +var rc5 = a % null; +>rc5 : number +>a % null : number +>a : any + +var rc6 = b % null; +>rc6 : number +>b % null : number +>b : number + +var rc7 = 0 % null; +>rc7 : number +>0 % null : number + +var rc8 = E.b % null; +>rc8 : number +>E.b % null : number +>E.b : E +>E : typeof E +>b : E + +// operator - +var rd1 = null - a; +>rd1 : number +>null - a : number +>a : any + +var rd2 = null - b; +>rd2 : number +>null - b : number +>b : number + +var rd3 = null - 1; +>rd3 : number +>null - 1 : number + +var rd4 = null - E.a; +>rd4 : number +>null - E.a : number +>E.a : E +>E : typeof E +>a : E + +var rd5 = a - null; +>rd5 : number +>a - null : number +>a : any + +var rd6 = b - null; +>rd6 : number +>b - null : number +>b : number + +var rd7 = 0 - null; +>rd7 : number +>0 - null : number + +var rd8 = E.b - null; +>rd8 : number +>E.b - null : number +>E.b : E +>E : typeof E +>b : E + +// operator << +var re1 = null << a; +>re1 : number +>null << a : number +>a : any + +var re2 = null << b; +>re2 : number +>null << b : number +>b : number + +var re3 = null << 1; +>re3 : number +>null << 1 : number + +var re4 = null << E.a; +>re4 : number +>null << E.a : number +>E.a : E +>E : typeof E +>a : E + +var re5 = a << null; +>re5 : number +>a << null : number +>a : any + +var re6 = b << null; +>re6 : number +>b << null : number +>b : number + +var re7 = 0 << null; +>re7 : number +>0 << null : number + +var re8 = E.b << null; +>re8 : number +>E.b << null : number +>E.b : E +>E : typeof E +>b : E + +// operator >> +var rf1 = null >> a; +>rf1 : number +>null >> a : number +>a : any + +var rf2 = null >> b; +>rf2 : number +>null >> b : number +>b : number + +var rf3 = null >> 1; +>rf3 : number +>null >> 1 : number + +var rf4 = null >> E.a; +>rf4 : number +>null >> E.a : number +>E.a : E +>E : typeof E +>a : E + +var rf5 = a >> null; +>rf5 : number +>a >> null : number +>a : any + +var rf6 = b >> null; +>rf6 : number +>b >> null : number +>b : number + +var rf7 = 0 >> null; +>rf7 : number +>0 >> null : number + +var rf8 = E.b >> null; +>rf8 : number +>E.b >> null : number +>E.b : E +>E : typeof E +>b : E + +// operator >>> +var rg1 = null >>> a; +>rg1 : number +>null >>> a : number +>a : any + +var rg2 = null >>> b; +>rg2 : number +>null >>> b : number +>b : number + +var rg3 = null >>> 1; +>rg3 : number +>null >>> 1 : number + +var rg4 = null >>> E.a; +>rg4 : number +>null >>> E.a : number +>E.a : E +>E : typeof E +>a : E + +var rg5 = a >>> null; +>rg5 : number +>a >>> null : number +>a : any + +var rg6 = b >>> null; +>rg6 : number +>b >>> null : number +>b : number + +var rg7 = 0 >>> null; +>rg7 : number +>0 >>> null : number + +var rg8 = E.b >>> null; +>rg8 : number +>E.b >>> null : number +>E.b : E +>E : typeof E +>b : E + +// operator & +var rh1 = null & a; +>rh1 : number +>null & a : number +>a : any + +var rh2 = null & b; +>rh2 : number +>null & b : number +>b : number + +var rh3 = null & 1; +>rh3 : number +>null & 1 : number + +var rh4 = null & E.a; +>rh4 : number +>null & E.a : number +>E.a : E +>E : typeof E +>a : E + +var rh5 = a & null; +>rh5 : number +>a & null : number +>a : any + +var rh6 = b & null; +>rh6 : number +>b & null : number +>b : number + +var rh7 = 0 & null; +>rh7 : number +>0 & null : number + +var rh8 = E.b & null; +>rh8 : number +>E.b & null : number +>E.b : E +>E : typeof E +>b : E + +// operator ^ +var ri1 = null ^ a; +>ri1 : number +>null ^ a : number +>a : any + +var ri2 = null ^ b; +>ri2 : number +>null ^ b : number +>b : number + +var ri3 = null ^ 1; +>ri3 : number +>null ^ 1 : number + +var ri4 = null ^ E.a; +>ri4 : number +>null ^ E.a : number +>E.a : E +>E : typeof E +>a : E + +var ri5 = a ^ null; +>ri5 : number +>a ^ null : number +>a : any + +var ri6 = b ^ null; +>ri6 : number +>b ^ null : number +>b : number + +var ri7 = 0 ^ null; +>ri7 : number +>0 ^ null : number + +var ri8 = E.b ^ null; +>ri8 : number +>E.b ^ null : number +>E.b : E +>E : typeof E +>b : E + +// operator | +var rj1 = null | a; +>rj1 : number +>null | a : number +>a : any + +var rj2 = null | b; +>rj2 : number +>null | b : number +>b : number + +var rj3 = null | 1; +>rj3 : number +>null | 1 : number + +var rj4 = null | E.a; +>rj4 : number +>null | E.a : number +>E.a : E +>E : typeof E +>a : E + +var rj5 = a | null; +>rj5 : number +>a | null : number +>a : any + +var rj6 = b | null; +>rj6 : number +>b | null : number +>b : number + +var rj7 = 0 | null; +>rj7 : number +>0 | null : number + +var rj8 = E.b | null; +>rj8 : number +>E.b | null : number +>E.b : E +>E : typeof E +>b : E + diff --git a/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndValidOperands.types b/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndValidOperands.types new file mode 100644 index 00000000000..7db074df8bb --- /dev/null +++ b/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndValidOperands.types @@ -0,0 +1,530 @@ +=== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts === +// If one operand is the undefined or undefined value, it is treated as having the type of the +// other operand. + +enum E { +>E : E + + a, +>a : E + + b +>b : E +} + +var a: any; +>a : any + +var b: number; +>b : number + +// operator * +var ra1 = undefined * a; +>ra1 : number +>undefined * a : number +>undefined : undefined +>a : any + +var ra2 = undefined * b; +>ra2 : number +>undefined * b : number +>undefined : undefined +>b : number + +var ra3 = undefined * 1; +>ra3 : number +>undefined * 1 : number +>undefined : undefined + +var ra4 = undefined * E.a; +>ra4 : number +>undefined * E.a : number +>undefined : undefined +>E.a : E +>E : typeof E +>a : E + +var ra5 = a * undefined; +>ra5 : number +>a * undefined : number +>a : any +>undefined : undefined + +var ra6 = b * undefined; +>ra6 : number +>b * undefined : number +>b : number +>undefined : undefined + +var ra7 = 0 * undefined; +>ra7 : number +>0 * undefined : number +>undefined : undefined + +var ra8 = E.b * undefined; +>ra8 : number +>E.b * undefined : number +>E.b : E +>E : typeof E +>b : E +>undefined : undefined + +// operator / +var rb1 = undefined / a; +>rb1 : number +>undefined / a : number +>undefined : undefined +>a : any + +var rb2 = undefined / b; +>rb2 : number +>undefined / b : number +>undefined : undefined +>b : number + +var rb3 = undefined / 1; +>rb3 : number +>undefined / 1 : number +>undefined : undefined + +var rb4 = undefined / E.a; +>rb4 : number +>undefined / E.a : number +>undefined : undefined +>E.a : E +>E : typeof E +>a : E + +var rb5 = a / undefined; +>rb5 : number +>a / undefined : number +>a : any +>undefined : undefined + +var rb6 = b / undefined; +>rb6 : number +>b / undefined : number +>b : number +>undefined : undefined + +var rb7 = 0 / undefined; +>rb7 : number +>0 / undefined : number +>undefined : undefined + +var rb8 = E.b / undefined; +>rb8 : number +>E.b / undefined : number +>E.b : E +>E : typeof E +>b : E +>undefined : undefined + +// operator % +var rc1 = undefined % a; +>rc1 : number +>undefined % a : number +>undefined : undefined +>a : any + +var rc2 = undefined % b; +>rc2 : number +>undefined % b : number +>undefined : undefined +>b : number + +var rc3 = undefined % 1; +>rc3 : number +>undefined % 1 : number +>undefined : undefined + +var rc4 = undefined % E.a; +>rc4 : number +>undefined % E.a : number +>undefined : undefined +>E.a : E +>E : typeof E +>a : E + +var rc5 = a % undefined; +>rc5 : number +>a % undefined : number +>a : any +>undefined : undefined + +var rc6 = b % undefined; +>rc6 : number +>b % undefined : number +>b : number +>undefined : undefined + +var rc7 = 0 % undefined; +>rc7 : number +>0 % undefined : number +>undefined : undefined + +var rc8 = E.b % undefined; +>rc8 : number +>E.b % undefined : number +>E.b : E +>E : typeof E +>b : E +>undefined : undefined + +// operator - +var rd1 = undefined - a; +>rd1 : number +>undefined - a : number +>undefined : undefined +>a : any + +var rd2 = undefined - b; +>rd2 : number +>undefined - b : number +>undefined : undefined +>b : number + +var rd3 = undefined - 1; +>rd3 : number +>undefined - 1 : number +>undefined : undefined + +var rd4 = undefined - E.a; +>rd4 : number +>undefined - E.a : number +>undefined : undefined +>E.a : E +>E : typeof E +>a : E + +var rd5 = a - undefined; +>rd5 : number +>a - undefined : number +>a : any +>undefined : undefined + +var rd6 = b - undefined; +>rd6 : number +>b - undefined : number +>b : number +>undefined : undefined + +var rd7 = 0 - undefined; +>rd7 : number +>0 - undefined : number +>undefined : undefined + +var rd8 = E.b - undefined; +>rd8 : number +>E.b - undefined : number +>E.b : E +>E : typeof E +>b : E +>undefined : undefined + +// operator << +var re1 = undefined << a; +>re1 : number +>undefined << a : number +>undefined : undefined +>a : any + +var re2 = undefined << b; +>re2 : number +>undefined << b : number +>undefined : undefined +>b : number + +var re3 = undefined << 1; +>re3 : number +>undefined << 1 : number +>undefined : undefined + +var re4 = undefined << E.a; +>re4 : number +>undefined << E.a : number +>undefined : undefined +>E.a : E +>E : typeof E +>a : E + +var re5 = a << undefined; +>re5 : number +>a << undefined : number +>a : any +>undefined : undefined + +var re6 = b << undefined; +>re6 : number +>b << undefined : number +>b : number +>undefined : undefined + +var re7 = 0 << undefined; +>re7 : number +>0 << undefined : number +>undefined : undefined + +var re8 = E.b << undefined; +>re8 : number +>E.b << undefined : number +>E.b : E +>E : typeof E +>b : E +>undefined : undefined + +// operator >> +var rf1 = undefined >> a; +>rf1 : number +>undefined >> a : number +>undefined : undefined +>a : any + +var rf2 = undefined >> b; +>rf2 : number +>undefined >> b : number +>undefined : undefined +>b : number + +var rf3 = undefined >> 1; +>rf3 : number +>undefined >> 1 : number +>undefined : undefined + +var rf4 = undefined >> E.a; +>rf4 : number +>undefined >> E.a : number +>undefined : undefined +>E.a : E +>E : typeof E +>a : E + +var rf5 = a >> undefined; +>rf5 : number +>a >> undefined : number +>a : any +>undefined : undefined + +var rf6 = b >> undefined; +>rf6 : number +>b >> undefined : number +>b : number +>undefined : undefined + +var rf7 = 0 >> undefined; +>rf7 : number +>0 >> undefined : number +>undefined : undefined + +var rf8 = E.b >> undefined; +>rf8 : number +>E.b >> undefined : number +>E.b : E +>E : typeof E +>b : E +>undefined : undefined + +// operator >>> +var rg1 = undefined >>> a; +>rg1 : number +>undefined >>> a : number +>undefined : undefined +>a : any + +var rg2 = undefined >>> b; +>rg2 : number +>undefined >>> b : number +>undefined : undefined +>b : number + +var rg3 = undefined >>> 1; +>rg3 : number +>undefined >>> 1 : number +>undefined : undefined + +var rg4 = undefined >>> E.a; +>rg4 : number +>undefined >>> E.a : number +>undefined : undefined +>E.a : E +>E : typeof E +>a : E + +var rg5 = a >>> undefined; +>rg5 : number +>a >>> undefined : number +>a : any +>undefined : undefined + +var rg6 = b >>> undefined; +>rg6 : number +>b >>> undefined : number +>b : number +>undefined : undefined + +var rg7 = 0 >>> undefined; +>rg7 : number +>0 >>> undefined : number +>undefined : undefined + +var rg8 = E.b >>> undefined; +>rg8 : number +>E.b >>> undefined : number +>E.b : E +>E : typeof E +>b : E +>undefined : undefined + +// operator & +var rh1 = undefined & a; +>rh1 : number +>undefined & a : number +>undefined : undefined +>a : any + +var rh2 = undefined & b; +>rh2 : number +>undefined & b : number +>undefined : undefined +>b : number + +var rh3 = undefined & 1; +>rh3 : number +>undefined & 1 : number +>undefined : undefined + +var rh4 = undefined & E.a; +>rh4 : number +>undefined & E.a : number +>undefined : undefined +>E.a : E +>E : typeof E +>a : E + +var rh5 = a & undefined; +>rh5 : number +>a & undefined : number +>a : any +>undefined : undefined + +var rh6 = b & undefined; +>rh6 : number +>b & undefined : number +>b : number +>undefined : undefined + +var rh7 = 0 & undefined; +>rh7 : number +>0 & undefined : number +>undefined : undefined + +var rh8 = E.b & undefined; +>rh8 : number +>E.b & undefined : number +>E.b : E +>E : typeof E +>b : E +>undefined : undefined + +// operator ^ +var ri1 = undefined ^ a; +>ri1 : number +>undefined ^ a : number +>undefined : undefined +>a : any + +var ri2 = undefined ^ b; +>ri2 : number +>undefined ^ b : number +>undefined : undefined +>b : number + +var ri3 = undefined ^ 1; +>ri3 : number +>undefined ^ 1 : number +>undefined : undefined + +var ri4 = undefined ^ E.a; +>ri4 : number +>undefined ^ E.a : number +>undefined : undefined +>E.a : E +>E : typeof E +>a : E + +var ri5 = a ^ undefined; +>ri5 : number +>a ^ undefined : number +>a : any +>undefined : undefined + +var ri6 = b ^ undefined; +>ri6 : number +>b ^ undefined : number +>b : number +>undefined : undefined + +var ri7 = 0 ^ undefined; +>ri7 : number +>0 ^ undefined : number +>undefined : undefined + +var ri8 = E.b ^ undefined; +>ri8 : number +>E.b ^ undefined : number +>E.b : E +>E : typeof E +>b : E +>undefined : undefined + +// operator | +var rj1 = undefined | a; +>rj1 : number +>undefined | a : number +>undefined : undefined +>a : any + +var rj2 = undefined | b; +>rj2 : number +>undefined | b : number +>undefined : undefined +>b : number + +var rj3 = undefined | 1; +>rj3 : number +>undefined | 1 : number +>undefined : undefined + +var rj4 = undefined | E.a; +>rj4 : number +>undefined | E.a : number +>undefined : undefined +>E.a : E +>E : typeof E +>a : E + +var rj5 = a | undefined; +>rj5 : number +>a | undefined : number +>a : any +>undefined : undefined + +var rj6 = b | undefined; +>rj6 : number +>b | undefined : number +>b : number +>undefined : undefined + +var rj7 = 0 | undefined; +>rj7 : number +>0 | undefined : number +>undefined : undefined + +var rj8 = E.b | undefined; +>rj8 : number +>E.b | undefined : number +>E.b : E +>E : typeof E +>b : E +>undefined : undefined + diff --git a/tests/baselines/reference/arrayAssignmentTest6.types b/tests/baselines/reference/arrayAssignmentTest6.types new file mode 100644 index 00000000000..0c932cb7556 --- /dev/null +++ b/tests/baselines/reference/arrayAssignmentTest6.types @@ -0,0 +1,52 @@ +=== tests/cases/compiler/arrayAssignmentTest6.ts === +module Test { +>Test : typeof Test + + interface IState { +>IState : IState + } + interface IToken { +>IToken : IToken + + startIndex: number; +>startIndex : number + } + interface ILineTokens { +>ILineTokens : ILineTokens + + tokens: IToken[]; +>tokens : IToken[] +>IToken : IToken + + endState: IState; +>endState : IState +>IState : IState + } + interface IMode { +>IMode : IMode + + tokenize(line:string, state:IState, includeStates:boolean):ILineTokens; +>tokenize : (line: string, state: IState, includeStates: boolean) => ILineTokens +>line : string +>state : IState +>IState : IState +>includeStates : boolean +>ILineTokens : ILineTokens + } + export class Bug implements IMode { +>Bug : Bug +>IMode : IMode + + public tokenize(line:string, tokens:IToken[], includeStates:boolean):ILineTokens { +>tokenize : (line: string, tokens: IToken[], includeStates: boolean) => ILineTokens +>line : string +>tokens : IToken[] +>IToken : IToken +>includeStates : boolean +>ILineTokens : ILineTokens + + return null; + } + } +} + diff --git a/tests/baselines/reference/arrayAugment.types b/tests/baselines/reference/arrayAugment.types new file mode 100644 index 00000000000..b338d7f5c5f --- /dev/null +++ b/tests/baselines/reference/arrayAugment.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/arrayAugment.ts === +interface Array { +>Array : T[] +>T : T + + split: (parts: number) => T[][]; +>split : (parts: number) => T[][] +>parts : number +>T : T +} + +var x = ['']; +>x : string[] +>[''] : string[] + +var y = x.split(4); +>y : string[][] +>x.split(4) : string[][] +>x.split : (parts: number) => string[][] +>x : string[] +>split : (parts: number) => string[][] + +var y: string[][]; // Expect no error here +>y : string[][] + diff --git a/tests/baselines/reference/arrayBestCommonTypes.types b/tests/baselines/reference/arrayBestCommonTypes.types new file mode 100644 index 00000000000..d3381315aaf --- /dev/null +++ b/tests/baselines/reference/arrayBestCommonTypes.types @@ -0,0 +1,327 @@ +=== tests/cases/compiler/arrayBestCommonTypes.ts === +interface iface { } +>iface : iface + +class base implements iface { } +>base : base +>iface : iface + +class base2 implements iface { } +>base2 : base2 +>iface : iface + +class derived extends base { } +>derived : derived +>base : base + + +class f { +>f : f + + public voidIfAny(x: boolean, y?: boolean): number; +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>x : boolean +>y : boolean + + public voidIfAny(x: string, y?: boolean): number; +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>x : string +>y : boolean + + public voidIfAny(x: number, y?: boolean): number; +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>x : number +>y : boolean + + public voidIfAny(x: any, y =false): any { return null; } +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>x : any +>y : boolean + + public x() { +>x : () => void + + (this.voidIfAny([4, 2][0])); +>(this.voidIfAny([4, 2][0])) : number +>(this.voidIfAny([4, 2][0])) : number +>this.voidIfAny([4, 2][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[4, 2][0] : number +>[4, 2] : number[] + + (this.voidIfAny([4, 2, undefined][0])); +>(this.voidIfAny([4, 2, undefined][0])) : number +>(this.voidIfAny([4, 2, undefined][0])) : number +>this.voidIfAny([4, 2, undefined][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[4, 2, undefined][0] : number +>[4, 2, undefined] : number[] +>undefined : undefined + + (this.voidIfAny([undefined, 2, 4][0])); +>(this.voidIfAny([undefined, 2, 4][0])) : number +>(this.voidIfAny([undefined, 2, 4][0])) : number +>this.voidIfAny([undefined, 2, 4][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[undefined, 2, 4][0] : number +>[undefined, 2, 4] : number[] +>undefined : undefined + + (this.voidIfAny([null, 2, 4][0])); +>(this.voidIfAny([null, 2, 4][0])) : number +>(this.voidIfAny([null, 2, 4][0])) : number +>this.voidIfAny([null, 2, 4][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[null, 2, 4][0] : number +>[null, 2, 4] : number[] + + (this.voidIfAny([2, 4, null][0])); +>(this.voidIfAny([2, 4, null][0])) : number +>(this.voidIfAny([2, 4, null][0])) : number +>this.voidIfAny([2, 4, null][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[2, 4, null][0] : number +>[2, 4, null] : number[] + + (this.voidIfAny([undefined, 4, null][0])); +>(this.voidIfAny([undefined, 4, null][0])) : number +>(this.voidIfAny([undefined, 4, null][0])) : number +>this.voidIfAny([undefined, 4, null][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[undefined, 4, null][0] : number +>[undefined, 4, null] : number[] +>undefined : undefined + + (this.voidIfAny(['', "q"][0])); +>(this.voidIfAny(['', "q"][0])) : number +>(this.voidIfAny(['', "q"][0])) : number +>this.voidIfAny(['', "q"][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>['', "q"][0] : string +>['', "q"] : string[] + + (this.voidIfAny(['', "q", undefined][0])); +>(this.voidIfAny(['', "q", undefined][0])) : number +>(this.voidIfAny(['', "q", undefined][0])) : number +>this.voidIfAny(['', "q", undefined][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>['', "q", undefined][0] : string +>['', "q", undefined] : string[] +>undefined : undefined + + (this.voidIfAny([undefined, "q", ''][0])); +>(this.voidIfAny([undefined, "q", ''][0])) : number +>(this.voidIfAny([undefined, "q", ''][0])) : number +>this.voidIfAny([undefined, "q", ''][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[undefined, "q", ''][0] : string +>[undefined, "q", ''] : string[] +>undefined : undefined + + (this.voidIfAny([null, "q", ''][0])); +>(this.voidIfAny([null, "q", ''][0])) : number +>(this.voidIfAny([null, "q", ''][0])) : number +>this.voidIfAny([null, "q", ''][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[null, "q", ''][0] : string +>[null, "q", ''] : string[] + + (this.voidIfAny(["q", '', null][0])); +>(this.voidIfAny(["q", '', null][0])) : number +>(this.voidIfAny(["q", '', null][0])) : number +>this.voidIfAny(["q", '', null][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>["q", '', null][0] : string +>["q", '', null] : string[] + + (this.voidIfAny([undefined, '', null][0])); +>(this.voidIfAny([undefined, '', null][0])) : number +>(this.voidIfAny([undefined, '', null][0])) : number +>this.voidIfAny([undefined, '', null][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[undefined, '', null][0] : string +>[undefined, '', null] : string[] +>undefined : undefined + + (this.voidIfAny([[3,4],[null]][0][0])); +>(this.voidIfAny([[3,4],[null]][0][0])) : number +>(this.voidIfAny([[3,4],[null]][0][0])) : number +>this.voidIfAny([[3,4],[null]][0][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[[3,4],[null]][0][0] : number +>[[3,4],[null]][0] : number[] +>[[3,4],[null]] : number[][] +>[3,4] : number[] +>[null] : null[] + + + var t1: { x: number; y: base; }[] = [ { x: 7, y: new derived() }, { x: 5, y: new base() } ]; +>t1 : { x: number; y: base; }[] +>x : number +>y : base +>base : base +>[ { x: 7, y: new derived() }, { x: 5, y: new base() } ] : { x: number; y: base; }[] +>{ x: 7, y: new derived() } : { x: number; y: derived; } +>x : number +>y : derived +>new derived() : derived +>derived : typeof derived +>{ x: 5, y: new base() } : { x: number; y: base; } +>x : number +>y : base +>new base() : base +>base : typeof base + + var t2: { x: boolean; y: base; }[] = [ { x: true, y: new derived() }, { x: false, y: new base() } ]; +>t2 : { x: boolean; y: base; }[] +>x : boolean +>y : base +>base : base +>[ { x: true, y: new derived() }, { x: false, y: new base() } ] : { x: boolean; y: base; }[] +>{ x: true, y: new derived() } : { x: boolean; y: derived; } +>x : boolean +>y : derived +>new derived() : derived +>derived : typeof derived +>{ x: false, y: new base() } : { x: boolean; y: base; } +>x : boolean +>y : base +>new base() : base +>base : typeof base + + var t3: { x: string; y: base; }[] = [ { x: undefined, y: new base() }, { x: '', y: new derived() } ]; +>t3 : { x: string; y: base; }[] +>x : string +>y : base +>base : base +>[ { x: undefined, y: new base() }, { x: '', y: new derived() } ] : { x: string; y: base; }[] +>{ x: undefined, y: new base() } : { x: undefined; y: base; } +>x : any +>undefined : undefined +>y : base +>new base() : base +>base : typeof base +>{ x: '', y: new derived() } : { x: string; y: derived; } +>x : string +>y : derived +>new derived() : derived +>derived : typeof derived + + var anyObj: any = null; +>anyObj : any + + // Order matters here so test all the variants + var a1 = [ {x: 0, y: 'a'}, {x: 'a', y: 'a'}, {x: anyObj, y: 'a'} ]; +>a1 : { x: any; y: string; }[] +>[ {x: 0, y: 'a'}, {x: 'a', y: 'a'}, {x: anyObj, y: 'a'} ] : { x: any; y: string; }[] +>{x: 0, y: 'a'} : { x: number; y: string; } +>x : number +>y : string +>{x: 'a', y: 'a'} : { x: string; y: string; } +>x : string +>y : string +>{x: anyObj, y: 'a'} : { x: any; y: string; } +>x : any +>anyObj : anyObj +>y : string + + var a2 = [ {x: anyObj, y: 'a'}, {x: 0, y: 'a'}, {x: 'a', y: 'a'} ]; +>a2 : { x: any; y: string; }[] +>[ {x: anyObj, y: 'a'}, {x: 0, y: 'a'}, {x: 'a', y: 'a'} ] : { x: any; y: string; }[] +>{x: anyObj, y: 'a'} : { x: any; y: string; } +>x : any +>anyObj : anyObj +>y : string +>{x: 0, y: 'a'} : { x: number; y: string; } +>x : number +>y : string +>{x: 'a', y: 'a'} : { x: string; y: string; } +>x : string +>y : string + + var a3 = [ {x: 0, y: 'a'}, {x: anyObj, y: 'a'}, {x: 'a', y: 'a'} ]; +>a3 : { x: any; y: string; }[] +>[ {x: 0, y: 'a'}, {x: anyObj, y: 'a'}, {x: 'a', y: 'a'} ] : { x: any; y: string; }[] +>{x: 0, y: 'a'} : { x: number; y: string; } +>x : number +>y : string +>{x: anyObj, y: 'a'} : { x: any; y: string; } +>x : any +>anyObj : anyObj +>y : string +>{x: 'a', y: 'a'} : { x: string; y: string; } +>x : string +>y : string + + var ifaceObj: iface = null; +>ifaceObj : iface +>iface : iface + + var baseObj = new base(); +>baseObj : base +>new base() : base +>base : typeof base + + var base2Obj = new base2(); +>base2Obj : base2 +>new base2() : base2 +>base2 : typeof base2 + + var b1 = [ baseObj, base2Obj, ifaceObj ]; +>b1 : base[] +>[ baseObj, base2Obj, ifaceObj ] : base[] +>baseObj : base +>base2Obj : base2 +>ifaceObj : iface + + var b2 = [ base2Obj, baseObj, ifaceObj ]; +>b2 : base2[] +>[ base2Obj, baseObj, ifaceObj ] : base2[] +>base2Obj : base2 +>baseObj : base +>ifaceObj : iface + + var b3 = [ baseObj, ifaceObj, base2Obj ]; +>b3 : base[] +>[ baseObj, ifaceObj, base2Obj ] : base[] +>baseObj : base +>ifaceObj : iface +>base2Obj : base2 + + var b4 = [ ifaceObj, baseObj, base2Obj ]; +>b4 : iface[] +>[ ifaceObj, baseObj, base2Obj ] : iface[] +>ifaceObj : iface +>baseObj : base +>base2Obj : base2 + } +} + + + diff --git a/tests/baselines/reference/arrayConcat2.types b/tests/baselines/reference/arrayConcat2.types new file mode 100644 index 00000000000..a4036560305 --- /dev/null +++ b/tests/baselines/reference/arrayConcat2.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/arrayConcat2.ts === +var a: string[] = []; +>a : string[] +>[] : string[] + +a.concat("hello", 'world'); +>a.concat("hello", 'world') : string[] +>a.concat : { (...items: U[]): string[]; (...items: string[]): string[]; } +>a : string[] +>concat : { (...items: U[]): string[]; (...items: string[]): string[]; } + +a.concat('Hello'); +>a.concat('Hello') : string[] +>a.concat : { (...items: U[]): string[]; (...items: string[]): string[]; } +>a : string[] +>concat : { (...items: U[]): string[]; (...items: string[]): string[]; } + +var b = new Array(); +>b : string[] +>new Array() : string[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } + +b.concat('hello'); +>b.concat('hello') : string[] +>b.concat : { (...items: U[]): string[]; (...items: string[]): string[]; } +>b : string[] +>concat : { (...items: U[]): string[]; (...items: string[]): string[]; } + diff --git a/tests/baselines/reference/arrayConcatMap.types b/tests/baselines/reference/arrayConcatMap.types new file mode 100644 index 00000000000..643f1a6a57e --- /dev/null +++ b/tests/baselines/reference/arrayConcatMap.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/arrayConcatMap.ts === +var x = [].concat([{ a: 1 }], [{ a: 2 }]) +>x : any[] +>[].concat([{ a: 1 }], [{ a: 2 }]) + .map(b => b.a) : any[] +>[].concat([{ a: 1 }], [{ a: 2 }]) + .map : (callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[] +>[].concat([{ a: 1 }], [{ a: 2 }]) : any[] +>[].concat : { (...items: U[]): any[]; (...items: any[]): any[]; } +>[] : undefined[] +>concat : { (...items: U[]): any[]; (...items: any[]): any[]; } +>[{ a: 1 }] : { a: number; }[] +>{ a: 1 } : { a: number; } +>a : number +>[{ a: 2 }] : { a: number; }[] +>{ a: 2 } : { a: number; } +>a : number + + .map(b => b.a); +>map : (callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[] +>b => b.a : (b: any) => any +>b : any +>b.a : any +>b : any +>a : any + diff --git a/tests/baselines/reference/arrayConstructors1.types b/tests/baselines/reference/arrayConstructors1.types new file mode 100644 index 00000000000..8b34f32205e --- /dev/null +++ b/tests/baselines/reference/arrayConstructors1.types @@ -0,0 +1,43 @@ +=== tests/cases/compiler/arrayConstructors1.ts === +var x: string[]; +>x : string[] + +x = new Array(1); +>x = new Array(1) : any[] +>x : string[] +>new Array(1) : any[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } + +x = new Array('hi', 'bye'); +>x = new Array('hi', 'bye') : string[] +>x : string[] +>new Array('hi', 'bye') : string[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } + +x = new Array('hi', 'bye'); +>x = new Array('hi', 'bye') : string[] +>x : string[] +>new Array('hi', 'bye') : string[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } + +var y: number[]; +>y : number[] + +y = new Array(1); +>y = new Array(1) : any[] +>y : number[] +>new Array(1) : any[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } + +y = new Array(1,2); +>y = new Array(1,2) : number[] +>y : number[] +>new Array(1,2) : number[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } + +y = new Array(1, 2); +>y = new Array(1, 2) : number[] +>y : number[] +>new Array(1, 2) : number[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } + diff --git a/tests/baselines/reference/arrayLiteral.types b/tests/baselines/reference/arrayLiteral.types new file mode 100644 index 00000000000..1b356773dc7 --- /dev/null +++ b/tests/baselines/reference/arrayLiteral.types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayLiteral.ts === +// valid uses of array literals + +var x = []; +>x : any[] +>[] : undefined[] + +var x = new Array(1); +>x : any[] +>new Array(1) : any[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } + +var y = [1]; +>y : number[] +>[1] : number[] + +var y = [1, 2]; +>y : number[] +>[1, 2] : number[] + +var y = new Array(); +>y : number[] +>new Array() : number[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } + +var x2: number[] = []; +>x2 : number[] +>[] : number[] + +var x2: number[] = new Array(1); +>x2 : number[] +>new Array(1) : any[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } + +var y2: number[] = [1]; +>y2 : number[] +>[1] : number[] + +var y2: number[] = [1, 2]; +>y2 : number[] +>[1, 2] : number[] + +var y2: number[] = new Array(); +>y2 : number[] +>new Array() : number[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } + diff --git a/tests/baselines/reference/arrayLiteral1.types b/tests/baselines/reference/arrayLiteral1.types new file mode 100644 index 00000000000..79d00f5f46f --- /dev/null +++ b/tests/baselines/reference/arrayLiteral1.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/arrayLiteral1.ts === +var v30 = [1, 2]; +>v30 : number[] +>[1, 2] : number[] + diff --git a/tests/baselines/reference/arrayLiteral2.types b/tests/baselines/reference/arrayLiteral2.types new file mode 100644 index 00000000000..cd370c0f1a9 --- /dev/null +++ b/tests/baselines/reference/arrayLiteral2.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/arrayLiteral2.ts === +var v30 = [1, 2], v31; +>v30 : number[] +>[1, 2] : number[] +>v31 : any + diff --git a/tests/baselines/reference/arrayLiteralInNonVarArgParameter.types b/tests/baselines/reference/arrayLiteralInNonVarArgParameter.types new file mode 100644 index 00000000000..c4889e223bb --- /dev/null +++ b/tests/baselines/reference/arrayLiteralInNonVarArgParameter.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/arrayLiteralInNonVarArgParameter.ts === +function panic(val: string[], ...opt: string[]) { } +>panic : (val: string[], ...opt: string[]) => void +>val : string[] +>opt : string[] + +panic([], 'one', 'two'); +>panic([], 'one', 'two') : void +>panic : (val: string[], ...opt: string[]) => void +>[] : string[] + diff --git a/tests/baselines/reference/arrayLiteralTypeInference.types b/tests/baselines/reference/arrayLiteralTypeInference.types new file mode 100644 index 00000000000..a5f1cb97084 --- /dev/null +++ b/tests/baselines/reference/arrayLiteralTypeInference.types @@ -0,0 +1,156 @@ +=== tests/cases/compiler/arrayLiteralTypeInference.ts === +class Action { +>Action : Action + + id: number; +>id : number +} + +class ActionA extends Action { +>ActionA : ActionA +>Action : Action + + value: string; +>value : string +} + +class ActionB extends Action { +>ActionB : ActionB +>Action : Action + + trueNess: boolean; +>trueNess : boolean +} + +var x1: Action[] = [ +>x1 : Action[] +>Action : Action +>[ + { id: 2, trueness: false }, + { id: 3, name: "three" } +] : Action[] + + { id: 2, trueness: false }, +>{ id: 2, trueness: false } : { id: number; trueness: boolean; } +>id : number +>trueness : boolean + + { id: 3, name: "three" } +>{ id: 3, name: "three" } : { id: number; name: string; } +>id : number +>name : string + +] + +var x2: Action[] = [ +>x2 : Action[] +>Action : Action +>[ + new ActionA(), + new ActionB() +] : Action[] + + new ActionA(), +>new ActionA() : ActionA +>ActionA : typeof ActionA + + new ActionB() +>new ActionB() : ActionB +>ActionB : typeof ActionB + +] + +var x3: Action[] = [ +>x3 : Action[] +>Action : Action +>[ + new Action(), + new ActionA(), + new ActionB() +] : Action[] + + new Action(), +>new Action() : Action +>Action : typeof Action + + new ActionA(), +>new ActionA() : ActionA +>ActionA : typeof ActionA + + new ActionB() +>new ActionB() : ActionB +>ActionB : typeof ActionB + +] + +var z1: { id: number }[] = +>z1 : { id: number; }[] +>id : number + + [ +>[ + { id: 2, trueness: false }, + { id: 3, name: "three" } + ] : { id: number; }[] + + { id: 2, trueness: false }, +>{ id: 2, trueness: false } : { id: number; trueness: boolean; } +>id : number +>trueness : boolean + + { id: 3, name: "three" } +>{ id: 3, name: "three" } : { id: number; name: string; } +>id : number +>name : string + + ] + +var z2: { id: number }[] = +>z2 : { id: number; }[] +>id : number + + [ +>[ + new ActionA(), + new ActionB() + ] : { id: number; }[] + + new ActionA(), +>new ActionA() : ActionA +>ActionA : typeof ActionA + + new ActionB() +>new ActionB() : ActionB +>ActionB : typeof ActionB + + ] + +var z3: { id: number }[] = +>z3 : { id: number; }[] +>id : number + + [ +>[ + new Action(), + new ActionA(), + new ActionB() + ] : { id: number; }[] + + new Action(), +>new Action() : Action +>Action : typeof Action + + new ActionA(), +>new ActionA() : ActionA +>ActionA : typeof ActionA + + new ActionB() +>new ActionB() : ActionB +>ActionB : typeof ActionB + + ] + + + + + diff --git a/tests/baselines/reference/arrayLiteralWidened.types b/tests/baselines/reference/arrayLiteralWidened.types new file mode 100644 index 00000000000..6e89bc50892 --- /dev/null +++ b/tests/baselines/reference/arrayLiteralWidened.types @@ -0,0 +1,50 @@ +=== tests/cases/conformance/types/typeRelationships/widenedTypes/arrayLiteralWidened.ts === +// array literals are widened upon assignment according to their element type + +var a = []; // any[] +>a : any[] +>[] : undefined[] + +var a = [null, null]; +>a : any[] +>[null, null] : null[] + +var a = [undefined, undefined]; +>a : any[] +>[undefined, undefined] : undefined[] +>undefined : undefined +>undefined : undefined + +var b = [[], [null, null]]; // any[][] +>b : any[][] +>[[], [null, null]] : null[][] +>[] : undefined[] +>[null, null] : null[] + +var b = [[], []]; +>b : any[][] +>[[], []] : undefined[][] +>[] : undefined[] +>[] : undefined[] + +var b = [[undefined, undefined]]; +>b : any[][] +>[[undefined, undefined]] : undefined[][] +>[undefined, undefined] : undefined[] +>undefined : undefined +>undefined : undefined + +var c = [[[]]]; // any[][][] +>c : any[][][] +>[[[]]] : undefined[][][] +>[[]] : undefined[][] +>[] : undefined[] + +var c = [[[null]],[undefined]] +>c : any[][][] +>[[[null]],[undefined]] : null[][][] +>[[null]] : null[][] +>[null] : null[] +>[undefined] : undefined[] +>undefined : undefined + diff --git a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types new file mode 100644 index 00000000000..7729b280160 --- /dev/null +++ b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types @@ -0,0 +1,79 @@ +=== tests/cases/conformance/types/typeRelationships/bestCommonType/arrayLiteralWithMultipleBestCommonTypes.ts === +// when multiple best common types exist we will choose the first candidate + +var a: { x: number; y?: number }; +>a : { x: number; y?: number; } +>x : number +>y : number + +var b: { x: number; z?: number }; +>b : { x: number; z?: number; } +>x : number +>z : number + +var c: { x: number; a?: number }; +>c : { x: number; a?: number; } +>x : number +>a : number + +var as = [a, b]; // { x: number; y?: number };[] +>as : { x: number; y?: number; }[] +>[a, b] : { x: number; y?: number; }[] +>a : { x: number; y?: number; } +>b : { x: number; z?: number; } + +var bs = [b, a]; // { x: number; z?: number };[] +>bs : { x: number; z?: number; }[] +>[b, a] : { x: number; z?: number; }[] +>b : { x: number; z?: number; } +>a : { x: number; y?: number; } + +var cs = [a, b, c]; // { x: number; y?: number };[] +>cs : { x: number; y?: number; }[] +>[a, b, c] : { x: number; y?: number; }[] +>a : { x: number; y?: number; } +>b : { x: number; z?: number; } +>c : { x: number; a?: number; } + +var ds = [(x: Object) => 1, (x: string) => 2]; // { (x:Object) => number }[] +>ds : { (x: Object): number; }[] +>[(x: Object) => 1, (x: string) => 2] : { (x: Object): number; }[] +>(x: Object) => 1 : (x: Object) => number +>x : Object +>Object : Object +>(x: string) => 2 : (x: string) => number +>x : string + +var es = [(x: string) => 2, (x: Object) => 1]; // { (x:string) => number }[] +>es : { (x: string): number; }[] +>[(x: string) => 2, (x: Object) => 1] : { (x: string): number; }[] +>(x: string) => 2 : (x: string) => number +>x : string +>(x: Object) => 1 : (x: Object) => number +>x : Object +>Object : Object + +var fs = [(a: { x: number; y?: number }) => 1, (b: { x: number; z?: number }) => 2]; // (a: { x: number; y?: number }) => number[] +>fs : { (a: { x: number; y?: number; }): number; }[] +>[(a: { x: number; y?: number }) => 1, (b: { x: number; z?: number }) => 2] : { (a: { x: number; y?: number; }): number; }[] +>(a: { x: number; y?: number }) => 1 : (a: { x: number; y?: number; }) => number +>a : { x: number; y?: number; } +>x : number +>y : number +>(b: { x: number; z?: number }) => 2 : (b: { x: number; z?: number; }) => number +>b : { x: number; z?: number; } +>x : number +>z : number + +var gs = [(b: { x: number; z?: number }) => 2, (a: { x: number; y?: number }) => 1]; // (b: { x: number; z?: number }) => number[] +>gs : { (b: { x: number; z?: number; }): number; }[] +>[(b: { x: number; z?: number }) => 2, (a: { x: number; y?: number }) => 1] : { (b: { x: number; z?: number; }): number; }[] +>(b: { x: number; z?: number }) => 2 : (b: { x: number; z?: number; }) => number +>b : { x: number; z?: number; } +>x : number +>z : number +>(a: { x: number; y?: number }) => 1 : (a: { x: number; y?: number; }) => number +>a : { x: number; y?: number; } +>x : number +>y : number + diff --git a/tests/baselines/reference/arrayLiterals.types b/tests/baselines/reference/arrayLiterals.types new file mode 100644 index 00000000000..099847793b7 --- /dev/null +++ b/tests/baselines/reference/arrayLiterals.types @@ -0,0 +1,150 @@ +=== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals.ts === +// Empty array literal with no contextual type has type Undefined[] + +var arr1= [[], [1], ['']]; +>arr1 : {}[] +>[[], [1], ['']] : {}[] +>[] : undefined[] +>[1] : number[] +>[''] : string[] + +var arr1: {}[]; // Bug 825172: Error ({}[] does not match {}[]), but should be OK +>arr1 : {}[] + +var arr2 = [[null], [1], ['']]; +>arr2 : {}[] +>[[null], [1], ['']] : {}[] +>[null] : null[] +>[1] : number[] +>[''] : string[] + +var arr2: {}[]; // Bug 825172: Error ({}[] does not match {}[]), but should be OK +>arr2 : {}[] + + +// Array literal with elements of only EveryType E has type E[] +var stringArrArr = [[''], [""]]; +>stringArrArr : string[][] +>[[''], [""]] : string[][] +>[''] : string[] +>[""] : string[] + +var stringArrArr: string[][]; +>stringArrArr : string[][] + +var stringArr = ['', ""]; +>stringArr : string[] +>['', ""] : string[] + +var stringArr: string[]; +>stringArr : string[] + +var numberArr = [0, 0.0, 0x00, 1e1]; +>numberArr : number[] +>[0, 0.0, 0x00, 1e1] : number[] + +var numberArr: number[]; +>numberArr : number[] + +var boolArr = [false, true, false, true]; +>boolArr : boolean[] +>[false, true, false, true] : boolean[] + +var boolArr: boolean[]; +>boolArr : boolean[] + +class C { private p; } +>C : C +>p : any + +var classArr = [new C(), new C()]; +>classArr : C[] +>[new C(), new C()] : C[] +>new C() : C +>C : typeof C +>new C() : C +>C : typeof C + +var classArr: C[]; // Should be OK +>classArr : C[] +>C : C + +var classTypeArray = [C, C, C]; +>classTypeArray : typeof C[] +>[C, C, C] : typeof C[] +>C : typeof C +>C : typeof C +>C : typeof C + +var classTypeArray: Array; // Should OK, not be a parse error +>classTypeArray : typeof C[] +>Array : Array +>C : typeof C + +// Contextual type C with numeric index signature makes array literal of EveryType E of type BCT(E,C)[] +var context1: { [n: number]: { a: string; b: number; }; } = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; +>context1 : { [x: number]: { a: string; b: number; }; } +>n : number +>a : string +>b : number +>[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : { a: string; b: number; }[] +>{ a: '', b: 0, c: '' } : { a: string; b: number; c: string; } +>a : string +>b : number +>c : string +>{ a: "", b: 3, c: 0 } : { a: string; b: number; c: number; } +>a : string +>b : number +>c : number + +var context2 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; +>context2 : {}[] +>[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : {}[] +>{ a: '', b: 0, c: '' } : { a: string; b: number; c: string; } +>a : string +>b : number +>c : string +>{ a: "", b: 3, c: 0 } : { a: string; b: number; c: number; } +>a : string +>b : number +>c : number + +var context2: Array<{}>; // Should be OK +>context2 : {}[] +>Array : Array + +// Contextual type C with numeric index signature of type Base makes array literal of Derived have type Base[] +class Base { private p; } +>Base : Base +>p : any + +class Derived1 extends Base { private m }; +>Derived1 : Derived1 +>Base : Base +>m : any + +class Derived2 extends Base { private n }; +>Derived2 : Derived2 +>Base : Base +>n : any + +var context3: Base[] = [new Derived1(), new Derived2()]; +>context3 : Base[] +>Base : Base +>[new Derived1(), new Derived2()] : Base[] +>new Derived1() : Derived1 +>Derived1 : typeof Derived1 +>new Derived2() : Derived2 +>Derived2 : typeof Derived2 + +// Contextual type C with numeric index signature of type Base makes array literal of Derived1 and Derived2 have type Base[] +var context4: Base[] = [new Derived1(), new Derived1()]; +>context4 : Base[] +>Base : Base +>[new Derived1(), new Derived1()] : Base[] +>new Derived1() : Derived1 +>Derived1 : typeof Derived1 +>new Derived1() : Derived1 +>Derived1 : typeof Derived1 + + diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types new file mode 100644 index 00000000000..2c6e482e49d --- /dev/null +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types @@ -0,0 +1,83 @@ +=== tests/cases/conformance/types/typeRelationships/recursiveTypes/arrayLiteralsWithRecursiveGenerics.ts === +class List { +>List : List +>T : T + + data: T; +>data : T +>T : T + + next: List>; +>next : List> +>List : List +>List : List +>T : T +} + +class DerivedList extends List { +>DerivedList : DerivedList +>U : U +>List : List +>U : U + + foo: U; +>foo : U +>U : U + + // next: List> +} + +class MyList { +>MyList : MyList +>T : T + + data: T; +>data : T +>T : T + + next: MyList>; +>next : MyList> +>MyList : MyList +>MyList : MyList +>T : T +} + +var list: List; +>list : List +>List : List + +var list2: List; +>list2 : List +>List : List + +var myList: MyList; +>myList : MyList +>MyList : MyList + +var xs = [list, myList]; // {}[] +>xs : List[] +>[list, myList] : List[] +>list : List +>myList : MyList + +var ys = [list, list2]; // {}[] +>ys : {}[] +>[list, list2] : {}[] +>list : List +>list2 : List + +var zs = [list, null]; // List[] +>zs : List[] +>[list, null] : List[] +>list : List + +var myDerivedList: DerivedList; +>myDerivedList : DerivedList +>DerivedList : DerivedList + +var as = [list, myDerivedList]; // List[] +>as : List[] +>[list, myDerivedList] : List[] +>list : List +>myDerivedList : DerivedList + diff --git a/tests/baselines/reference/arrayOfExportedClass.types b/tests/baselines/reference/arrayOfExportedClass.types new file mode 100644 index 00000000000..3d542b88d80 --- /dev/null +++ b/tests/baselines/reference/arrayOfExportedClass.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/arrayOfExportedClass_1.ts === +/// +import Car = require('arrayOfExportedClass_0'); +>Car : typeof Car + +class Road { +>Road : Road + + public cars: Car[]; +>cars : Car[] +>Car : Car + + public AddCars(cars: Car[]) { +>AddCars : (cars: Car[]) => void +>cars : Car[] +>Car : Car + + this.cars = cars; +>this.cars = cars : Car[] +>this.cars : Car[] +>this : Road +>cars : Car[] +>cars : Car[] + } +} + +export = Road; +>Road : Road + +=== tests/cases/compiler/arrayOfExportedClass_0.ts === +class Car { +>Car : Car + + foo: string; +>foo : string +} + +export = Car; +>Car : Car + diff --git a/tests/baselines/reference/arrayOfFunctionTypes3.types b/tests/baselines/reference/arrayOfFunctionTypes3.types new file mode 100644 index 00000000000..b224ff881e3 --- /dev/null +++ b/tests/baselines/reference/arrayOfFunctionTypes3.types @@ -0,0 +1,108 @@ +=== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts === +// valid uses of arrays of function types + +var x = [() => 1, () => { }]; +>x : { (): void; }[] +>[() => 1, () => { }] : { (): void; }[] +>() => 1 : () => number +>() => { } : () => void + +var r2 = x[0](); +>r2 : void +>x[0]() : void +>x[0] : () => void +>x : { (): void; }[] + +class C { +>C : C + + foo: string; +>foo : string +} +var y = [C, C]; +>y : typeof C[] +>[C, C] : typeof C[] +>C : typeof C +>C : typeof C + +var r3 = new y[0](); +>r3 : C +>new y[0]() : C +>y[0] : typeof C +>y : typeof C[] + +var a: { (x: number): number; (x: string): string; }; +>a : { (x: number): number; (x: string): string; } +>x : number +>x : string + +var b: { (x: number): number; (x: string): string; }; +>b : { (x: number): number; (x: string): string; } +>x : number +>x : string + +var c: { (x: number): number; (x: any): any; }; +>c : { (x: number): number; (x: any): any; } +>x : number +>x : any + +var z = [a, b, c]; +>z : { (x: number): number; (x: any): any; }[] +>[a, b, c] : { (x: number): number; (x: any): any; }[] +>a : { (x: number): number; (x: string): string; } +>b : { (x: number): number; (x: string): string; } +>c : { (x: number): number; (x: any): any; } + +var r4 = z[0]; +>r4 : { (x: number): number; (x: any): any; } +>z[0] : { (x: number): number; (x: any): any; } +>z : { (x: number): number; (x: any): any; }[] + +var r5 = r4(''); // any not string +>r5 : any +>r4('') : any +>r4 : { (x: number): number; (x: any): any; } + +var r5b = r4(1); +>r5b : number +>r4(1) : number +>r4 : { (x: number): number; (x: any): any; } + +var a2: { (x: T): number; (x: string): string;}; +>a2 : { (x: T): number; (x: string): string; } +>T : T +>x : T +>T : T +>x : string + +var b2: { (x: T): number; (x: string): string; }; +>b2 : { (x: T): number; (x: string): string; } +>T : T +>x : T +>T : T +>x : string + +var c2: { (x: number): number; (x: T): any; }; +>c2 : { (x: number): number; (x: T): any; } +>x : number +>T : T +>x : T +>T : T + +var z2 = [a2, b2, c2]; +>z2 : { (x: number): number; (x: T): any; }[] +>[a2, b2, c2] : { (x: number): number; (x: T): any; }[] +>a2 : { (x: T): number; (x: string): string; } +>b2 : { (x: T): number; (x: string): string; } +>c2 : { (x: number): number; (x: T): any; } + +var r6 = z2[0]; +>r6 : { (x: number): number; (x: T): any; } +>z2[0] : { (x: number): number; (x: T): any; } +>z2 : { (x: number): number; (x: T): any; }[] + +var r7 = r6(''); // any not string +>r7 : any +>r6('') : any +>r6 : { (x: number): number; (x: T): any; } + diff --git a/tests/baselines/reference/arrayTypeInSignatureOfInterfaceAndClass.types b/tests/baselines/reference/arrayTypeInSignatureOfInterfaceAndClass.types new file mode 100644 index 00000000000..7f1523a6870 --- /dev/null +++ b/tests/baselines/reference/arrayTypeInSignatureOfInterfaceAndClass.types @@ -0,0 +1,89 @@ +=== tests/cases/compiler/arrayTypeInSignatureOfInterfaceAndClass.ts === +declare module WinJS { +>WinJS : typeof WinJS + + class Promise { +>Promise : Promise +>T : T + + then(success?: (value: T) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; +>then : (success?: (value: T) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void) => Promise +>U : U +>success : (value: T) => Promise +>value : T +>T : T +>Promise : Promise +>U : U +>error : (error: any) => Promise +>error : any +>Promise : Promise +>U : U +>progress : (progress: any) => void +>progress : any +>Promise : Promise +>U : U + } +} +declare module Data { +>Data : typeof Data + + export interface IListItem { +>IListItem : IListItem +>T : T + + itemIndex: number; +>itemIndex : number + + key: any; +>key : any + + data: T; +>data : T +>T : T + + group: any; +>group : any + + isHeader: boolean; +>isHeader : boolean + + cached: boolean; +>cached : boolean + + isNonSourceData: boolean; +>isNonSourceData : boolean + + preventAugmentation: boolean; +>preventAugmentation : boolean + } + export interface IVirtualList { +>IVirtualList : IVirtualList +>T : T + + //removeIndices: WinJS.Promise[]>; + removeIndices(indices: number[], options?: any): WinJS.Promise[]>; +>removeIndices : (indices: number[], options?: any) => Promise[]> +>indices : number[] +>options : any +>WinJS : WinJS +>Promise : Promise +>IListItem : IListItem +>T : T + } + export class VirtualList implements IVirtualList { +>VirtualList : VirtualList +>T : T +>IVirtualList : IVirtualList +>T : T + + //removeIndices: WinJS.Promise[]>; + public removeIndices(indices: number[], options?: any): WinJS.Promise[]>; +>removeIndices : (indices: number[], options?: any) => Promise[]> +>indices : number[] +>options : any +>WinJS : WinJS +>Promise : Promise +>IListItem : IListItem +>T : T + } +} diff --git a/tests/baselines/reference/arrayconcat.types b/tests/baselines/reference/arrayconcat.types new file mode 100644 index 00000000000..0ae65d31426 --- /dev/null +++ b/tests/baselines/reference/arrayconcat.types @@ -0,0 +1,123 @@ +=== tests/cases/compiler/arrayconcat.ts === +interface IOptions { +>IOptions : IOptions + + name?: string; +>name : string + + flag?: boolean; +>flag : boolean + + short?: string; +>short : string + + usage?: string; +>usage : string + + set?: (s: string) => void; +>set : (s: string) => void +>s : string + + type?: string; +>type : string + + experimental?: boolean; +>experimental : boolean +} + +class parser { +>parser : parser + + public options: IOptions[]; +>options : IOptions[] +>IOptions : IOptions + + public m() { +>m : () => void + + this.options = this.options.sort(function(a, b) { +>this.options = this.options.sort(function(a, b) { + var aName = a.name.toLowerCase(); + var bName = b.name.toLowerCase(); + + if (aName > bName) { + return 1; + } else if (aName < bName) { + return -1; + } else { + return 0; + } + }) : IOptions[] +>this.options : IOptions[] +>this : parser +>options : IOptions[] +>this.options.sort(function(a, b) { + var aName = a.name.toLowerCase(); + var bName = b.name.toLowerCase(); + + if (aName > bName) { + return 1; + } else if (aName < bName) { + return -1; + } else { + return 0; + } + }) : IOptions[] +>this.options.sort : (compareFn?: (a: IOptions, b: IOptions) => number) => IOptions[] +>this.options : IOptions[] +>this : parser +>options : IOptions[] +>sort : (compareFn?: (a: IOptions, b: IOptions) => number) => IOptions[] +>function(a, b) { + var aName = a.name.toLowerCase(); + var bName = b.name.toLowerCase(); + + if (aName > bName) { + return 1; + } else if (aName < bName) { + return -1; + } else { + return 0; + } + } : (a: IOptions, b: IOptions) => number +>a : IOptions +>b : IOptions + + var aName = a.name.toLowerCase(); +>aName : string +>a.name.toLowerCase() : string +>a.name.toLowerCase : () => string +>a.name : string +>a : IOptions +>name : string +>toLowerCase : () => string + + var bName = b.name.toLowerCase(); +>bName : string +>b.name.toLowerCase() : string +>b.name.toLowerCase : () => string +>b.name : string +>b : IOptions +>name : string +>toLowerCase : () => string + + if (aName > bName) { +>aName > bName : boolean +>aName : string +>bName : string + + return 1; + } else if (aName < bName) { +>aName < bName : boolean +>aName : string +>bName : string + + return -1; +>-1 : number + + } else { + return 0; + } + }); + } +} diff --git a/tests/baselines/reference/arrowFunctionExpressions.types b/tests/baselines/reference/arrowFunctionExpressions.types new file mode 100644 index 00000000000..6d23dcd6600 --- /dev/null +++ b/tests/baselines/reference/arrowFunctionExpressions.types @@ -0,0 +1,288 @@ +=== tests/cases/conformance/expressions/functions/arrowFunctionExpressions.ts === +// ArrowFormalParameters => AssignmentExpression is equivalent to ArrowFormalParameters => { return AssignmentExpression; } +var a = (p: string) => p.length; +>a : (p: string) => number +>(p: string) => p.length : (p: string) => number +>p : string +>p.length : number +>p : string +>length : number + +var a = (p: string) => { return p.length; } +>a : (p: string) => number +>(p: string) => { return p.length; } : (p: string) => number +>p : string +>p.length : number +>p : string +>length : number + +// Identifier => Block is equivalent to(Identifier) => Block +var b = j => { return 0; } +>b : (j: any) => number +>j => { return 0; } : (j: any) => number +>j : any + +var b = (j) => { return 0; } +>b : (j: any) => number +>(j) => { return 0; } : (j: any) => number +>j : any + +// Identifier => AssignmentExpression is equivalent to(Identifier) => AssignmentExpression +var c: number; +>c : number + +var d = n => c = n; +>d : (n: any) => any +>n => c = n : (n: any) => any +>n : any +>c = n : any +>c : number +>n : any + +var d = (n) => c = n; +>d : (n: any) => any +>(n) => c = n : (n: any) => any +>n : any +>c = n : any +>c : number +>n : any + +var d: (n: any) => any; +>d : (n: any) => any +>n : any + + +// Arrow function used in class member initializer +// Arrow function used in class member function +class MyClass { +>MyClass : MyClass + + m = (n) => n + 1; +>m : (n: any) => any +>(n) => n + 1 : (n: any) => any +>n : any +>n + 1 : any +>n : any + + p = (n) => n && this; +>p : (n: any) => MyClass +>(n) => n && this : (n: any) => MyClass +>n : any +>n && this : MyClass +>n : any +>this : MyClass + + fn() { +>fn : () => void + + var m = (n) => n + 1; +>m : (n: any) => any +>(n) => n + 1 : (n: any) => any +>n : any +>n + 1 : any +>n : any + + var p = (n) => n && this; +>p : (n: any) => MyClass +>(n) => n && this : (n: any) => MyClass +>n : any +>n && this : MyClass +>n : any +>this : MyClass + } +} + +// Arrow function used in arrow function +var arrrr = () => (m: number) => () => (n: number) => m + n; +>arrrr : () => (m: number) => () => (n: number) => number +>() => (m: number) => () => (n: number) => m + n : () => (m: number) => () => (n: number) => number +>(m: number) => () => (n: number) => m + n : (m: number) => () => (n: number) => number +>m : number +>() => (n: number) => m + n : () => (n: number) => number +>(n: number) => m + n : (n: number) => number +>n : number +>m + n : number +>m : number +>n : number + +var e = arrrr()(3)()(4); +>e : number +>arrrr()(3)()(4) : number +>arrrr()(3)() : (n: number) => number +>arrrr()(3) : () => (n: number) => number +>arrrr() : (m: number) => () => (n: number) => number +>arrrr : () => (m: number) => () => (n: number) => number + +var e: number; +>e : number + +// Arrow function used in arrow function used in function +function someFn() { +>someFn : () => void + + var arr = (n: number) => (p: number) => p * n; +>arr : (n: number) => (p: number) => number +>(n: number) => (p: number) => p * n : (n: number) => (p: number) => number +>n : number +>(p: number) => p * n : (p: number) => number +>p : number +>p * n : number +>p : number +>n : number + + arr(3)(4).toExponential(); +>arr(3)(4).toExponential() : string +>arr(3)(4).toExponential : (fractionDigits?: number) => string +>arr(3)(4) : number +>arr(3) : (p: number) => number +>arr : (n: number) => (p: number) => number +>toExponential : (fractionDigits?: number) => string +} + +// Arrow function used in function +function someOtherFn() { +>someOtherFn : () => void + + var arr = (n: number) => '' + n; +>arr : (n: number) => string +>(n: number) => '' + n : (n: number) => string +>n : number +>'' + n : string +>n : number + + arr(4).charAt(0); +>arr(4).charAt(0) : string +>arr(4).charAt : (pos: number) => string +>arr(4) : string +>arr : (n: number) => string +>charAt : (pos: number) => string +} + +// Arrow function used in nested function in function +function outerFn() { +>outerFn : () => void + + function innerFn() { +>innerFn : () => void + + var arrowFn = () => { }; +>arrowFn : () => void +>() => { } : () => void + + var p = arrowFn(); +>p : void +>arrowFn() : void +>arrowFn : () => void + + var p: void; +>p : void + } +} + +// Arrow function used in nested function in arrow function +var f = (n: string) => { +>f : (n: string) => () => string +>(n: string) => { + function fn(x: number) { + return () => n + x; + } + return fn(4); +} : (n: string) => () => string +>n : string + + function fn(x: number) { +>fn : (x: number) => () => string +>x : number + + return () => n + x; +>() => n + x : () => string +>n + x : string +>n : string +>x : number + } + return fn(4); +>fn(4) : () => string +>fn : (x: number) => () => string +} +var g = f('')(); +>g : string +>f('')() : string +>f('') : () => string +>f : (n: string) => () => string + +var g: string; +>g : string + + +// Arrow function used in nested function in arrow function in nested function +function someOuterFn() { +>someOuterFn : () => (n: string) => () => () => number + + var arr = (n: string) => { +>arr : (n: string) => () => () => number +>(n: string) => { + function innerFn() { + return () => n.length; + } + return innerFn; + } : (n: string) => () => () => number +>n : string + + function innerFn() { +>innerFn : () => () => number + + return () => n.length; +>() => n.length : () => number +>n.length : number +>n : string +>length : number + } + return innerFn; +>innerFn : () => () => number + } + return arr; +>arr : (n: string) => () => () => number +} +var h = someOuterFn()('')()(); +>h : number +>someOuterFn()('')()() : number +>someOuterFn()('')() : () => number +>someOuterFn()('') : () => () => number +>someOuterFn() : (n: string) => () => () => number +>someOuterFn : () => (n: string) => () => () => number + +h.toExponential(); +>h.toExponential() : string +>h.toExponential : (fractionDigits?: number) => string +>h : number +>toExponential : (fractionDigits?: number) => string + +// Arrow function used in try/catch/finally in function +function tryCatchFn() { +>tryCatchFn : () => void + + try { + var x = () => this; +>x : () => any +>() => this : () => any +>this : any + + } catch (e) { +>e : any + + var t = () => e + this; +>t : () => any +>() => e + this : () => any +>e + this : any +>e : any +>this : any + + } finally { + var m = () => this + ''; +>m : () => string +>() => this + '' : () => string +>this + '' : string +>this : any + } +} + diff --git a/tests/baselines/reference/arrowFunctionInExpressionStatement1.types b/tests/baselines/reference/arrowFunctionInExpressionStatement1.types new file mode 100644 index 00000000000..a5360a18fc0 --- /dev/null +++ b/tests/baselines/reference/arrowFunctionInExpressionStatement1.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/arrowFunctionInExpressionStatement1.ts === +() => 0; +>() => 0 : () => number + diff --git a/tests/baselines/reference/arrowFunctionInExpressionStatement2.types b/tests/baselines/reference/arrowFunctionInExpressionStatement2.types new file mode 100644 index 00000000000..d4bb431fa8d --- /dev/null +++ b/tests/baselines/reference/arrowFunctionInExpressionStatement2.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/arrowFunctionInExpressionStatement2.ts === +module M { +>M : typeof M + + () => 0; +>() => 0 : () => number +} diff --git a/tests/baselines/reference/asiAmbientFunctionDeclaration.types b/tests/baselines/reference/asiAmbientFunctionDeclaration.types new file mode 100644 index 00000000000..40ad7f2ba94 --- /dev/null +++ b/tests/baselines/reference/asiAmbientFunctionDeclaration.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/asiAmbientFunctionDeclaration.ts === +declare function foo() +>foo : () => any + diff --git a/tests/baselines/reference/asiArith.types b/tests/baselines/reference/asiArith.types new file mode 100644 index 00000000000..5a4ae5fbcc4 --- /dev/null +++ b/tests/baselines/reference/asiArith.types @@ -0,0 +1,79 @@ +=== tests/cases/compiler/asiArith.ts === +var x = 1; +>x : number + +var y = 1; +>y : number + +var z = +>z : number + +x +>x + ++ + ++ + ++ + +y : number +>x : number + ++ + ++ +>+ + ++ + +y : number + ++ +>+ + +y : number + +y +>y : number + + +var a = 1; +>a : number + +var b = 1; +>b : number + +var c = +>c : number + +x +>x + +- + +- + +- + +y : number +>x : number + +- + +- +>- + +- + +y : number + +- +>- + +y : number + +y +>y : number + + diff --git a/tests/baselines/reference/asiBreak.types b/tests/baselines/reference/asiBreak.types new file mode 100644 index 00000000000..355d27f2a43 --- /dev/null +++ b/tests/baselines/reference/asiBreak.types @@ -0,0 +1,3 @@ +=== tests/cases/compiler/asiBreak.ts === +while (true) break +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/asiContinue.types b/tests/baselines/reference/asiContinue.types new file mode 100644 index 00000000000..5b3f0145377 --- /dev/null +++ b/tests/baselines/reference/asiContinue.types @@ -0,0 +1,3 @@ +=== tests/cases/compiler/asiContinue.ts === +while (true) continue +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/asiInES6Classes.types b/tests/baselines/reference/asiInES6Classes.types new file mode 100644 index 00000000000..aa80e3e073e --- /dev/null +++ b/tests/baselines/reference/asiInES6Classes.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/asiInES6Classes.ts === +class Foo { +>Foo : Foo + + + + defaults = { +>defaults : { done: boolean; } +>{ + + done: false + + } : { done: boolean; } + + done: false +>done : boolean + + } + + + + bar() { +>bar : () => number + + return 3; + + } + + + +} + diff --git a/tests/baselines/reference/assign1.types b/tests/baselines/reference/assign1.types new file mode 100644 index 00000000000..32b93af647d --- /dev/null +++ b/tests/baselines/reference/assign1.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/assign1.ts === +module M { +>M : typeof M + + interface I { +>I : I + + salt:number; +>salt : number + + pepper:number; +>pepper : number + } + + var x:I={salt:2,pepper:0}; +>x : I +>I : I +>{salt:2,pepper:0} : { salt: number; pepper: number; } +>salt : number +>pepper : number +} + diff --git a/tests/baselines/reference/assignEveryTypeToAny.types b/tests/baselines/reference/assignEveryTypeToAny.types new file mode 100644 index 00000000000..b25aba00837 --- /dev/null +++ b/tests/baselines/reference/assignEveryTypeToAny.types @@ -0,0 +1,162 @@ +=== tests/cases/conformance/types/any/assignEveryTypeToAny.ts === +// all of these are valid + +var x: any; +>x : any + +x = 1; +>x = 1 : number +>x : any + +var a = 2; +>a : number + +x = a; +>x = a : number +>x : any +>a : number + +x = true; +>x = true : boolean +>x : any + +var b = true; +>b : boolean + +x = b; +>x = b : boolean +>x : any +>b : boolean + +x = ""; +>x = "" : string +>x : any + +var c = ""; +>c : string + +x = c; +>x = c : string +>x : any +>c : string + +var d: void; +>d : void + +x = d; +>x = d : void +>x : any +>d : void + +var e = undefined; +>e : any +>undefined : undefined + +x = e; +>x = e : any +>x : any +>e : any + +var e2: typeof undefined; +>e2 : any +>undefined : undefined + +x = e2; +>x = e2 : any +>x : any +>e2 : any + +enum E { +>E : E + + A +>A : E +} + +x = E.A; +>x = E.A : E +>x : any +>E.A : E +>E : typeof E +>A : E + +var f = E.A; +>f : E +>E.A : E +>E : typeof E +>A : E + +x = f; +>x = f : E +>x : any +>f : E + +interface I { +>I : I + + foo: string; +>foo : string +} + +var g: I; +>g : I +>I : I + +x = g; +>x = g : I +>x : any +>g : I + +class C { +>C : C + + bar: string; +>bar : string +} + +var h: C; +>h : C +>C : C + +x = h; +>x = h : C +>x : any +>h : C + +var i: { (): string }; +>i : () => string + +x = i; +>x = i : () => string +>x : any +>i : () => string + +x = { f() { return 1; } } +>x = { f() { return 1; } } : { f: () => number; } +>x : any +>{ f() { return 1; } } : { f: () => number; } +>f : () => number +>f() { return 1; } : () => number + +x = { f(x: T) { return x; } } +>x = { f(x: T) { return x; } } : { f: (x: T) => T; } +>x : any +>{ f(x: T) { return x; } } : { f: (x: T) => T; } +>f : (x: T) => T +>f(x: T) { return x; } : (x: T) => T +>T : T +>x : T +>T : T +>x : T + +function j(a: T) { +>j : (a: T) => void +>T : T +>a : T +>T : T + + x = a; +>x = a : T +>x : any +>a : T +} diff --git a/tests/baselines/reference/assignToObjectTypeWithPrototypeProperty.types b/tests/baselines/reference/assignToObjectTypeWithPrototypeProperty.types new file mode 100644 index 00000000000..7ea260f8c15 --- /dev/null +++ b/tests/baselines/reference/assignToObjectTypeWithPrototypeProperty.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/assignToObjectTypeWithPrototypeProperty.ts === +class XEvent {} +>XEvent : XEvent + +var p: XEvent = XEvent.prototype; +>p : XEvent +>XEvent : XEvent +>XEvent.prototype : XEvent +>XEvent : typeof XEvent +>prototype : XEvent + +var x: {prototype: XEvent} = XEvent; +>x : { prototype: XEvent; } +>prototype : XEvent +>XEvent : XEvent +>XEvent : typeof XEvent + diff --git a/tests/baselines/reference/assignToPrototype1.types b/tests/baselines/reference/assignToPrototype1.types new file mode 100644 index 00000000000..6fec8d187d3 --- /dev/null +++ b/tests/baselines/reference/assignToPrototype1.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/assignToPrototype1.ts === +declare class Point { +>Point : Point + + add(dx: number, dy: number): void; +>add : (dx: number, dy: number) => void +>dx : number +>dy : number +} + +Point.prototype.add = function(dx, dy) { +>Point.prototype.add = function(dx, dy) { +} : (dx: number, dy: number) => void +>Point.prototype.add : (dx: number, dy: number) => void +>Point.prototype : Point +>Point : typeof Point +>prototype : Point +>add : (dx: number, dy: number) => void +>function(dx, dy) { +} : (dx: number, dy: number) => void +>dx : number +>dy : number + +}; diff --git a/tests/baselines/reference/assignmentCompatForEnums.types b/tests/baselines/reference/assignmentCompatForEnums.types new file mode 100644 index 00000000000..53e8caab638 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatForEnums.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/assignmentCompatForEnums.ts === +enum TokenType { One, Two }; +>TokenType : TokenType +>One : TokenType +>Two : TokenType + +var list = {}; +>list : {} +>{} : {} + + +function returnType(): TokenType { return null; } +>returnType : () => TokenType +>TokenType : TokenType + +function foo() { +>foo : () => void + + var x = returnType(); +>x : TokenType +>returnType() : TokenType +>returnType : () => TokenType + + var x: TokenType = list['one']; +>x : TokenType +>TokenType : TokenType +>list['one'] : any +>list : {} +} + + diff --git a/tests/baselines/reference/assignmentCompatOnNew.types b/tests/baselines/reference/assignmentCompatOnNew.types new file mode 100644 index 00000000000..19994e61df8 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatOnNew.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/assignmentCompatOnNew.ts === +class Foo{}; +>Foo : Foo + +function bar(x: {new(): Foo;}){} +>bar : (x: new () => Foo) => void +>x : new () => Foo +>Foo : Foo + +bar(Foo); // Error, but should be allowed +>bar(Foo) : void +>bar : (x: new () => Foo) => void +>Foo : typeof Foo + diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures3.types b/tests/baselines/reference/assignmentCompatWithCallSignatures3.types new file mode 100644 index 00000000000..39bdbced7b1 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.types @@ -0,0 +1,565 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts === +// these are all permitted with the current rules, since we do not do contextual signature instantiation + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Derived { baz: string; } +>Derived2 : Derived2 +>Derived : Derived +>baz : string + +class OtherDerived extends Base { bing: string; } +>OtherDerived : OtherDerived +>Base : Base +>bing : string + +var a: (x: number) => number[]; +>a : (x: number) => number[] +>x : number + +var a2: (x: number) => string[]; +>a2 : (x: number) => string[] +>x : number + +var a3: (x: number) => void; +>a3 : (x: number) => void +>x : number + +var a4: (x: string, y: number) => string; +>a4 : (x: string, y: number) => string +>x : string +>y : number + +var a5: (x: (arg: string) => number) => string; +>a5 : (x: (arg: string) => number) => string +>x : (arg: string) => number +>arg : string + +var a6: (x: (arg: Base) => Derived) => Base; +>a6 : (x: (arg: Base) => Derived) => Base +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>Base : Base + +var a7: (x: (arg: Base) => Derived) => (r: Base) => Derived; +>a7 : (x: (arg: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + +var a8: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; +>a8 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>y : (arg2: Base) => Derived +>arg2 : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + +var a9: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; +>a9 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>y : (arg2: Base) => Derived +>arg2 : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + +var a10: (...x: Derived[]) => Derived; +>a10 : (...x: Derived[]) => Derived +>x : Derived[] +>Derived : Derived +>Derived : Derived + +var a11: (x: { foo: string }, y: { foo: string; bar: string }) => Base; +>a11 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base +>x : { foo: string; } +>foo : string +>y : { foo: string; bar: string; } +>foo : string +>bar : string +>Base : Base + +var a12: (x: Array, y: Array) => Array; +>a12 : (x: Base[], y: Derived2[]) => Derived[] +>x : Base[] +>Array : Array +>Base : Base +>y : Derived2[] +>Array : Array +>Derived2 : Derived2 +>Array : Array +>Derived : Derived + +var a13: (x: Array, y: Array) => Array; +>a13 : (x: Base[], y: Derived[]) => Derived[] +>x : Base[] +>Array : Array +>Base : Base +>y : Derived[] +>Array : Array +>Derived : Derived +>Array : Array +>Derived : Derived + +var a14: (x: { a: string; b: number }) => Object; +>a14 : (x: { a: string; b: number; }) => Object +>x : { a: string; b: number; } +>a : string +>b : number +>Object : Object + +var a15: { +>a15 : { (x: number): number[]; (x: string): string[]; } + + (x: number): number[]; +>x : number + + (x: string): string[]; +>x : string +} +var a16: { +>a16 : { (x: T): number[]; (x: U): number[]; } + + (x: T): number[]; +>T : T +>Derived : Derived +>x : T +>T : T + + (x: U): number[]; +>U : U +>Base : Base +>x : U +>U : U +} +var a17: { +>a17 : { (x: (a: number) => number): number[]; (x: (a: string) => string): string[]; } + + (x: (a: number) => number): number[]; +>x : (a: number) => number +>a : number + + (x: (a: string) => string): string[]; +>x : (a: string) => string +>a : string + +}; +var a18: { +>a18 : { (x: { (a: number): number; (a: string): string; }): any[]; (x: { (a: boolean): boolean; (a: Date): Date; }): any[]; } + + (x: { +>x : { (a: number): number; (a: string): string; } + + (a: number): number; +>a : number + + (a: string): string; +>a : string + + }): any[]; + (x: { +>x : { (a: boolean): boolean; (a: Date): Date; } + + (a: boolean): boolean; +>a : boolean + + (a: Date): Date; +>a : Date +>Date : Date +>Date : Date + + }): any[]; +} + +var b: (x: T) => T[]; +>b : (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + +a = b; // ok +>a = b : (x: T) => T[] +>a : (x: number) => number[] +>b : (x: T) => T[] + +b = a; // ok +>b = a : (x: number) => number[] +>b : (x: T) => T[] +>a : (x: number) => number[] + +var b2: (x: T) => string[]; +>b2 : (x: T) => string[] +>T : T +>x : T +>T : T + +a2 = b2; // ok +>a2 = b2 : (x: T) => string[] +>a2 : (x: number) => string[] +>b2 : (x: T) => string[] + +b2 = a2; // ok +>b2 = a2 : (x: number) => string[] +>b2 : (x: T) => string[] +>a2 : (x: number) => string[] + +var b3: (x: T) => T; +>b3 : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +a3 = b3; // ok +>a3 = b3 : (x: T) => T +>a3 : (x: number) => void +>b3 : (x: T) => T + +b3 = a3; // ok +>b3 = a3 : (x: number) => void +>b3 : (x: T) => T +>a3 : (x: number) => void + +var b4: (x: T, y: U) => T; +>b4 : (x: T, y: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T + +a4 = b4; // ok +>a4 = b4 : (x: T, y: U) => T +>a4 : (x: string, y: number) => string +>b4 : (x: T, y: U) => T + +b4 = a4; // ok +>b4 = a4 : (x: string, y: number) => string +>b4 : (x: T, y: U) => T +>a4 : (x: string, y: number) => string + +var b5: (x: (arg: T) => U) => T; +>b5 : (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + +a5 = b5; // ok +>a5 = b5 : (x: (arg: T) => U) => T +>a5 : (x: (arg: string) => number) => string +>b5 : (x: (arg: T) => U) => T + +b5 = a5; // ok +>b5 = a5 : (x: (arg: string) => number) => string +>b5 : (x: (arg: T) => U) => T +>a5 : (x: (arg: string) => number) => string + +var b6: (x: (arg: T) => U) => T; +>b6 : (x: (arg: T) => U) => T +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + +a6 = b6; // ok +>a6 = b6 : (x: (arg: T) => U) => T +>a6 : (x: (arg: Base) => Derived) => Base +>b6 : (x: (arg: T) => U) => T + +b6 = a6; // ok +>b6 = a6 : (x: (arg: Base) => Derived) => Base +>b6 : (x: (arg: T) => U) => T +>a6 : (x: (arg: Base) => Derived) => Base + +var b7: (x: (arg: T) => U) => (r: T) => U; +>b7 : (x: (arg: T) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>r : T +>T : T +>U : U + +a7 = b7; // ok +>a7 = b7 : (x: (arg: T) => U) => (r: T) => U +>a7 : (x: (arg: Base) => Derived) => (r: Base) => Derived +>b7 : (x: (arg: T) => U) => (r: T) => U + +b7 = a7; // ok +>b7 = a7 : (x: (arg: Base) => Derived) => (r: Base) => Derived +>b7 : (x: (arg: T) => U) => (r: T) => U +>a7 : (x: (arg: Base) => Derived) => (r: Base) => Derived + +var b8: (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U; +>b8 : (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>y : (arg2: T) => U +>arg2 : T +>T : T +>U : U +>r : T +>T : T +>U : U + +a8 = b8; // ok +>a8 = b8 : (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U +>a8 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>b8 : (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U + +b8 = a8; // ok +>b8 = a8 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>b8 : (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U +>a8 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived + +var b9: (x: (arg: T) => U, y: (arg2: { foo: string; bing: number }) => U) => (r: T) => U; +>b9 : (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>y : (arg2: { foo: string; bing: number; }) => U +>arg2 : { foo: string; bing: number; } +>foo : string +>bing : number +>U : U +>r : T +>T : T +>U : U + +a9 = b9; // ok +>a9 = b9 : (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U +>a9 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>b9 : (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U + +b9 = a9; // ok +>b9 = a9 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>b9 : (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U +>a9 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived + +var b10: (...x: T[]) => T; +>b10 : (...x: T[]) => T +>T : T +>Derived : Derived +>x : T[] +>T : T +>T : T + +a10 = b10; // ok +>a10 = b10 : (...x: T[]) => T +>a10 : (...x: Derived[]) => Derived +>b10 : (...x: T[]) => T + +b10 = a10; // ok +>b10 = a10 : (...x: Derived[]) => Derived +>b10 : (...x: T[]) => T +>a10 : (...x: Derived[]) => Derived + +var b11: (x: T, y: T) => T; +>b11 : (x: T, y: T) => T +>T : T +>Base : Base +>x : T +>T : T +>y : T +>T : T +>T : T + +a11 = b11; // ok +>a11 = b11 : (x: T, y: T) => T +>a11 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base +>b11 : (x: T, y: T) => T + +b11 = a11; // ok +>b11 = a11 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base +>b11 : (x: T, y: T) => T +>a11 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base + +var b12: >(x: Array, y: T) => Array; +>b12 : (x: Base[], y: T) => Derived[] +>T : T +>Array : Array +>Base : Base +>x : Base[] +>Array : Array +>Base : Base +>y : T +>T : T +>Array : Array +>Derived : Derived + +a12 = b12; // ok +>a12 = b12 : (x: Base[], y: T) => Derived[] +>a12 : (x: Base[], y: Derived2[]) => Derived[] +>b12 : (x: Base[], y: T) => Derived[] + +b12 = a12; // ok +>b12 = a12 : (x: Base[], y: Derived2[]) => Derived[] +>b12 : (x: Base[], y: T) => Derived[] +>a12 : (x: Base[], y: Derived2[]) => Derived[] + +var b13: >(x: Array, y: T) => T; +>b13 : (x: Base[], y: T) => T +>T : T +>Array : Array +>Derived : Derived +>x : Base[] +>Array : Array +>Base : Base +>y : T +>T : T +>T : T + +a13 = b13; // ok +>a13 = b13 : (x: Base[], y: T) => T +>a13 : (x: Base[], y: Derived[]) => Derived[] +>b13 : (x: Base[], y: T) => T + +b13 = a13; // ok +>b13 = a13 : (x: Base[], y: Derived[]) => Derived[] +>b13 : (x: Base[], y: T) => T +>a13 : (x: Base[], y: Derived[]) => Derived[] + +var b14: (x: { a: T; b: T }) => T; +>b14 : (x: { a: T; b: T; }) => T +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + +a14 = b14; // ok +>a14 = b14 : (x: { a: T; b: T; }) => T +>a14 : (x: { a: string; b: number; }) => Object +>b14 : (x: { a: T; b: T; }) => T + +b14 = a14; // ok +>b14 = a14 : (x: { a: string; b: number; }) => Object +>b14 : (x: { a: T; b: T; }) => T +>a14 : (x: { a: string; b: number; }) => Object + +var b15: (x: T) => T[]; +>b15 : (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + +a15 = b15; // ok +>a15 = b15 : (x: T) => T[] +>a15 : { (x: number): number[]; (x: string): string[]; } +>b15 : (x: T) => T[] + +b15 = a15; // ok +>b15 = a15 : { (x: number): number[]; (x: string): string[]; } +>b15 : (x: T) => T[] +>a15 : { (x: number): number[]; (x: string): string[]; } + +var b16: (x: T) => number[]; +>b16 : (x: T) => number[] +>T : T +>Base : Base +>x : T +>T : T + +a16 = b16; // ok +>a16 = b16 : (x: T) => number[] +>a16 : { (x: T): number[]; (x: U): number[]; } +>b16 : (x: T) => number[] + +b16 = a16; // ok +>b16 = a16 : { (x: T): number[]; (x: U): number[]; } +>b16 : (x: T) => number[] +>a16 : { (x: T): number[]; (x: U): number[]; } + +var b17: (x: (a: T) => T) => T[]; // ok +>b17 : (x: (a: T) => T) => T[] +>T : T +>x : (a: T) => T +>a : T +>T : T +>T : T +>T : T + +a17 = b17; // ok +>a17 = b17 : (x: (a: T) => T) => T[] +>a17 : { (x: (a: number) => number): number[]; (x: (a: string) => string): string[]; } +>b17 : (x: (a: T) => T) => T[] + +b17 = a17; // ok +>b17 = a17 : { (x: (a: number) => number): number[]; (x: (a: string) => string): string[]; } +>b17 : (x: (a: T) => T) => T[] +>a17 : { (x: (a: number) => number): number[]; (x: (a: string) => string): string[]; } + +var b18: (x: (a: T) => T) => T[]; +>b18 : (x: (a: T) => T) => T[] +>T : T +>x : (a: T) => T +>a : T +>T : T +>T : T +>T : T + +a18 = b18; // ok +>a18 = b18 : (x: (a: T) => T) => T[] +>a18 : { (x: { (a: number): number; (a: string): string; }): any[]; (x: { (a: boolean): boolean; (a: Date): Date; }): any[]; } +>b18 : (x: (a: T) => T) => T[] + +b18 = a18; // ok +>b18 = a18 : { (x: { (a: number): number; (a: string): string; }): any[]; (x: { (a: boolean): boolean; (a: Date): Date; }): any[]; } +>b18 : (x: (a: T) => T) => T[] +>a18 : { (x: { (a: number): number; (a: string): string; }): any[]; (x: { (a: boolean): boolean; (a: Date): Date; }): any[]; } + diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures5.types b/tests/baselines/reference/assignmentCompatWithCallSignatures5.types new file mode 100644 index 00000000000..2652a2a4e68 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures5.types @@ -0,0 +1,380 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures5.ts === +// checking assignment compat for function types. No errors in this file + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Derived { baz: string; } +>Derived2 : Derived2 +>Derived : Derived +>baz : string + +class OtherDerived extends Base { bing: string; } +>OtherDerived : OtherDerived +>Base : Base +>bing : string + +var a: (x: T) => T[]; +>a : (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + +var a2: (x: T) => string[]; +>a2 : (x: T) => string[] +>T : T +>x : T +>T : T + +var a3: (x: T) => void; +>a3 : (x: T) => void +>T : T +>x : T +>T : T + +var a4: (x: T, y: U) => string; +>a4 : (x: T, y: U) => string +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U + +var a5: (x: (arg: T) => U) => T; +>a5 : (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + +var a6: (x: (arg: T) => Derived) => T; +>a6 : (x: (arg: T) => Derived) => T +>T : T +>Base : Base +>x : (arg: T) => Derived +>arg : T +>T : T +>Derived : Derived +>T : T + +var a11: (x: { foo: T }, y: { foo: T; bar: T }) => Base; +>a11 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>T : T +>x : { foo: T; } +>foo : T +>T : T +>y : { foo: T; bar: T; } +>foo : T +>T : T +>bar : T +>T : T +>Base : Base + +var a15: (x: { a: T; b: T }) => T[]; +>a15 : (x: { a: T; b: T; }) => T[] +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + +var a16: (x: { a: T; b: T }) => T[]; +>a16 : (x: { a: T; b: T; }) => T[] +>T : T +>Base : Base +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + +var a17: { +>a17 : { (x: (a: T) => T): T[]; (x: (a: T) => T): T[]; } + + (x: (a: T) => T): T[]; +>T : T +>Derived : Derived +>x : (a: T) => T +>a : T +>T : T +>T : T +>T : T + + (x: (a: T) => T): T[]; +>T : T +>Base : Base +>x : (a: T) => T +>a : T +>T : T +>T : T +>T : T + +}; +var a18: { +>a18 : { (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[]; } + + (x: { +>x : { (a: T): T; (a: T): T; } + + (a: T): T; +>T : T +>Derived : Derived +>a : T +>T : T +>T : T + + (a: T): T; +>T : T +>Base : Base +>a : T +>T : T +>T : T + + }): any[]; + (x: { +>x : { (a: T): T; (a: T): T; } + + (a: T): T; +>T : T +>Derived2 : Derived2 +>a : T +>T : T +>T : T + + (a: T): T; +>T : T +>Base : Base +>a : T +>T : T +>T : T + + }): any[]; +}; + +var b: (x: T) => T[]; +>b : (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + +a = b; // ok +>a = b : (x: T) => T[] +>a : (x: T) => T[] +>b : (x: T) => T[] + +b = a; // ok +>b = a : (x: T) => T[] +>b : (x: T) => T[] +>a : (x: T) => T[] + +var b2: (x: T) => string[]; +>b2 : (x: T) => string[] +>T : T +>x : T +>T : T + +a2 = b2; // ok +>a2 = b2 : (x: T) => string[] +>a2 : (x: T) => string[] +>b2 : (x: T) => string[] + +b2 = a2; // ok +>b2 = a2 : (x: T) => string[] +>b2 : (x: T) => string[] +>a2 : (x: T) => string[] + +var b3: (x: T) => T; +>b3 : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +a3 = b3; // ok +>a3 = b3 : (x: T) => T +>a3 : (x: T) => void +>b3 : (x: T) => T + +b3 = a3; // ok +>b3 = a3 : (x: T) => void +>b3 : (x: T) => T +>a3 : (x: T) => void + +var b4: (x: T, y: U) => string; +>b4 : (x: T, y: U) => string +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U + +a4 = b4; // ok +>a4 = b4 : (x: T, y: U) => string +>a4 : (x: T, y: U) => string +>b4 : (x: T, y: U) => string + +b4 = a4; // ok +>b4 = a4 : (x: T, y: U) => string +>b4 : (x: T, y: U) => string +>a4 : (x: T, y: U) => string + +var b5: (x: (arg: T) => U) => T; +>b5 : (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + +a5 = b5; // ok +>a5 = b5 : (x: (arg: T) => U) => T +>a5 : (x: (arg: T) => U) => T +>b5 : (x: (arg: T) => U) => T + +b5 = a5; // ok +>b5 = a5 : (x: (arg: T) => U) => T +>b5 : (x: (arg: T) => U) => T +>a5 : (x: (arg: T) => U) => T + +var b6: (x: (arg: T) => U) => T; +>b6 : (x: (arg: T) => U) => T +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + +a6 = b6; // ok +>a6 = b6 : (x: (arg: T) => U) => T +>a6 : (x: (arg: T) => Derived) => T +>b6 : (x: (arg: T) => U) => T + +b6 = a6; // ok +>b6 = a6 : (x: (arg: T) => Derived) => T +>b6 : (x: (arg: T) => U) => T +>a6 : (x: (arg: T) => Derived) => T + +var b11: (x: { foo: T }, y: { foo: U; bar: U }) => Base; +>b11 : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base +>T : T +>U : U +>x : { foo: T; } +>foo : T +>T : T +>y : { foo: U; bar: U; } +>foo : U +>U : U +>bar : U +>U : U +>Base : Base + +a11 = b11; // ok +>a11 = b11 : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base +>a11 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>b11 : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base + +b11 = a11; // ok +>b11 = a11 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>b11 : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base +>a11 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base + +var b15: (x: { a: U; b: V; }) => U[]; +>b15 : (x: { a: U; b: V; }) => U[] +>U : U +>V : V +>x : { a: U; b: V; } +>a : U +>U : U +>b : V +>V : V +>U : U + +a15 = b15; // ok, T = U, T = V +>a15 = b15 : (x: { a: U; b: V; }) => U[] +>a15 : (x: { a: T; b: T; }) => T[] +>b15 : (x: { a: U; b: V; }) => U[] + +b15 = a15; // ok +>b15 = a15 : (x: { a: T; b: T; }) => T[] +>b15 : (x: { a: U; b: V; }) => U[] +>a15 : (x: { a: T; b: T; }) => T[] + +var b16: (x: { a: T; b: T }) => T[]; +>b16 : (x: { a: T; b: T; }) => T[] +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + +a15 = b16; // ok +>a15 = b16 : (x: { a: T; b: T; }) => T[] +>a15 : (x: { a: T; b: T; }) => T[] +>b16 : (x: { a: T; b: T; }) => T[] + +b15 = a16; // ok +>b15 = a16 : (x: { a: T; b: T; }) => T[] +>b15 : (x: { a: U; b: V; }) => U[] +>a16 : (x: { a: T; b: T; }) => T[] + +var b17: (x: (a: T) => T) => T[]; +>b17 : (x: (a: T) => T) => T[] +>T : T +>x : (a: T) => T +>a : T +>T : T +>T : T +>T : T + +a17 = b17; // ok +>a17 = b17 : (x: (a: T) => T) => T[] +>a17 : { (x: (a: T) => T): T[]; (x: (a: T) => T): T[]; } +>b17 : (x: (a: T) => T) => T[] + +b17 = a17; // ok +>b17 = a17 : { (x: (a: T) => T): T[]; (x: (a: T) => T): T[]; } +>b17 : (x: (a: T) => T) => T[] +>a17 : { (x: (a: T) => T): T[]; (x: (a: T) => T): T[]; } + +var b18: (x: (a: T) => T) => any[]; +>b18 : (x: (a: T) => T) => any[] +>x : (a: T) => T +>T : T +>a : T +>T : T +>T : T + +a18 = b18; // ok +>a18 = b18 : (x: (a: T) => T) => any[] +>a18 : { (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[]; } +>b18 : (x: (a: T) => T) => any[] + +b18 = a18; // ok +>b18 = a18 : { (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[]; } +>b18 : (x: (a: T) => T) => any[] +>a18 : { (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[]; } + diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures6.types b/tests/baselines/reference/assignmentCompatWithCallSignatures6.types new file mode 100644 index 00000000000..b45f3357942 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures6.types @@ -0,0 +1,273 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures6.ts === +// checking assignment compatibility relations for function types. All valid + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Derived { baz: string; } +>Derived2 : Derived2 +>Derived : Derived +>baz : string + +class OtherDerived extends Base { bing: string; } +>OtherDerived : OtherDerived +>Base : Base +>bing : string + +interface A { +>A : A + + a: (x: T) => T[]; +>a : (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + + a2: (x: T) => string[]; +>a2 : (x: T) => string[] +>T : T +>x : T +>T : T + + a3: (x: T) => void; +>a3 : (x: T) => void +>T : T +>x : T +>T : T + + a4: (x: T, y: U) => string; +>a4 : (x: T, y: U) => string +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U + + a5: (x: (arg: T) => U) => T; +>a5 : (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a6: (x: (arg: T) => Derived) => T; +>a6 : (x: (arg: T) => Derived) => T +>T : T +>Base : Base +>x : (arg: T) => Derived +>arg : T +>T : T +>Derived : Derived +>T : T + + a11: (x: { foo: T }, y: { foo: T; bar: T }) => Base; +>a11 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>T : T +>x : { foo: T; } +>foo : T +>T : T +>y : { foo: T; bar: T; } +>foo : T +>T : T +>bar : T +>T : T +>Base : Base + + a15: (x: { a: T; b: T }) => T[]; +>a15 : (x: { a: T; b: T; }) => T[] +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + + a16: (x: { a: T; b: T }) => T[]; +>a16 : (x: { a: T; b: T; }) => T[] +>T : T +>Base : Base +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T +} + +var x: A; +>x : A +>A : A + +var b: (x: T) => T[]; +>b : (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + +x.a = b; +>x.a = b : (x: T) => T[] +>x.a : (x: T) => T[] +>x : A +>a : (x: T) => T[] +>b : (x: T) => T[] + +b = x.a; +>b = x.a : (x: T) => T[] +>b : (x: T) => T[] +>x.a : (x: T) => T[] +>x : A +>a : (x: T) => T[] + +var b2: (x: T) => string[]; +>b2 : (x: T) => string[] +>T : T +>x : T +>T : T + +x.a2 = b2; +>x.a2 = b2 : (x: T) => string[] +>x.a2 : (x: T) => string[] +>x : A +>a2 : (x: T) => string[] +>b2 : (x: T) => string[] + +b2 = x.a2; +>b2 = x.a2 : (x: T) => string[] +>b2 : (x: T) => string[] +>x.a2 : (x: T) => string[] +>x : A +>a2 : (x: T) => string[] + +var b3: (x: T) => T; +>b3 : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +x.a3 = b3; +>x.a3 = b3 : (x: T) => T +>x.a3 : (x: T) => void +>x : A +>a3 : (x: T) => void +>b3 : (x: T) => T + +b3 = x.a3; +>b3 = x.a3 : (x: T) => void +>b3 : (x: T) => T +>x.a3 : (x: T) => void +>x : A +>a3 : (x: T) => void + +var b4: (x: T, y: U) => string; +>b4 : (x: T, y: U) => string +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U + +x.a4 = b4; +>x.a4 = b4 : (x: T, y: U) => string +>x.a4 : (x: T, y: U) => string +>x : A +>a4 : (x: T, y: U) => string +>b4 : (x: T, y: U) => string + +b4 = x.a4; +>b4 = x.a4 : (x: T, y: U) => string +>b4 : (x: T, y: U) => string +>x.a4 : (x: T, y: U) => string +>x : A +>a4 : (x: T, y: U) => string + +var b5: (x: (arg: T) => U) => T; +>b5 : (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + +x.a5 = b5; +>x.a5 = b5 : (x: (arg: T) => U) => T +>x.a5 : (x: (arg: T) => U) => T +>x : A +>a5 : (x: (arg: T) => U) => T +>b5 : (x: (arg: T) => U) => T + +b5 = x.a5; +>b5 = x.a5 : (x: (arg: T) => U) => T +>b5 : (x: (arg: T) => U) => T +>x.a5 : (x: (arg: T) => U) => T +>x : A +>a5 : (x: (arg: T) => U) => T + +var b11: (x: { foo: T }, y: { foo: U; bar: U }) => Base; +>b11 : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base +>T : T +>U : U +>x : { foo: T; } +>foo : T +>T : T +>y : { foo: U; bar: U; } +>foo : U +>U : U +>bar : U +>U : U +>Base : Base + +x.a11 = b11; +>x.a11 = b11 : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base +>x.a11 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>x : A +>a11 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>b11 : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base + +b11 = x.a11; +>b11 = x.a11 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>b11 : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base +>x.a11 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>x : A +>a11 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base + +var b16: (x: { a: T; b: T }) => T[]; +>b16 : (x: { a: T; b: T; }) => T[] +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + +x.a16 = b16; +>x.a16 = b16 : (x: { a: T; b: T; }) => T[] +>x.a16 : (x: { a: T; b: T; }) => T[] +>x : A +>a16 : (x: { a: T; b: T; }) => T[] +>b16 : (x: { a: T; b: T; }) => T[] + +b16 = x.a16; +>b16 = x.a16 : (x: { a: T; b: T; }) => T[] +>b16 : (x: { a: T; b: T; }) => T[] +>x.a16 : (x: { a: T; b: T; }) => T[] +>x : A +>a16 : (x: { a: T; b: T; }) => T[] + diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.types b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.types new file mode 100644 index 00000000000..aeefd4dee02 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.types @@ -0,0 +1,565 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts === +// checking assignment compatibility relations for function types. All of these are valid. + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Derived { baz: string; } +>Derived2 : Derived2 +>Derived : Derived +>baz : string + +class OtherDerived extends Base { bing: string; } +>OtherDerived : OtherDerived +>Base : Base +>bing : string + +var a: new (x: number) => number[]; +>a : new (x: number) => number[] +>x : number + +var a2: new (x: number) => string[]; +>a2 : new (x: number) => string[] +>x : number + +var a3: new (x: number) => void; +>a3 : new (x: number) => void +>x : number + +var a4: new (x: string, y: number) => string; +>a4 : new (x: string, y: number) => string +>x : string +>y : number + +var a5: new (x: (arg: string) => number) => string; +>a5 : new (x: (arg: string) => number) => string +>x : (arg: string) => number +>arg : string + +var a6: new (x: (arg: Base) => Derived) => Base; +>a6 : new (x: (arg: Base) => Derived) => Base +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>Base : Base + +var a7: new (x: (arg: Base) => Derived) => (r: Base) => Derived; +>a7 : new (x: (arg: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + +var a8: new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; +>a8 : new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>y : (arg2: Base) => Derived +>arg2 : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + +var a9: new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; +>a9 : new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>y : (arg2: Base) => Derived +>arg2 : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + +var a10: new (...x: Derived[]) => Derived; +>a10 : new (...x: Derived[]) => Derived +>x : Derived[] +>Derived : Derived +>Derived : Derived + +var a11: new (x: { foo: string }, y: { foo: string; bar: string }) => Base; +>a11 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base +>x : { foo: string; } +>foo : string +>y : { foo: string; bar: string; } +>foo : string +>bar : string +>Base : Base + +var a12: new (x: Array, y: Array) => Array; +>a12 : new (x: Base[], y: Derived2[]) => Derived[] +>x : Base[] +>Array : Array +>Base : Base +>y : Derived2[] +>Array : Array +>Derived2 : Derived2 +>Array : Array +>Derived : Derived + +var a13: new (x: Array, y: Array) => Array; +>a13 : new (x: Base[], y: Derived[]) => Derived[] +>x : Base[] +>Array : Array +>Base : Base +>y : Derived[] +>Array : Array +>Derived : Derived +>Array : Array +>Derived : Derived + +var a14: new (x: { a: string; b: number }) => Object; +>a14 : new (x: { a: string; b: number; }) => Object +>x : { a: string; b: number; } +>a : string +>b : number +>Object : Object + +var a15: { +>a15 : { new (x: number): number[]; new (x: string): string[]; } + + new (x: number): number[]; +>x : number + + new (x: string): string[]; +>x : string +} +var a16: { +>a16 : { new (x: T): number[]; new (x: U): number[]; } + + new (x: T): number[]; +>T : T +>Derived : Derived +>x : T +>T : T + + new (x: U): number[]; +>U : U +>Base : Base +>x : U +>U : U +} +var a17: { +>a17 : { new (x: new (a: number) => number): number[]; new (x: new (a: string) => string): string[]; } + + new (x: new (a: number) => number): number[]; +>x : new (a: number) => number +>a : number + + new (x: new (a: string) => string): string[]; +>x : new (a: string) => string +>a : string + +}; +var a18: { +>a18 : { new (x: { new (a: number): number; new (a: string): string; }): any[]; new (x: { new (a: boolean): boolean; new (a: Date): Date; }): any[]; } + + new (x: { +>x : { new (a: number): number; new (a: string): string; } + + new (a: number): number; +>a : number + + new (a: string): string; +>a : string + + }): any[]; + new (x: { +>x : { new (a: boolean): boolean; new (a: Date): Date; } + + new (a: boolean): boolean; +>a : boolean + + new (a: Date): Date; +>a : Date +>Date : Date +>Date : Date + + }): any[]; +} + +var b: new (x: T) => T[]; +>b : new (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + +a = b; // ok +>a = b : new (x: T) => T[] +>a : new (x: number) => number[] +>b : new (x: T) => T[] + +b = a; // ok +>b = a : new (x: number) => number[] +>b : new (x: T) => T[] +>a : new (x: number) => number[] + +var b2: new (x: T) => string[]; +>b2 : new (x: T) => string[] +>T : T +>x : T +>T : T + +a2 = b2; // ok +>a2 = b2 : new (x: T) => string[] +>a2 : new (x: number) => string[] +>b2 : new (x: T) => string[] + +b2 = a2; // ok +>b2 = a2 : new (x: number) => string[] +>b2 : new (x: T) => string[] +>a2 : new (x: number) => string[] + +var b3: new (x: T) => T; +>b3 : new (x: T) => T +>T : T +>x : T +>T : T +>T : T + +a3 = b3; // ok +>a3 = b3 : new (x: T) => T +>a3 : new (x: number) => void +>b3 : new (x: T) => T + +b3 = a3; // ok +>b3 = a3 : new (x: number) => void +>b3 : new (x: T) => T +>a3 : new (x: number) => void + +var b4: new (x: T, y: U) => T; +>b4 : new (x: T, y: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T + +a4 = b4; // ok +>a4 = b4 : new (x: T, y: U) => T +>a4 : new (x: string, y: number) => string +>b4 : new (x: T, y: U) => T + +b4 = a4; // ok +>b4 = a4 : new (x: string, y: number) => string +>b4 : new (x: T, y: U) => T +>a4 : new (x: string, y: number) => string + +var b5: new (x: (arg: T) => U) => T; +>b5 : new (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + +a5 = b5; // ok +>a5 = b5 : new (x: (arg: T) => U) => T +>a5 : new (x: (arg: string) => number) => string +>b5 : new (x: (arg: T) => U) => T + +b5 = a5; // ok +>b5 = a5 : new (x: (arg: string) => number) => string +>b5 : new (x: (arg: T) => U) => T +>a5 : new (x: (arg: string) => number) => string + +var b6: new (x: (arg: T) => U) => T; +>b6 : new (x: (arg: T) => U) => T +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + +a6 = b6; // ok +>a6 = b6 : new (x: (arg: T) => U) => T +>a6 : new (x: (arg: Base) => Derived) => Base +>b6 : new (x: (arg: T) => U) => T + +b6 = a6; // ok +>b6 = a6 : new (x: (arg: Base) => Derived) => Base +>b6 : new (x: (arg: T) => U) => T +>a6 : new (x: (arg: Base) => Derived) => Base + +var b7: new (x: (arg: T) => U) => (r: T) => U; +>b7 : new (x: (arg: T) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>r : T +>T : T +>U : U + +a7 = b7; // ok +>a7 = b7 : new (x: (arg: T) => U) => (r: T) => U +>a7 : new (x: (arg: Base) => Derived) => (r: Base) => Derived +>b7 : new (x: (arg: T) => U) => (r: T) => U + +b7 = a7; // ok +>b7 = a7 : new (x: (arg: Base) => Derived) => (r: Base) => Derived +>b7 : new (x: (arg: T) => U) => (r: T) => U +>a7 : new (x: (arg: Base) => Derived) => (r: Base) => Derived + +var b8: new (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U; +>b8 : new (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>y : (arg2: T) => U +>arg2 : T +>T : T +>U : U +>r : T +>T : T +>U : U + +a8 = b8; // ok +>a8 = b8 : new (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U +>a8 : new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>b8 : new (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U + +b8 = a8; // ok +>b8 = a8 : new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>b8 : new (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U +>a8 : new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived + +var b9: new (x: (arg: T) => U, y: (arg2: { foo: string; bing: number }) => U) => (r: T) => U; +>b9 : new (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>y : (arg2: { foo: string; bing: number; }) => U +>arg2 : { foo: string; bing: number; } +>foo : string +>bing : number +>U : U +>r : T +>T : T +>U : U + +a9 = b9; // ok +>a9 = b9 : new (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U +>a9 : new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>b9 : new (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U + +b9 = a9; // ok +>b9 = a9 : new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>b9 : new (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U +>a9 : new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived + +var b10: new (...x: T[]) => T; +>b10 : new (...x: T[]) => T +>T : T +>Derived : Derived +>x : T[] +>T : T +>T : T + +a10 = b10; // ok +>a10 = b10 : new (...x: T[]) => T +>a10 : new (...x: Derived[]) => Derived +>b10 : new (...x: T[]) => T + +b10 = a10; // ok +>b10 = a10 : new (...x: Derived[]) => Derived +>b10 : new (...x: T[]) => T +>a10 : new (...x: Derived[]) => Derived + +var b11: new (x: T, y: T) => T; +>b11 : new (x: T, y: T) => T +>T : T +>Base : Base +>x : T +>T : T +>y : T +>T : T +>T : T + +a11 = b11; // ok +>a11 = b11 : new (x: T, y: T) => T +>a11 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base +>b11 : new (x: T, y: T) => T + +b11 = a11; // ok +>b11 = a11 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base +>b11 : new (x: T, y: T) => T +>a11 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base + +var b12: new >(x: Array, y: T) => Array; +>b12 : new (x: Base[], y: T) => Derived[] +>T : T +>Array : Array +>Base : Base +>x : Base[] +>Array : Array +>Base : Base +>y : T +>T : T +>Array : Array +>Derived : Derived + +a12 = b12; // ok +>a12 = b12 : new (x: Base[], y: T) => Derived[] +>a12 : new (x: Base[], y: Derived2[]) => Derived[] +>b12 : new (x: Base[], y: T) => Derived[] + +b12 = a12; // ok +>b12 = a12 : new (x: Base[], y: Derived2[]) => Derived[] +>b12 : new (x: Base[], y: T) => Derived[] +>a12 : new (x: Base[], y: Derived2[]) => Derived[] + +var b13: new >(x: Array, y: T) => T; +>b13 : new (x: Base[], y: T) => T +>T : T +>Array : Array +>Derived : Derived +>x : Base[] +>Array : Array +>Base : Base +>y : T +>T : T +>T : T + +a13 = b13; // ok +>a13 = b13 : new (x: Base[], y: T) => T +>a13 : new (x: Base[], y: Derived[]) => Derived[] +>b13 : new (x: Base[], y: T) => T + +b13 = a13; // ok +>b13 = a13 : new (x: Base[], y: Derived[]) => Derived[] +>b13 : new (x: Base[], y: T) => T +>a13 : new (x: Base[], y: Derived[]) => Derived[] + +var b14: new (x: { a: T; b: T }) => T; +>b14 : new (x: { a: T; b: T; }) => T +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + +a14 = b14; // ok +>a14 = b14 : new (x: { a: T; b: T; }) => T +>a14 : new (x: { a: string; b: number; }) => Object +>b14 : new (x: { a: T; b: T; }) => T + +b14 = a14; // ok +>b14 = a14 : new (x: { a: string; b: number; }) => Object +>b14 : new (x: { a: T; b: T; }) => T +>a14 : new (x: { a: string; b: number; }) => Object + +var b15: new (x: T) => T[]; +>b15 : new (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + +a15 = b15; // ok +>a15 = b15 : new (x: T) => T[] +>a15 : { new (x: number): number[]; new (x: string): string[]; } +>b15 : new (x: T) => T[] + +b15 = a15; // ok +>b15 = a15 : { new (x: number): number[]; new (x: string): string[]; } +>b15 : new (x: T) => T[] +>a15 : { new (x: number): number[]; new (x: string): string[]; } + +var b16: new (x: T) => number[]; +>b16 : new (x: T) => number[] +>T : T +>Base : Base +>x : T +>T : T + +a16 = b16; // ok +>a16 = b16 : new (x: T) => number[] +>a16 : { new (x: T): number[]; new (x: U): number[]; } +>b16 : new (x: T) => number[] + +b16 = a16; // ok +>b16 = a16 : { new (x: T): number[]; new (x: U): number[]; } +>b16 : new (x: T) => number[] +>a16 : { new (x: T): number[]; new (x: U): number[]; } + +var b17: new (x: new (a: T) => T) => T[]; // ok +>b17 : new (x: new (a: T) => T) => T[] +>T : T +>x : new (a: T) => T +>a : T +>T : T +>T : T +>T : T + +a17 = b17; // ok +>a17 = b17 : new (x: new (a: T) => T) => T[] +>a17 : { new (x: new (a: number) => number): number[]; new (x: new (a: string) => string): string[]; } +>b17 : new (x: new (a: T) => T) => T[] + +b17 = a17; // ok +>b17 = a17 : { new (x: new (a: number) => number): number[]; new (x: new (a: string) => string): string[]; } +>b17 : new (x: new (a: T) => T) => T[] +>a17 : { new (x: new (a: number) => number): number[]; new (x: new (a: string) => string): string[]; } + +var b18: new (x: new (a: T) => T) => T[]; +>b18 : new (x: new (a: T) => T) => T[] +>T : T +>x : new (a: T) => T +>a : T +>T : T +>T : T +>T : T + +a18 = b18; // ok +>a18 = b18 : new (x: new (a: T) => T) => T[] +>a18 : { new (x: { new (a: number): number; new (a: string): string; }): any[]; new (x: { new (a: boolean): boolean; new (a: Date): Date; }): any[]; } +>b18 : new (x: new (a: T) => T) => T[] + +b18 = a18; // ok +>b18 = a18 : { new (x: { new (a: number): number; new (a: string): string; }): any[]; new (x: { new (a: boolean): boolean; new (a: Date): Date; }): any[]; } +>b18 : new (x: new (a: T) => T) => T[] +>a18 : { new (x: { new (a: number): number; new (a: string): string; }): any[]; new (x: { new (a: boolean): boolean; new (a: Date): Date; }): any[]; } + diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.types b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.types new file mode 100644 index 00000000000..6e6a1457a76 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.types @@ -0,0 +1,380 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures5.ts === +// checking assignment compat for function types. All valid + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Derived { baz: string; } +>Derived2 : Derived2 +>Derived : Derived +>baz : string + +class OtherDerived extends Base { bing: string; } +>OtherDerived : OtherDerived +>Base : Base +>bing : string + +var a: new (x: T) => T[]; +>a : new (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + +var a2: new (x: T) => string[]; +>a2 : new (x: T) => string[] +>T : T +>x : T +>T : T + +var a3: new (x: T) => void; +>a3 : new (x: T) => void +>T : T +>x : T +>T : T + +var a4: new (x: T, y: U) => string; +>a4 : new (x: T, y: U) => string +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U + +var a5: new (x: new (arg: T) => U) => T; +>a5 : new (x: new (arg: T) => U) => T +>T : T +>U : U +>x : new (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + +var a6: new (x: new (arg: T) => Derived) => T; +>a6 : new (x: new (arg: T) => Derived) => T +>T : T +>Base : Base +>x : new (arg: T) => Derived +>arg : T +>T : T +>Derived : Derived +>T : T + +var a11: new (x: { foo: T }, y: { foo: T; bar: T }) => Base; +>a11 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>T : T +>x : { foo: T; } +>foo : T +>T : T +>y : { foo: T; bar: T; } +>foo : T +>T : T +>bar : T +>T : T +>Base : Base + +var a15: new (x: { a: T; b: T }) => T[]; +>a15 : new (x: { a: T; b: T; }) => T[] +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + +var a16: new (x: { a: T; b: T }) => T[]; +>a16 : new (x: { a: T; b: T; }) => T[] +>T : T +>Base : Base +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + +var a17: { +>a17 : { new (x: new (a: T) => T): T[]; new (x: new (a: T) => T): T[]; } + + new (x: new (a: T) => T): T[]; +>T : T +>Derived : Derived +>x : new (a: T) => T +>a : T +>T : T +>T : T +>T : T + + new (x: new (a: T) => T): T[]; +>T : T +>Base : Base +>x : new (a: T) => T +>a : T +>T : T +>T : T +>T : T + +}; +var a18: { +>a18 : { new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; } + + new (x: { +>x : { new (a: T): T; new (a: T): T; } + + new (a: T): T; +>T : T +>Derived : Derived +>a : T +>T : T +>T : T + + new (a: T): T; +>T : T +>Base : Base +>a : T +>T : T +>T : T + + }): any[]; + new (x: { +>x : { new (a: T): T; new (a: T): T; } + + new (a: T): T; +>T : T +>Derived2 : Derived2 +>a : T +>T : T +>T : T + + new (a: T): T; +>T : T +>Base : Base +>a : T +>T : T +>T : T + + }): any[]; +}; + +var b: new (x: T) => T[]; +>b : new (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + +a = b; // ok +>a = b : new (x: T) => T[] +>a : new (x: T) => T[] +>b : new (x: T) => T[] + +b = a; // ok +>b = a : new (x: T) => T[] +>b : new (x: T) => T[] +>a : new (x: T) => T[] + +var b2: new (x: T) => string[]; +>b2 : new (x: T) => string[] +>T : T +>x : T +>T : T + +a2 = b2; // ok +>a2 = b2 : new (x: T) => string[] +>a2 : new (x: T) => string[] +>b2 : new (x: T) => string[] + +b2 = a2; // ok +>b2 = a2 : new (x: T) => string[] +>b2 : new (x: T) => string[] +>a2 : new (x: T) => string[] + +var b3: new (x: T) => T; +>b3 : new (x: T) => T +>T : T +>x : T +>T : T +>T : T + +a3 = b3; // ok +>a3 = b3 : new (x: T) => T +>a3 : new (x: T) => void +>b3 : new (x: T) => T + +b3 = a3; // ok +>b3 = a3 : new (x: T) => void +>b3 : new (x: T) => T +>a3 : new (x: T) => void + +var b4: new (x: T, y: U) => string; +>b4 : new (x: T, y: U) => string +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U + +a4 = b4; // ok +>a4 = b4 : new (x: T, y: U) => string +>a4 : new (x: T, y: U) => string +>b4 : new (x: T, y: U) => string + +b4 = a4; // ok +>b4 = a4 : new (x: T, y: U) => string +>b4 : new (x: T, y: U) => string +>a4 : new (x: T, y: U) => string + +var b5: new (x: new (arg: T) => U) => T; +>b5 : new (x: new (arg: T) => U) => T +>T : T +>U : U +>x : new (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + +a5 = b5; // ok +>a5 = b5 : new (x: new (arg: T) => U) => T +>a5 : new (x: new (arg: T) => U) => T +>b5 : new (x: new (arg: T) => U) => T + +b5 = a5; // ok +>b5 = a5 : new (x: new (arg: T) => U) => T +>b5 : new (x: new (arg: T) => U) => T +>a5 : new (x: new (arg: T) => U) => T + +var b6: new (x: new (arg: T) => U) => T; +>b6 : new (x: new (arg: T) => U) => T +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : new (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + +a6 = b6; // ok +>a6 = b6 : new (x: new (arg: T) => U) => T +>a6 : new (x: new (arg: T) => Derived) => T +>b6 : new (x: new (arg: T) => U) => T + +b6 = a6; // ok +>b6 = a6 : new (x: new (arg: T) => Derived) => T +>b6 : new (x: new (arg: T) => U) => T +>a6 : new (x: new (arg: T) => Derived) => T + +var b11: new (x: { foo: T }, y: { foo: U; bar: U }) => Base; +>b11 : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base +>T : T +>U : U +>x : { foo: T; } +>foo : T +>T : T +>y : { foo: U; bar: U; } +>foo : U +>U : U +>bar : U +>U : U +>Base : Base + +a11 = b11; // ok +>a11 = b11 : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base +>a11 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>b11 : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base + +b11 = a11; // ok +>b11 = a11 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>b11 : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base +>a11 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base + +var b15: new (x: { a: U; b: V; }) => U[]; +>b15 : new (x: { a: U; b: V; }) => U[] +>U : U +>V : V +>x : { a: U; b: V; } +>a : U +>U : U +>b : V +>V : V +>U : U + +a15 = b15; // ok +>a15 = b15 : new (x: { a: U; b: V; }) => U[] +>a15 : new (x: { a: T; b: T; }) => T[] +>b15 : new (x: { a: U; b: V; }) => U[] + +b15 = a15; // ok +>b15 = a15 : new (x: { a: T; b: T; }) => T[] +>b15 : new (x: { a: U; b: V; }) => U[] +>a15 : new (x: { a: T; b: T; }) => T[] + +var b16: new (x: { a: T; b: T }) => T[]; +>b16 : new (x: { a: T; b: T; }) => T[] +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + +a15 = b16; // ok +>a15 = b16 : new (x: { a: T; b: T; }) => T[] +>a15 : new (x: { a: T; b: T; }) => T[] +>b16 : new (x: { a: T; b: T; }) => T[] + +b15 = a16; // ok +>b15 = a16 : new (x: { a: T; b: T; }) => T[] +>b15 : new (x: { a: U; b: V; }) => U[] +>a16 : new (x: { a: T; b: T; }) => T[] + +var b17: new (x: new (a: T) => T) => T[]; +>b17 : new (x: new (a: T) => T) => T[] +>T : T +>x : new (a: T) => T +>a : T +>T : T +>T : T +>T : T + +a17 = b17; // ok +>a17 = b17 : new (x: new (a: T) => T) => T[] +>a17 : { new (x: new (a: T) => T): T[]; new (x: new (a: T) => T): T[]; } +>b17 : new (x: new (a: T) => T) => T[] + +b17 = a17; // ok +>b17 = a17 : { new (x: new (a: T) => T): T[]; new (x: new (a: T) => T): T[]; } +>b17 : new (x: new (a: T) => T) => T[] +>a17 : { new (x: new (a: T) => T): T[]; new (x: new (a: T) => T): T[]; } + +var b18: new (x: new (a: T) => T) => any[]; +>b18 : new (x: new (a: T) => T) => any[] +>x : new (a: T) => T +>T : T +>a : T +>T : T +>T : T + +a18 = b18; // ok +>a18 = b18 : new (x: new (a: T) => T) => any[] +>a18 : { new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; } +>b18 : new (x: new (a: T) => T) => any[] + +b18 = a18; // ok +>b18 = a18 : { new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; } +>b18 : new (x: new (a: T) => T) => any[] +>a18 : { new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; } + diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.types b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.types new file mode 100644 index 00000000000..74a20b9b21e --- /dev/null +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.types @@ -0,0 +1,273 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures6.ts === +// checking assignment compatibility relations for function types. All valid. + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Derived { baz: string; } +>Derived2 : Derived2 +>Derived : Derived +>baz : string + +class OtherDerived extends Base { bing: string; } +>OtherDerived : OtherDerived +>Base : Base +>bing : string + +interface A { +>A : A + + a: new (x: T) => T[]; +>a : new (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + + a2: new (x: T) => string[]; +>a2 : new (x: T) => string[] +>T : T +>x : T +>T : T + + a3: new (x: T) => void; +>a3 : new (x: T) => void +>T : T +>x : T +>T : T + + a4: new (x: T, y: U) => string; +>a4 : new (x: T, y: U) => string +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U + + a5: new (x: (arg: T) => U) => T; +>a5 : new (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a6: new (x: (arg: T) => Derived) => T; +>a6 : new (x: (arg: T) => Derived) => T +>T : T +>Base : Base +>x : (arg: T) => Derived +>arg : T +>T : T +>Derived : Derived +>T : T + + a11: new (x: { foo: T }, y: { foo: T; bar: T }) => Base; +>a11 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>T : T +>x : { foo: T; } +>foo : T +>T : T +>y : { foo: T; bar: T; } +>foo : T +>T : T +>bar : T +>T : T +>Base : Base + + a15: new (x: { a: T; b: T }) => T[]; +>a15 : new (x: { a: T; b: T; }) => T[] +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + + a16: new (x: { a: T; b: T }) => T[]; +>a16 : new (x: { a: T; b: T; }) => T[] +>T : T +>Base : Base +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T +} + +var x: A; +>x : A +>A : A + +var b: new (x: T) => T[]; +>b : new (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + +x.a = b; +>x.a = b : new (x: T) => T[] +>x.a : new (x: T) => T[] +>x : A +>a : new (x: T) => T[] +>b : new (x: T) => T[] + +b = x.a; +>b = x.a : new (x: T) => T[] +>b : new (x: T) => T[] +>x.a : new (x: T) => T[] +>x : A +>a : new (x: T) => T[] + +var b2: new (x: T) => string[]; +>b2 : new (x: T) => string[] +>T : T +>x : T +>T : T + +x.a2 = b2; +>x.a2 = b2 : new (x: T) => string[] +>x.a2 : new (x: T) => string[] +>x : A +>a2 : new (x: T) => string[] +>b2 : new (x: T) => string[] + +b2 = x.a2; +>b2 = x.a2 : new (x: T) => string[] +>b2 : new (x: T) => string[] +>x.a2 : new (x: T) => string[] +>x : A +>a2 : new (x: T) => string[] + +var b3: new (x: T) => T; +>b3 : new (x: T) => T +>T : T +>x : T +>T : T +>T : T + +x.a3 = b3; +>x.a3 = b3 : new (x: T) => T +>x.a3 : new (x: T) => void +>x : A +>a3 : new (x: T) => void +>b3 : new (x: T) => T + +b3 = x.a3; +>b3 = x.a3 : new (x: T) => void +>b3 : new (x: T) => T +>x.a3 : new (x: T) => void +>x : A +>a3 : new (x: T) => void + +var b4: new (x: T, y: U) => string; +>b4 : new (x: T, y: U) => string +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U + +x.a4 = b4; +>x.a4 = b4 : new (x: T, y: U) => string +>x.a4 : new (x: T, y: U) => string +>x : A +>a4 : new (x: T, y: U) => string +>b4 : new (x: T, y: U) => string + +b4 = x.a4; +>b4 = x.a4 : new (x: T, y: U) => string +>b4 : new (x: T, y: U) => string +>x.a4 : new (x: T, y: U) => string +>x : A +>a4 : new (x: T, y: U) => string + +var b5: new (x: (arg: T) => U) => T; +>b5 : new (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + +x.a5 = b5; +>x.a5 = b5 : new (x: (arg: T) => U) => T +>x.a5 : new (x: (arg: T) => U) => T +>x : A +>a5 : new (x: (arg: T) => U) => T +>b5 : new (x: (arg: T) => U) => T + +b5 = x.a5; +>b5 = x.a5 : new (x: (arg: T) => U) => T +>b5 : new (x: (arg: T) => U) => T +>x.a5 : new (x: (arg: T) => U) => T +>x : A +>a5 : new (x: (arg: T) => U) => T + +var b11: new (x: { foo: T }, y: { foo: U; bar: U }) => Base; +>b11 : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base +>T : T +>U : U +>x : { foo: T; } +>foo : T +>T : T +>y : { foo: U; bar: U; } +>foo : U +>U : U +>bar : U +>U : U +>Base : Base + +x.a11 = b11; +>x.a11 = b11 : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base +>x.a11 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>x : A +>a11 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>b11 : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base + +b11 = x.a11; +>b11 = x.a11 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>b11 : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base +>x.a11 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>x : A +>a11 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base + +var b16: new (x: { a: T; b: T }) => T[]; +>b16 : new (x: { a: T; b: T; }) => T[] +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + +x.a16 = b16; +>x.a16 = b16 : new (x: { a: T; b: T; }) => T[] +>x.a16 : new (x: { a: T; b: T; }) => T[] +>x : A +>a16 : new (x: { a: T; b: T; }) => T[] +>b16 : new (x: { a: T; b: T; }) => T[] + +b16 = x.a16; +>b16 = x.a16 : new (x: { a: T; b: T; }) => T[] +>b16 : new (x: { a: T; b: T; }) => T[] +>x.a16 : new (x: { a: T; b: T; }) => T[] +>x : A +>a16 : new (x: { a: T; b: T; }) => T[] + diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures.types b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures.types new file mode 100644 index 00000000000..ac503fb1873 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures.types @@ -0,0 +1,27 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignatures.ts === +// some complex cases of assignment compat of generic signatures that stress contextual signature instantiation + +var f: (x: S) => void +>f : (x: S) => void +>S : S +>p : string +>x : S +>S : S + +var g: (x: T[]) => void +>g : (x: T[]) => void +>T : T +>p : string +>x : T[] +>T : T + +f = g; // ok +>f = g : (x: T[]) => void +>f : (x: S) => void +>g : (x: T[]) => void + +g = f; // ok +>g = f : (x: S) => void +>g : (x: T[]) => void +>f : (x: S) => void + diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.types b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.types new file mode 100644 index 00000000000..a5f3f06b9c8 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.types @@ -0,0 +1,44 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignatures2.ts === +// some complex cases of assignment compat of generic signatures. No contextual signature instantiation + +interface A { +>A : A + + (x: T, ...y: T[][]): void +>T : T +>x : T +>T : T +>y : T[][] +>T : T +} + +interface B { +>B : B + + (x: S, ...y: S[]): void +>S : S +>x : S +>S : S +>y : S[] +>S : S +} + +var a: A; +>a : A +>A : A + +var b: B; +>b : B +>B : B + +// Both ok +a = b; +>a = b : B +>a : A +>b : B + +b = a; +>b = a : A +>b : B +>a : A + diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures3.types b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures3.types new file mode 100644 index 00000000000..dc1912cd7a1 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures3.types @@ -0,0 +1,53 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignatures3.ts === +// some complex cases of assignment compat of generic signatures that stress contextual signature instantiation + +interface I { +>I : I +>T : T +>S : S + + (f: (x: T) => (y: S) => U): U +>U : U +>f : (x: T) => (y: S) => U +>x : T +>T : T +>y : S +>S : S +>U : U +>U : U +} + +var g: (x: T) => (y: S) => I +>g : (x: T) => (y: S) => I +>T : T +>x : T +>T : T +>S : S +>y : S +>S : S +>I : I +>T : T +>S : S + +var h: (x: T) => (y: S) => { (f: (x: T) => (y: S) => U): U } +>h : (x: T) => (y: S) => (f: (x: T) => (y: S) => U) => U +>T : T +>x : T +>T : T +>S : S +>y : S +>S : S +>U : U +>f : (x: T) => (y: S) => U +>x : T +>T : T +>y : S +>S : S +>U : U +>U : U + +g = h // ok +>g = h : (x: T) => (y: S) => (f: (x: T) => (y: S) => U) => U +>g : (x: T) => (y: S) => I +>h : (x: T) => (y: S) => (f: (x: T) => (y: S) => U) => U + diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers2.types b/tests/baselines/reference/assignmentCompatWithObjectMembers2.types new file mode 100644 index 00000000000..962b29732a5 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers2.types @@ -0,0 +1,153 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers2.ts === +// members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M +// additional optional properties do not cause errors + +class S { foo: string; } +>S : S +>foo : string + +class T { foo: string; } +>T : T +>foo : string + +var s: S; +>s : S +>S : S + +var t: T; +>t : T +>T : T + +interface S2 { foo: string; bar?: string } +>S2 : S2 +>foo : string +>bar : string + +interface T2 { foo: string; baz?: string } +>T2 : T2 +>foo : string +>baz : string + +var s2: S2; +>s2 : S2 +>S2 : S2 + +var t2: T2; +>t2 : T2 +>T2 : T2 + +var a: { foo: string; bar?: string } +>a : { foo: string; bar?: string; } +>foo : string +>bar : string + +var b: { foo: string; baz?: string } +>b : { foo: string; baz?: string; } +>foo : string +>baz : string + +var a2 = { foo: '' }; +>a2 : { foo: string; } +>{ foo: '' } : { foo: string; } +>foo : string + +var b2 = { foo: '' }; +>b2 : { foo: string; } +>{ foo: '' } : { foo: string; } +>foo : string + +s = t; +>s = t : T +>s : S +>t : T + +t = s; +>t = s : S +>t : T +>s : S + +s = s2; +>s = s2 : S2 +>s : S +>s2 : S2 + +s = a2; +>s = a2 : { foo: string; } +>s : S +>a2 : { foo: string; } + +s2 = t2; +>s2 = t2 : T2 +>s2 : S2 +>t2 : T2 + +t2 = s2; +>t2 = s2 : S2 +>t2 : T2 +>s2 : S2 + +s2 = t; +>s2 = t : T +>s2 : S2 +>t : T + +s2 = b; +>s2 = b : { foo: string; baz?: string; } +>s2 : S2 +>b : { foo: string; baz?: string; } + +s2 = a2; +>s2 = a2 : { foo: string; } +>s2 : S2 +>a2 : { foo: string; } + +a = b; +>a = b : { foo: string; baz?: string; } +>a : { foo: string; bar?: string; } +>b : { foo: string; baz?: string; } + +b = a; +>b = a : { foo: string; bar?: string; } +>b : { foo: string; baz?: string; } +>a : { foo: string; bar?: string; } + +a = s; +>a = s : S +>a : { foo: string; bar?: string; } +>s : S + +a = s2; +>a = s2 : S2 +>a : { foo: string; bar?: string; } +>s2 : S2 + +a = a2; +>a = a2 : { foo: string; } +>a : { foo: string; bar?: string; } +>a2 : { foo: string; } + +a2 = b2; +>a2 = b2 : { foo: string; } +>a2 : { foo: string; } +>b2 : { foo: string; } + +b2 = a2; +>b2 = a2 : { foo: string; } +>b2 : { foo: string; } +>a2 : { foo: string; } + +a2 = b; +>a2 = b : { foo: string; baz?: string; } +>a2 : { foo: string; } +>b : { foo: string; baz?: string; } + +a2 = t2; +>a2 = t2 : T2 +>a2 : { foo: string; } +>t2 : T2 + +a2 = t; +>a2 = t : T +>a2 : { foo: string; } +>t : T + diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers3.types b/tests/baselines/reference/assignmentCompatWithObjectMembers3.types new file mode 100644 index 00000000000..85a7e59ffbc --- /dev/null +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers3.types @@ -0,0 +1,157 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers3.ts === +// members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M +// additional optional properties do not cause errors + +class S implements S2 { foo: string; } +>S : S +>S2 : S2 +>foo : string + +class T implements T2 { foo: string; } +>T : T +>T2 : T2 +>foo : string + +var s: S; +>s : S +>S : S + +var t: T; +>t : T +>T : T + +interface S2 { foo: string; bar?: string } +>S2 : S2 +>foo : string +>bar : string + +interface T2 { foo: string; baz?: string } +>T2 : T2 +>foo : string +>baz : string + +var s2: S2; +>s2 : S2 +>S2 : S2 + +var t2: T2; +>t2 : T2 +>T2 : T2 + +var a: { foo: string; bar?: string } +>a : { foo: string; bar?: string; } +>foo : string +>bar : string + +var b: { foo: string; baz?: string } +>b : { foo: string; baz?: string; } +>foo : string +>baz : string + +var a2: S2 = { foo: '' }; +>a2 : S2 +>S2 : S2 +>{ foo: '' } : { foo: string; } +>foo : string + +var b2: T2 = { foo: '' }; +>b2 : T2 +>T2 : T2 +>{ foo: '' } : { foo: string; } +>foo : string + +s = t; +>s = t : T +>s : S +>t : T + +t = s; +>t = s : S +>t : T +>s : S + +s = s2; +>s = s2 : S2 +>s : S +>s2 : S2 + +s = a2; +>s = a2 : S2 +>s : S +>a2 : S2 + +s2 = t2; +>s2 = t2 : T2 +>s2 : S2 +>t2 : T2 + +t2 = s2; +>t2 = s2 : S2 +>t2 : T2 +>s2 : S2 + +s2 = t; +>s2 = t : T +>s2 : S2 +>t : T + +s2 = b; +>s2 = b : { foo: string; baz?: string; } +>s2 : S2 +>b : { foo: string; baz?: string; } + +s2 = a2; +>s2 = a2 : S2 +>s2 : S2 +>a2 : S2 + +a = b; +>a = b : { foo: string; baz?: string; } +>a : { foo: string; bar?: string; } +>b : { foo: string; baz?: string; } + +b = a; +>b = a : { foo: string; bar?: string; } +>b : { foo: string; baz?: string; } +>a : { foo: string; bar?: string; } + +a = s; +>a = s : S +>a : { foo: string; bar?: string; } +>s : S + +a = s2; +>a = s2 : S2 +>a : { foo: string; bar?: string; } +>s2 : S2 + +a = a2; +>a = a2 : S2 +>a : { foo: string; bar?: string; } +>a2 : S2 + +a2 = b2; +>a2 = b2 : T2 +>a2 : S2 +>b2 : T2 + +b2 = a2; +>b2 = a2 : S2 +>b2 : T2 +>a2 : S2 + +a2 = b; +>a2 = b : { foo: string; baz?: string; } +>a2 : S2 +>b : { foo: string; baz?: string; } + +a2 = t2; +>a2 = t2 : T2 +>a2 : S2 +>t2 : T2 + +a2 = t; +>a2 = t : T +>a2 : S2 +>t : T + diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.types b/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.types new file mode 100644 index 00000000000..4c76ce1e88a --- /dev/null +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.types @@ -0,0 +1,145 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersNumericNames.ts === +// members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M +// numeric named properties work correctly, no errors expected + +class S { 1: string; } +>S : S + +class T { 1.: string; } +>T : T + +var s: S; +>s : S +>S : S + +var t: T; +>t : T +>T : T + +interface S2 { 1: string; bar?: string } +>S2 : S2 +>bar : string + +interface T2 { 1.0: string; baz?: string } +>T2 : T2 +>baz : string + +var s2: S2; +>s2 : S2 +>S2 : S2 + +var t2: T2; +>t2 : T2 +>T2 : T2 + +var a: { 1.: string; bar?: string } +>a : { 1.: string; bar?: string; } +>bar : string + +var b: { 1.0: string; baz?: string } +>b : { 1.0: string; baz?: string; } +>baz : string + +var a2 = { 1.0: '' }; +>a2 : { 1.0: string; } +>{ 1.0: '' } : { 1.0: string; } + +var b2 = { 1: '' }; +>b2 : { 1: string; } +>{ 1: '' } : { 1: string; } + +s = t; +>s = t : T +>s : S +>t : T + +t = s; +>t = s : S +>t : T +>s : S + +s = s2; +>s = s2 : S2 +>s : S +>s2 : S2 + +s = a2; +>s = a2 : { 1.0: string; } +>s : S +>a2 : { 1.0: string; } + +s2 = t2; +>s2 = t2 : T2 +>s2 : S2 +>t2 : T2 + +t2 = s2; +>t2 = s2 : S2 +>t2 : T2 +>s2 : S2 + +s2 = t; +>s2 = t : T +>s2 : S2 +>t : T + +s2 = b; +>s2 = b : { 1.0: string; baz?: string; } +>s2 : S2 +>b : { 1.0: string; baz?: string; } + +s2 = a2; +>s2 = a2 : { 1.0: string; } +>s2 : S2 +>a2 : { 1.0: string; } + +a = b; +>a = b : { 1.0: string; baz?: string; } +>a : { 1.: string; bar?: string; } +>b : { 1.0: string; baz?: string; } + +b = a; +>b = a : { 1.: string; bar?: string; } +>b : { 1.0: string; baz?: string; } +>a : { 1.: string; bar?: string; } + +a = s; +>a = s : S +>a : { 1.: string; bar?: string; } +>s : S + +a = s2; +>a = s2 : S2 +>a : { 1.: string; bar?: string; } +>s2 : S2 + +a = a2; +>a = a2 : { 1.0: string; } +>a : { 1.: string; bar?: string; } +>a2 : { 1.0: string; } + +a2 = b2; +>a2 = b2 : { 1: string; } +>a2 : { 1.0: string; } +>b2 : { 1: string; } + +b2 = a2; +>b2 = a2 : { 1.0: string; } +>b2 : { 1: string; } +>a2 : { 1.0: string; } + +a2 = b; +>a2 = b : { 1.0: string; baz?: string; } +>a2 : { 1.0: string; } +>b : { 1.0: string; baz?: string; } + +a2 = t2; +>a2 = t2 : T2 +>a2 : { 1.0: string; } +>t2 : T2 + +a2 = t; +>a2 = t : T +>a2 : { 1.0: string; } +>t : T + diff --git a/tests/baselines/reference/assignmentCompatWithWithGenericConstructSignatures.types b/tests/baselines/reference/assignmentCompatWithWithGenericConstructSignatures.types new file mode 100644 index 00000000000..e6db879f441 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatWithWithGenericConstructSignatures.types @@ -0,0 +1,3 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithWithGenericConstructSignatures.ts === + +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability1.types b/tests/baselines/reference/assignmentCompatability1.types new file mode 100644 index 00000000000..f03d33dc04b --- /dev/null +++ b/tests/baselines/reference/assignmentCompatability1.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/assignmentCompatability1.ts === +module __test1__ { +>__test1__ : typeof __test1__ + + export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>T : T +>U : U +>one : T +>T : T +>two : U +>U : U +>obj4 : interfaceWithPublicAndOptional +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>{ one: 1 } : { one: number; } +>one : number + + export var __val__obj4 = obj4; +>__val__obj4 : interfaceWithPublicAndOptional +>obj4 : interfaceWithPublicAndOptional +} +module __test2__ { +>__test2__ : typeof __test2__ + + export var aa = {};; +>aa : {} +>{} : {} + + export var __val__aa = aa; +>__val__aa : {} +>aa : {} +} +__test2__.__val__aa = __test1__.__val__obj4 +>__test2__.__val__aa = __test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test2__.__val__aa : {} +>__test2__ : typeof __test2__ +>__val__aa : {} +>__test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test1__ : typeof __test1__ +>__val__obj4 : interfaceWithPublicAndOptional + diff --git a/tests/baselines/reference/assignmentCompatability2.types b/tests/baselines/reference/assignmentCompatability2.types new file mode 100644 index 00000000000..75605a498e8 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatability2.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/assignmentCompatability2.ts === +module __test1__ { +>__test1__ : typeof __test1__ + + export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>T : T +>U : U +>one : T +>T : T +>two : U +>U : U +>obj4 : interfaceWithPublicAndOptional +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>{ one: 1 } : { one: number; } +>one : number + + export var __val__obj4 = obj4; +>__val__obj4 : interfaceWithPublicAndOptional +>obj4 : interfaceWithPublicAndOptional +} +module __test2__ { +>__test2__ : typeof __test2__ + + export var aa:{};; +>aa : {} + + export var __val__aa = aa; +>__val__aa : {} +>aa : {} +} +__test2__.__val__aa = __test1__.__val__obj4 +>__test2__.__val__aa = __test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test2__.__val__aa : {} +>__test2__ : typeof __test2__ +>__val__aa : {} +>__test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test1__ : typeof __test1__ +>__val__obj4 : interfaceWithPublicAndOptional + diff --git a/tests/baselines/reference/assignmentCompatability3.types b/tests/baselines/reference/assignmentCompatability3.types new file mode 100644 index 00000000000..c302d2d5465 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatability3.types @@ -0,0 +1,42 @@ +=== tests/cases/compiler/assignmentCompatability3.ts === +module __test1__ { +>__test1__ : typeof __test1__ + + export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>T : T +>U : U +>one : T +>T : T +>two : U +>U : U +>obj4 : interfaceWithPublicAndOptional +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>{ one: 1 } : { one: number; } +>one : number + + export var __val__obj4 = obj4; +>__val__obj4 : interfaceWithPublicAndOptional +>obj4 : interfaceWithPublicAndOptional +} +module __test2__ { +>__test2__ : typeof __test2__ + + export var obj = {one: 1}; +>obj : { one: number; } +>{one: 1} : { one: number; } +>one : number + + export var __val__obj = obj; +>__val__obj : { one: number; } +>obj : { one: number; } +} +__test2__.__val__obj = __test1__.__val__obj4 +>__test2__.__val__obj = __test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test2__.__val__obj : { one: number; } +>__test2__ : typeof __test2__ +>__val__obj : { one: number; } +>__test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test1__ : typeof __test1__ +>__val__obj4 : interfaceWithPublicAndOptional + diff --git a/tests/baselines/reference/assignmentCompatability4.types b/tests/baselines/reference/assignmentCompatability4.types new file mode 100644 index 00000000000..2090d850c28 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatability4.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/assignmentCompatability4.ts === +module __test1__ { +>__test1__ : typeof __test1__ + + export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>T : T +>U : U +>one : T +>T : T +>two : U +>U : U +>obj4 : interfaceWithPublicAndOptional +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>{ one: 1 } : { one: number; } +>one : number + + export var __val__obj4 = obj4; +>__val__obj4 : interfaceWithPublicAndOptional +>obj4 : interfaceWithPublicAndOptional +} +module __test2__ { +>__test2__ : typeof __test2__ + + export var aa:{one:number;};; +>aa : { one: number; } +>one : number + + export var __val__aa = aa; +>__val__aa : { one: number; } +>aa : { one: number; } +} +__test2__.__val__aa = __test1__.__val__obj4 +>__test2__.__val__aa = __test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test2__.__val__aa : { one: number; } +>__test2__ : typeof __test2__ +>__val__aa : { one: number; } +>__test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test1__ : typeof __test1__ +>__val__obj4 : interfaceWithPublicAndOptional + diff --git a/tests/baselines/reference/assignmentCompatability5.types b/tests/baselines/reference/assignmentCompatability5.types new file mode 100644 index 00000000000..9cfcfbcda2f --- /dev/null +++ b/tests/baselines/reference/assignmentCompatability5.types @@ -0,0 +1,47 @@ +=== tests/cases/compiler/assignmentCompatability5.ts === +module __test1__ { +>__test1__ : typeof __test1__ + + export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>T : T +>U : U +>one : T +>T : T +>two : U +>U : U +>obj4 : interfaceWithPublicAndOptional +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>{ one: 1 } : { one: number; } +>one : number + + export var __val__obj4 = obj4; +>__val__obj4 : interfaceWithPublicAndOptional +>obj4 : interfaceWithPublicAndOptional +} +module __test2__ { +>__test2__ : typeof __test2__ + + export interface interfaceOne { one: T; }; var obj1: interfaceOne = { one: 1 };; +>interfaceOne : interfaceOne +>T : T +>one : T +>T : T +>obj1 : interfaceOne +>interfaceOne : interfaceOne +>{ one: 1 } : { one: number; } +>one : number + + export var __val__obj1 = obj1; +>__val__obj1 : interfaceOne +>obj1 : interfaceOne +} +__test2__.__val__obj1 = __test1__.__val__obj4 +>__test2__.__val__obj1 = __test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test2__.__val__obj1 : interfaceOne +>__test2__ : typeof __test2__ +>__val__obj1 : interfaceOne +>__test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test1__ : typeof __test1__ +>__val__obj4 : interfaceWithPublicAndOptional + diff --git a/tests/baselines/reference/assignmentCompatability6.types b/tests/baselines/reference/assignmentCompatability6.types new file mode 100644 index 00000000000..1e22958db09 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatability6.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/assignmentCompatability6.ts === +module __test1__ { +>__test1__ : typeof __test1__ + + export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>T : T +>U : U +>one : T +>T : T +>two : U +>U : U +>obj4 : interfaceWithPublicAndOptional +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>{ one: 1 } : { one: number; } +>one : number + + export var __val__obj4 = obj4; +>__val__obj4 : interfaceWithPublicAndOptional +>obj4 : interfaceWithPublicAndOptional +} +module __test2__ { +>__test2__ : typeof __test2__ + + export interface interfaceWithOptional { one?: T; }; var obj3: interfaceWithOptional = { };; +>interfaceWithOptional : interfaceWithOptional +>T : T +>one : T +>T : T +>obj3 : interfaceWithOptional +>interfaceWithOptional : interfaceWithOptional +>{ } : {} + + export var __val__obj3 = obj3; +>__val__obj3 : interfaceWithOptional +>obj3 : interfaceWithOptional +} +__test2__.__val__obj3 = __test1__.__val__obj4 +>__test2__.__val__obj3 = __test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test2__.__val__obj3 : interfaceWithOptional +>__test2__ : typeof __test2__ +>__val__obj3 : interfaceWithOptional +>__test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test1__ : typeof __test1__ +>__val__obj4 : interfaceWithPublicAndOptional + diff --git a/tests/baselines/reference/assignmentCompatability7.types b/tests/baselines/reference/assignmentCompatability7.types new file mode 100644 index 00000000000..feaa1567dd1 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatability7.types @@ -0,0 +1,50 @@ +=== tests/cases/compiler/assignmentCompatability7.ts === +module __test1__ { +>__test1__ : typeof __test1__ + + export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>T : T +>U : U +>one : T +>T : T +>two : U +>U : U +>obj4 : interfaceWithPublicAndOptional +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>{ one: 1 } : { one: number; } +>one : number + + export var __val__obj4 = obj4; +>__val__obj4 : interfaceWithPublicAndOptional +>obj4 : interfaceWithPublicAndOptional +} +module __test2__ { +>__test2__ : typeof __test2__ + + export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>T : T +>U : U +>one : T +>T : T +>two : U +>U : U +>obj4 : interfaceWithPublicAndOptional +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>{ one: 1 } : { one: number; } +>one : number + + export var __val__obj4 = obj4; +>__val__obj4 : interfaceWithPublicAndOptional +>obj4 : interfaceWithPublicAndOptional +} +__test2__.__val__obj4 = __test1__.__val__obj4 +>__test2__.__val__obj4 = __test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test2__.__val__obj4 : interfaceWithPublicAndOptional +>__test2__ : typeof __test2__ +>__val__obj4 : interfaceWithPublicAndOptional +>__test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test1__ : typeof __test1__ +>__val__obj4 : interfaceWithPublicAndOptional + diff --git a/tests/baselines/reference/assignmentCompatability8.types b/tests/baselines/reference/assignmentCompatability8.types new file mode 100644 index 00000000000..37bbd18d7bf --- /dev/null +++ b/tests/baselines/reference/assignmentCompatability8.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/assignmentCompatability8.ts === +module __test1__ { +>__test1__ : typeof __test1__ + + export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>T : T +>U : U +>one : T +>T : T +>two : U +>U : U +>obj4 : interfaceWithPublicAndOptional +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>{ one: 1 } : { one: number; } +>one : number + + export var __val__obj4 = obj4; +>__val__obj4 : interfaceWithPublicAndOptional +>obj4 : interfaceWithPublicAndOptional +} +module __test2__ { +>__test2__ : typeof __test2__ + + export class classWithPublic { constructor(public one: T) {} } var x1 = new classWithPublic(1);; +>classWithPublic : classWithPublic +>T : T +>one : T +>T : T +>x1 : classWithPublic +>new classWithPublic(1) : classWithPublic +>classWithPublic : typeof classWithPublic + + export var __val__x1 = x1; +>__val__x1 : classWithPublic +>x1 : classWithPublic +} +__test2__.__val__x1 = __test1__.__val__obj4 +>__test2__.__val__x1 = __test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test2__.__val__x1 : classWithPublic +>__test2__ : typeof __test2__ +>__val__x1 : classWithPublic +>__test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test1__ : typeof __test1__ +>__val__obj4 : interfaceWithPublicAndOptional + diff --git a/tests/baselines/reference/assignmentCompatability9.types b/tests/baselines/reference/assignmentCompatability9.types new file mode 100644 index 00000000000..5add8208d80 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatability9.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/assignmentCompatability9.ts === +module __test1__ { +>__test1__ : typeof __test1__ + + export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>T : T +>U : U +>one : T +>T : T +>two : U +>U : U +>obj4 : interfaceWithPublicAndOptional +>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional +>{ one: 1 } : { one: number; } +>one : number + + export var __val__obj4 = obj4; +>__val__obj4 : interfaceWithPublicAndOptional +>obj4 : interfaceWithPublicAndOptional +} +module __test2__ { +>__test2__ : typeof __test2__ + + export class classWithOptional { constructor(public one?: T) {} } var x3 = new classWithOptional();; +>classWithOptional : classWithOptional +>T : T +>one : T +>T : T +>x3 : classWithOptional +>new classWithOptional() : classWithOptional +>classWithOptional : typeof classWithOptional + + export var __val__x3 = x3; +>__val__x3 : classWithOptional +>x3 : classWithOptional +} +__test2__.__val__x3 = __test1__.__val__obj4 +>__test2__.__val__x3 = __test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test2__.__val__x3 : classWithOptional +>__test2__ : typeof __test2__ +>__val__x3 : classWithOptional +>__test1__.__val__obj4 : interfaceWithPublicAndOptional +>__test1__ : typeof __test1__ +>__val__obj4 : interfaceWithPublicAndOptional + diff --git a/tests/baselines/reference/assignmentCompatibilityForConstrainedTypeParameters.types b/tests/baselines/reference/assignmentCompatibilityForConstrainedTypeParameters.types new file mode 100644 index 00000000000..fab8e2baae6 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatibilityForConstrainedTypeParameters.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/assignmentCompatibilityForConstrainedTypeParameters.ts === +function foo() { +>foo : () => void +>T : T +>bar : string + + function bar() { +>bar : () => void +>S : S +>T : T + + var x: S; +>x : S +>S : S + + var y: T; +>y : T +>T : T + + y = x; +>y = x : S +>y : T +>x : S + } +} diff --git a/tests/baselines/reference/assignmentLHSIsReference.types b/tests/baselines/reference/assignmentLHSIsReference.types new file mode 100644 index 00000000000..0d7bfad3f06 --- /dev/null +++ b/tests/baselines/reference/assignmentLHSIsReference.types @@ -0,0 +1,74 @@ +=== tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsReference.ts === +var value; +>value : any + +// identifiers: variable and parameter +var x1: number; +>x1 : number + +x1 = value; +>x1 = value : any +>x1 : number +>value : any + +function fn1(x2: number) { +>fn1 : (x2: number) => void +>x2 : number + + x2 = value; +>x2 = value : any +>x2 : number +>value : any +} + +// property accesses +var x3: { a: string }; +>x3 : { a: string; } +>a : string + +x3.a = value; +>x3.a = value : any +>x3.a : string +>x3 : { a: string; } +>a : string +>value : any + +x3['a'] = value; +>x3['a'] = value : any +>x3['a'] : string +>x3 : { a: string; } +>value : any + +// parentheses, the contained expression is reference +(x1) = value; +>(x1) = value : any +>(x1) : number +>x1 : number +>value : any + +function fn2(x4: number) { +>fn2 : (x4: number) => void +>x4 : number + + (x4) = value; +>(x4) = value : any +>(x4) : number +>x4 : number +>value : any +} + +(x3.a) = value; +>(x3.a) = value : any +>(x3.a) : string +>x3.a : string +>x3 : { a: string; } +>a : string +>value : any + +(x3['a']) = value; +>(x3['a']) = value : any +>(x3['a']) : string +>x3['a'] : string +>x3 : { a: string; } +>value : any + diff --git a/tests/baselines/reference/augmentArray.types b/tests/baselines/reference/augmentArray.types new file mode 100644 index 00000000000..31f7e11edca --- /dev/null +++ b/tests/baselines/reference/augmentArray.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/augmentArray.ts === +interface Array { +>Array : T[] +>T : T + + (): any[]; +} diff --git a/tests/baselines/reference/augmentedTypeBracketAccessIndexSignature.types b/tests/baselines/reference/augmentedTypeBracketAccessIndexSignature.types new file mode 100644 index 00000000000..d02a36409a7 --- /dev/null +++ b/tests/baselines/reference/augmentedTypeBracketAccessIndexSignature.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/augmentedTypeBracketAccessIndexSignature.ts === +interface Foo { a } +>Foo : Foo +>a : any + +interface Bar { b } +>Bar : Bar +>b : any + +interface Object { +>Object : Object + + [n: number]: Foo; +>n : number +>Foo : Foo +} + +interface Function { +>Function : Function + + [n: number]: Bar; +>n : number +>Bar : Bar +} + +var a = {}[0]; // Should be Foo +>a : any +>{}[0] : any +>{} : {} + +var b = (() => { })[0]; // Should be Bar +>b : any +>(() => { })[0] : any +>(() => { }) : () => void +>() => { } : () => void + diff --git a/tests/baselines/reference/augmentedTypeBracketNamedPropertyAccess.types b/tests/baselines/reference/augmentedTypeBracketNamedPropertyAccess.types new file mode 100644 index 00000000000..142b08928e3 --- /dev/null +++ b/tests/baselines/reference/augmentedTypeBracketNamedPropertyAccess.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/augmentedTypeBracketNamedPropertyAccess.ts === +interface Object { +>Object : Object + + data: number; +>data : number +} +interface Function { +>Function : Function + + functionData: string; +>functionData : string +} +var o = {}; +>o : {} +>{} : {} + +var f = function () { }; +>f : () => void +>function () { } : () => void + +var r1 = o['data']; // Should be number +>r1 : number +>o['data'] : number +>o : {} + +var r2 = o['functionData']; // Should be any (no property found) +>r2 : any +>o['functionData'] : any +>o : {} + +var r3 = f['functionData']; // Should be string +>r3 : string +>f['functionData'] : string +>f : () => void + +var r4 = f['data']; // Should be number +>r4 : number +>f['data'] : number +>f : () => void + diff --git a/tests/baselines/reference/augmentedTypesClass3.types b/tests/baselines/reference/augmentedTypesClass3.types new file mode 100644 index 00000000000..b22899b03cf --- /dev/null +++ b/tests/baselines/reference/augmentedTypesClass3.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/augmentedTypesClass3.ts === +// class then module +class c5 { public foo() { } } +>c5 : c5 +>foo : () => void + +module c5 { } // should be ok +>c5 : typeof c5 + +class c5a { public foo() { } } +>c5a : c5a +>foo : () => void + +module c5a { var y = 2; } // should be ok +>c5a : typeof c5a +>y : number + +class c5b { public foo() { } } +>c5b : c5b +>foo : () => void + +module c5b { export var y = 2; } // should be ok +>c5b : typeof c5b +>y : number + +//// class then import +class c5c { public foo() { } } +>c5c : c5c +>foo : () => void + +//import c5c = require(''); diff --git a/tests/baselines/reference/augmentedTypesExternalModule1.types b/tests/baselines/reference/augmentedTypesExternalModule1.types new file mode 100644 index 00000000000..ec7e9194df6 --- /dev/null +++ b/tests/baselines/reference/augmentedTypesExternalModule1.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/augmentedTypesExternalModule1.ts === +export var a = 1; +>a : number + +class c5 { public foo() { } } +>c5 : c5 +>foo : () => void + +module c5 { } // should be ok everywhere +>c5 : typeof c5 + diff --git a/tests/baselines/reference/augmentedTypesModules3b.types b/tests/baselines/reference/augmentedTypesModules3b.types new file mode 100644 index 00000000000..af2c33c65da --- /dev/null +++ b/tests/baselines/reference/augmentedTypesModules3b.types @@ -0,0 +1,51 @@ +=== tests/cases/compiler/augmentedTypesModules3b.ts === +class m3b { foo() { } } +>m3b : m3b +>foo : () => void + +module m3b { var y = 2; } +>m3b : typeof m3b +>y : number + +class m3c { foo() { } } +>m3c : m3c +>foo : () => void + +module m3c { export var y = 2; } +>m3c : typeof m3c +>y : number + +declare class m3d { foo(): void } +>m3d : m3d +>foo : () => void + +module m3d { export var y = 2; } +>m3d : typeof m3d +>y : number + +module m3e { export var y = 2; } +>m3e : typeof m3e +>y : number + +declare class m3e { foo(): void } +>m3e : m3e +>foo : () => void + +declare class m3f { foo(): void } +>m3f : m3f +>foo : () => void + +module m3f { export interface I { foo(): void } } +>m3f : typeof m3f +>I : I +>foo : () => void + +declare class m3g { foo(): void } +>m3g : m3g +>foo : () => void + +module m3g { export class C { foo() { } } } +>m3g : typeof m3g +>C : C +>foo : () => void + diff --git a/tests/baselines/reference/augmentedTypesModules4.types b/tests/baselines/reference/augmentedTypesModules4.types new file mode 100644 index 00000000000..bf8922a5761 --- /dev/null +++ b/tests/baselines/reference/augmentedTypesModules4.types @@ -0,0 +1,54 @@ +=== tests/cases/compiler/augmentedTypesModules4.ts === +// module then enum +// should be errors +module m4 { } +>m4 : typeof m4 + +enum m4 { } +>m4 : m4 + +module m4a { var y = 2; } +>m4a : typeof m4a +>y : number + +enum m4a { One } +>m4a : m4a +>One : m4a + +module m4b { export var y = 2; } +>m4b : typeof m4b +>y : number + +enum m4b { One } +>m4b : m4b +>One : m4b + +module m4c { interface I { foo(): void } } +>m4c : typeof m4c +>I : I +>foo : () => void + +enum m4c { One } +>m4c : m4c +>One : m4c + +module m4d { class C { foo() { } } } +>m4d : typeof m4d +>C : C +>foo : () => void + +enum m4d { One } +>m4d : m4d +>One : m4d + +//// module then module + +module m5 { export var y = 2; } +>m5 : typeof m5 +>y : number + +module m5 { export interface I { foo(): void } } // should already be reasonably well covered +>m5 : typeof m5 +>I : I +>foo : () => void + diff --git a/tests/baselines/reference/autoAsiForStaticsInClassDeclaration.types b/tests/baselines/reference/autoAsiForStaticsInClassDeclaration.types new file mode 100644 index 00000000000..d902f0b3eaa --- /dev/null +++ b/tests/baselines/reference/autoAsiForStaticsInClassDeclaration.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/autoAsiForStaticsInClassDeclaration.ts === +class C { +>C : C + + static x +>x : any + + static y +>y : any +} diff --git a/tests/baselines/reference/autonumberingInEnums.types b/tests/baselines/reference/autonumberingInEnums.types new file mode 100644 index 00000000000..ce3366390e8 --- /dev/null +++ b/tests/baselines/reference/autonumberingInEnums.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/autonumberingInEnums.ts === +enum Foo { +>Foo : Foo + + a = 1 +>a : Foo +} + +enum Foo { +>Foo : Foo + + b // should work fine +>b : Foo +} diff --git a/tests/baselines/reference/avoid.types b/tests/baselines/reference/avoid.types new file mode 100644 index 00000000000..853d93bdd79 --- /dev/null +++ b/tests/baselines/reference/avoid.types @@ -0,0 +1,50 @@ +=== tests/cases/compiler/avoid.ts === +function f() { +>f : () => void + + var x=1; +>x : number +} + +var y=f(); // error void fn +>y : void +>f() : void +>f : () => void + +var why:any=f(); // error void fn +>why : any +>f() : void +>f : () => void + +var w:any; +>w : any + +w=f(); // error void fn +>w=f() : void +>w : any +>f() : void +>f : () => void + +class C { +>C : C + + g() { +>g : () => void + + } +} + +var z=new C().g(); // error void fn +>z : void +>new C().g() : void +>new C().g : () => void +>new C() : C +>C : typeof C +>g : () => void + +var N=new f(); // ok with void fn +>N : any +>new f() : any +>f : () => void + + diff --git a/tests/baselines/reference/badOverloadError.types b/tests/baselines/reference/badOverloadError.types new file mode 100644 index 00000000000..837eb5c5c83 --- /dev/null +++ b/tests/baselines/reference/badOverloadError.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/badOverloadError.ts === +function method() { +>method : () => void + + var dictionary = <{ [index: string]: string; }>{}; +>dictionary : { [x: string]: string; } +><{ [index: string]: string; }>{} : { [x: string]: string; } +>index : string +>{} : { [x: string]: string; } +} + diff --git a/tests/baselines/reference/badThisBinding.types b/tests/baselines/reference/badThisBinding.types new file mode 100644 index 00000000000..852fb02f58e --- /dev/null +++ b/tests/baselines/reference/badThisBinding.types @@ -0,0 +1,44 @@ +=== tests/cases/compiler/badThisBinding.ts === +declare function foo(a:any): any; +>foo : (a: any) => any +>a : any + +declare function bar(a:any): any; +>bar : (a: any) => any +>a : any + +class Greeter { +>Greeter : Greeter + + constructor() { + foo(() => { +>foo(() => { + bar(() => { + var x = this; + }); + }) : any +>foo : (a: any) => any +>() => { + bar(() => { + var x = this; + }); + } : () => void + + bar(() => { +>bar(() => { + var x = this; + }) : any +>bar : (a: any) => any +>() => { + var x = this; + } : () => void + + var x = this; +>x : Greeter +>this : Greeter + + }); + }); + } + +} diff --git a/tests/baselines/reference/baseIndexSignatureResolution.types b/tests/baselines/reference/baseIndexSignatureResolution.types new file mode 100644 index 00000000000..bdaf9d50a19 --- /dev/null +++ b/tests/baselines/reference/baseIndexSignatureResolution.types @@ -0,0 +1,50 @@ +=== tests/cases/compiler/baseIndexSignatureResolution.ts === +class Base { private a: string; } +>Base : Base +>a : string + +class Derived extends Base { private b: string; } +>Derived : Derived +>Base : Base +>b : string + +// Note - commmenting "extends Foo" prevents the error +interface Foo { +>Foo : Foo + + [i: number]: Base; +>i : number +>Base : Base +} +interface FooOf extends Foo { +>FooOf : FooOf +>TBase : TBase +>Base : Base +>Foo : Foo + + [i: number]: TBase; +>i : number +>TBase : TBase +} +var x: FooOf = null; +>x : FooOf +>FooOf : FooOf +>Derived : Derived + +var y: Derived = x[0]; +>y : Derived +>Derived : Derived +>x[0] : Derived +>x : FooOf + +/* +// Note - the equivalent for normal interface methods works fine: +interface A { + foo(): Base; +} +interface B extends A { + foo(): TBase; +} +var b: B = null; +var z: Derived = b.foo(); +*/ diff --git a/tests/baselines/reference/baseTypeAfterDerivedType.types b/tests/baselines/reference/baseTypeAfterDerivedType.types new file mode 100644 index 00000000000..2ac50aa019a --- /dev/null +++ b/tests/baselines/reference/baseTypeAfterDerivedType.types @@ -0,0 +1,35 @@ +=== tests/cases/compiler/baseTypeAfterDerivedType.ts === +interface Derived extends Base { +>Derived : Derived +>Base : Base + + method(...args: any[]): void; +>method : (...args: any[]) => void +>args : any[] +} + +interface Base { +>Base : Base + + method(...args: any[]): void; +>method : (...args: any[]) => void +>args : any[] +} + +class Derived2 implements Base2 { +>Derived2 : Derived2 +>Base2 : Base2 + + method(...args: any[]): void { } +>method : (...args: any[]) => void +>args : any[] +} + +interface Base2 { +>Base2 : Base2 + + method(...args: any[]): void; +>method : (...args: any[]) => void +>args : any[] +} + diff --git a/tests/baselines/reference/baseTypeOrderChecking.types b/tests/baselines/reference/baseTypeOrderChecking.types new file mode 100644 index 00000000000..201b82d9375 --- /dev/null +++ b/tests/baselines/reference/baseTypeOrderChecking.types @@ -0,0 +1,51 @@ +=== tests/cases/compiler/baseTypeOrderChecking.ts === +var someVariable: Class4; +>someVariable : Class4 +>Class4 : Class4 +>Class2 : Class2 + + + +class Class1 +>Class1 : Class1 + +{ + +} + + + +class Class2 extends Class1 +>Class2 : Class2 +>Class1 : Class1 + +{ + +} + + + +class Class3 +>Class3 : Class3 +>T : T + +{ + + public memberVariable: Class2; +>memberVariable : Class2 +>Class2 : Class2 + +} + + + +class Class4 extends Class3 +>Class4 : Class4 +>T : T +>Class3 : Class3 +>T : T + +{ + +} + diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types new file mode 100644 index 00000000000..3deeae69bbe --- /dev/null +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types @@ -0,0 +1,118 @@ +=== tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions.ts === +// conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) +// no errors expected here + +var a: { x: number; y?: number }; +>a : { x: number; y?: number; } +>x : number +>y : number + +var b: { x: number; z?: number }; +>b : { x: number; z?: number; } +>x : number +>z : number + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Base { baz: string; } +>Derived2 : Derived2 +>Base : Base +>baz : string + +var base: Base; +>base : Base +>Base : Base + +var derived: Derived; +>derived : Derived +>Derived : Derived + +var derived2: Derived2; +>derived2 : Derived2 +>Derived2 : Derived2 + +var r = true ? 1 : 2; +>r : number +>true ? 1 : 2 : number + +var r3 = true ? 1 : {}; +>r3 : {} +>true ? 1 : {} : {} +>{} : {} + +var r4 = true ? a : b; // typeof a +>r4 : { x: number; y?: number; } +>true ? a : b : { x: number; y?: number; } +>a : { x: number; y?: number; } +>b : { x: number; z?: number; } + +var r5 = true ? b : a; // typeof b +>r5 : { x: number; z?: number; } +>true ? b : a : { x: number; z?: number; } +>b : { x: number; z?: number; } +>a : { x: number; y?: number; } + +var r6 = true ? (x: number) => { } : (x: Object) => { }; // returns number => void +>r6 : (x: number) => void +>true ? (x: number) => { } : (x: Object) => { } : (x: number) => void +>(x: number) => { } : (x: number) => void +>x : number +>(x: Object) => { } : (x: Object) => void +>x : Object +>Object : Object + +var r7: (x: Object) => void = true ? (x: number) => { } : (x: Object) => { }; +>r7 : (x: Object) => void +>x : Object +>Object : Object +>true ? (x: number) => { } : (x: Object) => { } : (x: Object) => void +>(x: number) => { } : (x: number) => void +>x : number +>(x: Object) => { } : (x: Object) => void +>x : Object +>Object : Object + +var r8 = true ? (x: Object) => { } : (x: number) => { }; // returns Object => void +>r8 : (x: Object) => void +>true ? (x: Object) => { } : (x: number) => { } : (x: Object) => void +>(x: Object) => { } : (x: Object) => void +>x : Object +>Object : Object +>(x: number) => { } : (x: number) => void +>x : number + +var r10: Base = true ? derived : derived2; // no error since we use the contextual type in BCT +>r10 : Base +>Base : Base +>true ? derived : derived2 : Base +>derived : Derived +>derived2 : Derived2 + +var r11 = true ? base : derived2; +>r11 : Base +>true ? base : derived2 : Base +>base : Base +>derived2 : Derived2 + +function foo5(t: T, u: U): Object { +>foo5 : (t: T, u: U) => Object +>T : T +>U : U +>t : T +>T : T +>u : U +>U : U +>Object : Object + + return true ? t : u; // BCT is Object +>true ? t : u : Object +>t : T +>u : U +} diff --git a/tests/baselines/reference/bestCommonTypeReturnStatement.types b/tests/baselines/reference/bestCommonTypeReturnStatement.types new file mode 100644 index 00000000000..e1b99339036 --- /dev/null +++ b/tests/baselines/reference/bestCommonTypeReturnStatement.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/bestCommonTypeReturnStatement.ts === +interface IPromise { +>IPromise : IPromise +>T : T + + then(successCallback: (promiseValue: T) => any, errorCallback?: (reason: any) => any): IPromise; +>then : (successCallback: (promiseValue: T) => any, errorCallback?: (reason: any) => any) => IPromise +>successCallback : (promiseValue: T) => any +>promiseValue : T +>T : T +>errorCallback : (reason: any) => any +>reason : any +>IPromise : IPromise +} + +function f() { +>f : () => IPromise + + if (true) return b(); +>b() : IPromise +>b : () => IPromise + + return d(); +>d() : IPromise +>d : () => IPromise +} + + +function b(): IPromise { return null; } +>b : () => IPromise +>IPromise : IPromise + +function d(): IPromise { return null; } +>d : () => IPromise +>IPromise : IPromise + diff --git a/tests/baselines/reference/bestCommonTypeWithContextualTyping.types b/tests/baselines/reference/bestCommonTypeWithContextualTyping.types new file mode 100644 index 00000000000..5ee96dad667 --- /dev/null +++ b/tests/baselines/reference/bestCommonTypeWithContextualTyping.types @@ -0,0 +1,56 @@ +=== tests/cases/compiler/bestCommonTypeWithContextualTyping.ts === +interface Contextual { +>Contextual : Contextual + + dummy; +>dummy : any + + p?: number; +>p : number +} + +interface Ellement { +>Ellement : Ellement + + dummy; +>dummy : any + + p: any; +>p : any +} + +var e: Ellement; +>e : Ellement +>Ellement : Ellement + +// All of these should pass. Neither type is a supertype of the other, but the RHS should +// always use Ellement in these examples (not Contextual). Because Ellement is assignable +// to Contextual, no errors. +var arr: Contextual[] = [e]; // Ellement[] +>arr : Contextual[] +>Contextual : Contextual +>[e] : Ellement[] +>e : Ellement + +var obj: { [s: string]: Contextual } = { s: e }; // { s: Ellement; [s: string]: Ellement } +>obj : { [x: string]: Contextual; } +>s : string +>Contextual : Contextual +>{ s: e } : { [x: string]: Ellement; s: Ellement; } +>s : Ellement +>e : e + +var conditional: Contextual = null ? e : e; // Ellement +>conditional : Contextual +>Contextual : Contextual +>null ? e : e : Ellement +>e : Ellement +>e : Ellement + +var contextualOr: Contextual = e || e; // Ellement +>contextualOr : Contextual +>Contextual : Contextual +>e || e : Ellement +>e : Ellement +>e : Ellement + diff --git a/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types b/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types new file mode 100644 index 00000000000..df40291b0e5 --- /dev/null +++ b/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types @@ -0,0 +1,70 @@ +=== tests/cases/compiler/bestCommonTypeWithOptionalProperties.ts === +interface X { foo: string } +>X : X +>foo : string + +interface Y extends X { bar?: number } +>Y : Y +>X : X +>bar : number + +interface Z extends X { bar: string } +>Z : Z +>X : X +>bar : string + +var x: X; +>x : X +>X : X + +var y: Y; +>y : Y +>Y : Y + +var z: Z; +>z : Z +>Z : Z + +// All these arrays should be X[] +var b1 = [x, y, z]; +>b1 : X[] +>[x, y, z] : X[] +>x : X +>y : Y +>z : Z + +var b2 = [x, z, y]; +>b2 : X[] +>[x, z, y] : X[] +>x : X +>z : Z +>y : Y + +var b3 = [y, x, z]; +>b3 : X[] +>[y, x, z] : X[] +>y : Y +>x : X +>z : Z + +var b4 = [y, z, x]; +>b4 : X[] +>[y, z, x] : X[] +>y : Y +>z : Z +>x : X + +var b5 = [z, x, y]; +>b5 : X[] +>[z, x, y] : X[] +>z : Z +>x : X +>y : Y + +var b6 = [z, y, x]; +>b6 : X[] +>[z, y, x] : X[] +>z : Z +>y : Y +>x : X + diff --git a/tests/baselines/reference/binaryArithmatic1.types b/tests/baselines/reference/binaryArithmatic1.types new file mode 100644 index 00000000000..2aec9528116 --- /dev/null +++ b/tests/baselines/reference/binaryArithmatic1.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/binaryArithmatic1.ts === +var v = 4 | null; +>v : number +>4 | null : number + diff --git a/tests/baselines/reference/binaryArithmatic2.types b/tests/baselines/reference/binaryArithmatic2.types new file mode 100644 index 00000000000..9fe3350fc24 --- /dev/null +++ b/tests/baselines/reference/binaryArithmatic2.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/binaryArithmatic2.ts === +var v = 4 | undefined; +>v : number +>4 | undefined : number +>undefined : undefined + diff --git a/tests/baselines/reference/bind2.types b/tests/baselines/reference/bind2.types new file mode 100644 index 00000000000..f51d09abcdd --- /dev/null +++ b/tests/baselines/reference/bind2.types @@ -0,0 +1,3 @@ +=== tests/cases/compiler/bind2.ts === + +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/binopAssignmentShouldHaveType.types b/tests/baselines/reference/binopAssignmentShouldHaveType.types new file mode 100644 index 00000000000..cf6966147bc --- /dev/null +++ b/tests/baselines/reference/binopAssignmentShouldHaveType.types @@ -0,0 +1,48 @@ +=== tests/cases/compiler/binopAssignmentShouldHaveType.ts === +declare var console; +>console : any + +"use strict"; +module Test { +>Test : typeof Test + + export class Bug { +>Bug : Bug + + getName():string { +>getName : () => string + + return "name"; + } + bug() { +>bug : () => void + + var name:string= null; +>name : string + + if ((name= this.getName()).length > 0) { +>(name= this.getName()).length > 0 : boolean +>(name= this.getName()).length : number +>(name= this.getName()) : string +>name= this.getName() : string +>name : string +>this.getName() : string +>this.getName : () => string +>this : Bug +>getName : () => string +>length : number + + console.log(name); +>console.log(name) : any +>console.log : any +>console : any +>log : any +>name : string + } + } + } +} + + + + diff --git a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.types b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.types new file mode 100644 index 00000000000..ce870dbc818 --- /dev/null +++ b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.types @@ -0,0 +1,112 @@ +=== tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithBooleanType.ts === +// ~ operator on boolean type +var BOOLEAN: boolean; +>BOOLEAN : boolean + +function foo(): boolean { return true; } +>foo : () => boolean + +class A { +>A : A + + public a: boolean; +>a : boolean + + static foo() { return false; } +>foo : () => boolean +} +module M { +>M : typeof M + + export var n: boolean; +>n : boolean +} + +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// boolean type var +var ResultIsNumber1 = ~BOOLEAN; +>ResultIsNumber1 : number +>~BOOLEAN : number +>BOOLEAN : boolean + +// boolean type literal +var ResultIsNumber2 = ~true; +>ResultIsNumber2 : number +>~true : number + +var ResultIsNumber3 = ~{ x: true, y: false }; +>ResultIsNumber3 : number +>~{ x: true, y: false } : number +>{ x: true, y: false } : { x: boolean; y: boolean; } +>x : boolean +>y : boolean + +// boolean type expressions +var ResultIsNumber4 = ~objA.a; +>ResultIsNumber4 : number +>~objA.a : number +>objA.a : boolean +>objA : A +>a : boolean + +var ResultIsNumber5 = ~M.n; +>ResultIsNumber5 : number +>~M.n : number +>M.n : boolean +>M : typeof M +>n : boolean + +var ResultIsNumber6 = ~foo(); +>ResultIsNumber6 : number +>~foo() : number +>foo() : boolean +>foo : () => boolean + +var ResultIsNumber7 = ~A.foo(); +>ResultIsNumber7 : number +>~A.foo() : number +>A.foo() : boolean +>A.foo : () => boolean +>A : typeof A +>foo : () => boolean + +// multiple ~ operators +var ResultIsNumber8 = ~~BOOLEAN; +>ResultIsNumber8 : number +>~~BOOLEAN : number +>~BOOLEAN : number +>BOOLEAN : boolean + +// miss assignment operators +~true; +>~true : number + +~BOOLEAN; +>~BOOLEAN : number +>BOOLEAN : boolean + +~foo(); +>~foo() : number +>foo() : boolean +>foo : () => boolean + +~true, false; +>~true, false : boolean +>~true : number + +~objA.a; +>~objA.a : number +>objA.a : boolean +>objA : A +>a : boolean + +~M.n; +>~M.n : number +>M.n : boolean +>M : typeof M +>n : boolean + diff --git a/tests/baselines/reference/bitwiseNotOperatorWithEnumType.types b/tests/baselines/reference/bitwiseNotOperatorWithEnumType.types new file mode 100644 index 00000000000..077b8fdd4d6 --- /dev/null +++ b/tests/baselines/reference/bitwiseNotOperatorWithEnumType.types @@ -0,0 +1,61 @@ +=== tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType.ts === +// ~ operator on enum type + +enum ENUM1 { 1, 2, "" }; +>ENUM1 : ENUM1 + +// enum type var +var ResultIsNumber1 = ~ENUM1; +>ResultIsNumber1 : number +>~ENUM1 : number +>ENUM1 : typeof ENUM1 + +// enum type expressions +var ResultIsNumber2 = ~ENUM1[1]; +>ResultIsNumber2 : number +>~ENUM1[1] : number +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 + +var ResultIsNumber3 = ~(ENUM1[1] + ENUM1[2]); +>ResultIsNumber3 : number +>~(ENUM1[1] + ENUM1[2]) : number +>(ENUM1[1] + ENUM1[2]) : number +>ENUM1[1] + ENUM1[2] : number +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 +>ENUM1[2] : ENUM1 +>ENUM1 : typeof ENUM1 + +// multiple ~ operators +var ResultIsNumber4 = ~~~(ENUM1[1] + ENUM1[2]); +>ResultIsNumber4 : number +>~~~(ENUM1[1] + ENUM1[2]) : number +>~~(ENUM1[1] + ENUM1[2]) : number +>~(ENUM1[1] + ENUM1[2]) : number +>(ENUM1[1] + ENUM1[2]) : number +>ENUM1[1] + ENUM1[2] : number +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 +>ENUM1[2] : ENUM1 +>ENUM1 : typeof ENUM1 + +// miss assignment operators +~ENUM1; +>~ENUM1 : number +>ENUM1 : typeof ENUM1 + +~ENUM1[1]; +>~ENUM1[1] : number +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 + +~ENUM1[1], ~ENUM1[2]; +>~ENUM1[1], ~ENUM1[2] : number +>~ENUM1[1] : number +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 +>~ENUM1[2] : number +>ENUM1[2] : ENUM1 +>ENUM1 : typeof ENUM1 + diff --git a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.types b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.types new file mode 100644 index 00000000000..94207a56343 --- /dev/null +++ b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.types @@ -0,0 +1,162 @@ +=== tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithNumberType.ts === +// ~ operator on number type +var NUMBER: number; +>NUMBER : number + +var NUMBER1: number[] = [1, 2]; +>NUMBER1 : number[] +>[1, 2] : number[] + +function foo(): number { return 1; } +>foo : () => number + +class A { +>A : A + + public a: number; +>a : number + + static foo() { return 1; } +>foo : () => number +} +module M { +>M : typeof M + + export var n: number; +>n : number +} + +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// number type var +var ResultIsNumber1 = ~NUMBER; +>ResultIsNumber1 : number +>~NUMBER : number +>NUMBER : number + +var ResultIsNumber2 = ~NUMBER1; +>ResultIsNumber2 : number +>~NUMBER1 : number +>NUMBER1 : number[] + +// number type literal +var ResultIsNumber3 = ~1; +>ResultIsNumber3 : number +>~1 : number + +var ResultIsNumber4 = ~{ x: 1, y: 2}; +>ResultIsNumber4 : number +>~{ x: 1, y: 2} : number +>{ x: 1, y: 2} : { x: number; y: number; } +>x : number +>y : number + +var ResultIsNumber5 = ~{ x: 1, y: (n: number) => { return n; } }; +>ResultIsNumber5 : number +>~{ x: 1, y: (n: number) => { return n; } } : number +>{ x: 1, y: (n: number) => { return n; } } : { x: number; y: (n: number) => number; } +>x : number +>y : (n: number) => number +>(n: number) => { return n; } : (n: number) => number +>n : number +>n : number + +// number type expressions +var ResultIsNumber6 = ~objA.a; +>ResultIsNumber6 : number +>~objA.a : number +>objA.a : number +>objA : A +>a : number + +var ResultIsNumber7 = ~M.n; +>ResultIsNumber7 : number +>~M.n : number +>M.n : number +>M : typeof M +>n : number + +var ResultIsNumber8 = ~NUMBER1[0]; +>ResultIsNumber8 : number +>~NUMBER1[0] : number +>NUMBER1[0] : number +>NUMBER1 : number[] + +var ResultIsNumber9 = ~foo(); +>ResultIsNumber9 : number +>~foo() : number +>foo() : number +>foo : () => number + +var ResultIsNumber10 = ~A.foo(); +>ResultIsNumber10 : number +>~A.foo() : number +>A.foo() : number +>A.foo : () => number +>A : typeof A +>foo : () => number + +var ResultIsNumber11 = ~(NUMBER + NUMBER); +>ResultIsNumber11 : number +>~(NUMBER + NUMBER) : number +>(NUMBER + NUMBER) : number +>NUMBER + NUMBER : number +>NUMBER : number +>NUMBER : number + +// multiple ~ operators +var ResultIsNumber12 = ~~NUMBER; +>ResultIsNumber12 : number +>~~NUMBER : number +>~NUMBER : number +>NUMBER : number + +var ResultIsNumber13 = ~~~(NUMBER + NUMBER); +>ResultIsNumber13 : number +>~~~(NUMBER + NUMBER) : number +>~~(NUMBER + NUMBER) : number +>~(NUMBER + NUMBER) : number +>(NUMBER + NUMBER) : number +>NUMBER + NUMBER : number +>NUMBER : number +>NUMBER : number + +// miss assignment operators +~NUMBER; +>~NUMBER : number +>NUMBER : number + +~NUMBER1; +>~NUMBER1 : number +>NUMBER1 : number[] + +~foo(); +>~foo() : number +>foo() : number +>foo : () => number + +~objA.a; +>~objA.a : number +>objA.a : number +>objA : A +>a : number + +~M.n; +>~M.n : number +>M.n : number +>M : typeof M +>n : number + +~objA.a, M.n; +>~objA.a, M.n : number +>~objA.a : number +>objA.a : number +>objA : A +>a : number +>M.n : number +>M : typeof M +>n : number + diff --git a/tests/baselines/reference/bitwiseNotOperatorWithStringType.types b/tests/baselines/reference/bitwiseNotOperatorWithStringType.types new file mode 100644 index 00000000000..dbe2f29631e --- /dev/null +++ b/tests/baselines/reference/bitwiseNotOperatorWithStringType.types @@ -0,0 +1,158 @@ +=== tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithStringType.ts === +// ~ operator on string type +var STRING: string; +>STRING : string + +var STRING1: string[] = ["", "abc"]; +>STRING1 : string[] +>["", "abc"] : string[] + +function foo(): string { return "abc"; } +>foo : () => string + +class A { +>A : A + + public a: string; +>a : string + + static foo() { return ""; } +>foo : () => string +} +module M { +>M : typeof M + + export var n: string; +>n : string +} + +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// string type var +var ResultIsNumber1 = ~STRING; +>ResultIsNumber1 : number +>~STRING : number +>STRING : string + +var ResultIsNumber2 = ~STRING1; +>ResultIsNumber2 : number +>~STRING1 : number +>STRING1 : string[] + +// string type literal +var ResultIsNumber3 = ~""; +>ResultIsNumber3 : number +>~"" : number + +var ResultIsNumber4 = ~{ x: "", y: "" }; +>ResultIsNumber4 : number +>~{ x: "", y: "" } : number +>{ x: "", y: "" } : { x: string; y: string; } +>x : string +>y : string + +var ResultIsNumber5 = ~{ x: "", y: (s: string) => { return s; } }; +>ResultIsNumber5 : number +>~{ x: "", y: (s: string) => { return s; } } : number +>{ x: "", y: (s: string) => { return s; } } : { x: string; y: (s: string) => string; } +>x : string +>y : (s: string) => string +>(s: string) => { return s; } : (s: string) => string +>s : string +>s : string + +// string type expressions +var ResultIsNumber6 = ~objA.a; +>ResultIsNumber6 : number +>~objA.a : number +>objA.a : string +>objA : A +>a : string + +var ResultIsNumber7 = ~M.n; +>ResultIsNumber7 : number +>~M.n : number +>M.n : string +>M : typeof M +>n : string + +var ResultIsNumber8 = ~STRING1[0]; +>ResultIsNumber8 : number +>~STRING1[0] : number +>STRING1[0] : string +>STRING1 : string[] + +var ResultIsNumber9 = ~foo(); +>ResultIsNumber9 : number +>~foo() : number +>foo() : string +>foo : () => string + +var ResultIsNumber10 = ~A.foo(); +>ResultIsNumber10 : number +>~A.foo() : number +>A.foo() : string +>A.foo : () => string +>A : typeof A +>foo : () => string + +var ResultIsNumber11 = ~(STRING + STRING); +>ResultIsNumber11 : number +>~(STRING + STRING) : number +>(STRING + STRING) : string +>STRING + STRING : string +>STRING : string +>STRING : string + +var ResultIsNumber12 = ~STRING.charAt(0); +>ResultIsNumber12 : number +>~STRING.charAt(0) : number +>STRING.charAt(0) : string +>STRING.charAt : (pos: number) => string +>STRING : string +>charAt : (pos: number) => string + +// multiple ~ operators +var ResultIsNumber13 = ~~STRING; +>ResultIsNumber13 : number +>~~STRING : number +>~STRING : number +>STRING : string + +var ResultIsNumber14 = ~~~(STRING + STRING); +>ResultIsNumber14 : number +>~~~(STRING + STRING) : number +>~~(STRING + STRING) : number +>~(STRING + STRING) : number +>(STRING + STRING) : string +>STRING + STRING : string +>STRING : string +>STRING : string + +//miss assignment operators +~STRING; +>~STRING : number +>STRING : string + +~STRING1; +>~STRING1 : number +>STRING1 : string[] + +~foo(); +>~foo() : number +>foo() : string +>foo : () => string + +~objA.a,M.n; +>~objA.a,M.n : string +>~objA.a : number +>objA.a : string +>objA : A +>a : string +>M.n : string +>M : typeof M +>n : string + diff --git a/tests/baselines/reference/bom-utf16be.types b/tests/baselines/reference/bom-utf16be.types new file mode 100644 index 00000000000..04c6a5a61bb --- /dev/null +++ b/tests/baselines/reference/bom-utf16be.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/bom-utf16be.ts === +var x=10; +>x : number + diff --git a/tests/baselines/reference/bom-utf16le.types b/tests/baselines/reference/bom-utf16le.types new file mode 100644 index 00000000000..15970945942 --- /dev/null +++ b/tests/baselines/reference/bom-utf16le.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/bom-utf16le.ts === +var x=10; +>x : number + diff --git a/tests/baselines/reference/bom-utf8.types b/tests/baselines/reference/bom-utf8.types new file mode 100644 index 00000000000..b8398f7b6b6 --- /dev/null +++ b/tests/baselines/reference/bom-utf8.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/bom-utf8.ts === +var x=10; +>x : number + diff --git a/tests/baselines/reference/booleanPropertyAccess.types b/tests/baselines/reference/booleanPropertyAccess.types new file mode 100644 index 00000000000..d273e3b8852 --- /dev/null +++ b/tests/baselines/reference/booleanPropertyAccess.types @@ -0,0 +1,17 @@ +=== tests/cases/conformance/types/primitives/boolean/booleanPropertyAccess.ts === +var x = true; +>x : boolean + +var a = x.toString(); +>a : string +>x.toString() : string +>x.toString : () => string +>x : boolean +>toString : () => string + +var b = x['toString'](); +>b : string +>x['toString']() : string +>x['toString'] : () => string +>x : boolean + diff --git a/tests/baselines/reference/callExpressionWithTypeParameterConstrainedToOuterTypeParameter.types b/tests/baselines/reference/callExpressionWithTypeParameterConstrainedToOuterTypeParameter.types new file mode 100644 index 00000000000..54752a853c9 --- /dev/null +++ b/tests/baselines/reference/callExpressionWithTypeParameterConstrainedToOuterTypeParameter.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/callExpressionWithTypeParameterConstrainedToOuterTypeParameter.ts === +interface I { +>I : I +>T : T + + (u: U): U; +>U : U +>T : T +>u : U +>U : U +>U : U +} +var i: I; +>i : I +>I : I + +var y = i(""); // y should be string +>y : string +>i("") : string +>i : I + diff --git a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.types b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.types new file mode 100644 index 00000000000..14759564b01 --- /dev/null +++ b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.types @@ -0,0 +1,126 @@ +=== tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithZeroTypeArguments.ts === +// valid invocations of generic functions with no explicit type arguments provided + +function f(x: T): T { return null; } +>f : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +var r = f(1); +>r : number +>f(1) : number +>f : (x: T) => T + +var f2 = (x: T): T => { return null; } +>f2 : (x: T) => T +>(x: T): T => { return null; } : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +var r2 = f2(1); +>r2 : number +>f2(1) : number +>f2 : (x: T) => T + +var f3: { (x: T): T; } +>f3 : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +var r3 = f3(1); +>r3 : number +>f3(1) : number +>f3 : (x: T) => T + +class C { +>C : C + + f(x: T): T { +>f : (x: T) => T +>T : T +>x : T +>T : T +>T : T + + return null; + } +} +var r4 = (new C()).f(1); +>r4 : number +>(new C()).f(1) : number +>(new C()).f : (x: T) => T +>(new C()) : C +>new C() : C +>C : typeof C +>f : (x: T) => T + +interface I { +>I : I + + f(x: T): T; +>f : (x: T) => T +>T : T +>x : T +>T : T +>T : T +} +var i: I; +>i : I +>I : I + +var r5 = i.f(1); +>r5 : number +>i.f(1) : number +>i.f : (x: T) => T +>i : I +>f : (x: T) => T + +class C2 { +>C2 : C2 +>T : T + + f(x: T): T { +>f : (x: T) => T +>x : T +>T : T +>T : T + + return null; + } +} +var r6 = (new C2()).f(1); +>r6 : {} +>(new C2()).f(1) : {} +>(new C2()).f : (x: {}) => {} +>(new C2()) : C2<{}> +>new C2() : C2<{}> +>C2 : typeof C2 +>f : (x: {}) => {} + +interface I2 { +>I2 : I2 +>T : T + + f(x: T): T; +>f : (x: T) => T +>x : T +>T : T +>T : T +} +var i2: I2; +>i2 : I2 +>I2 : I2 + +var r7 = i2.f(1); +>r7 : number +>i2.f(1) : number +>i2.f : (x: number) => number +>i2 : I2 +>f : (x: number) => number + diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.types b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.types new file mode 100644 index 00000000000..d5886bd5ef8 --- /dev/null +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.types @@ -0,0 +1,398 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance2.ts === +// checking subtype relations for function types as it relates to contextual signature instantiation + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Derived { baz: string; } +>Derived2 : Derived2 +>Derived : Derived +>baz : string + +class OtherDerived extends Base { bing: string; } +>OtherDerived : OtherDerived +>Base : Base +>bing : string + +interface A { // T +>A : A + + // M's + a: (x: number) => number[]; +>a : (x: number) => number[] +>x : number + + a2: (x: number) => string[]; +>a2 : (x: number) => string[] +>x : number + + a3: (x: number) => void; +>a3 : (x: number) => void +>x : number + + a4: (x: string, y: number) => string; +>a4 : (x: string, y: number) => string +>x : string +>y : number + + a5: (x: (arg: string) => number) => string; +>a5 : (x: (arg: string) => number) => string +>x : (arg: string) => number +>arg : string + + a6: (x: (arg: Base) => Derived) => Base; +>a6 : (x: (arg: Base) => Derived) => Base +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>Base : Base + + a7: (x: (arg: Base) => Derived) => (r: Base) => Derived; +>a7 : (x: (arg: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + + a8: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; +>a8 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>y : (arg2: Base) => Derived +>arg2 : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + + a9: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; +>a9 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>y : (arg2: Base) => Derived +>arg2 : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + + a10: (...x: Derived[]) => Derived; +>a10 : (...x: Derived[]) => Derived +>x : Derived[] +>Derived : Derived +>Derived : Derived + + a11: (x: { foo: string }, y: { foo: string; bar: string }) => Base; +>a11 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base +>x : { foo: string; } +>foo : string +>y : { foo: string; bar: string; } +>foo : string +>bar : string +>Base : Base + + a12: (x: Array, y: Array) => Array; +>a12 : (x: Base[], y: Derived2[]) => Derived[] +>x : Base[] +>Array : Array +>Base : Base +>y : Derived2[] +>Array : Array +>Derived2 : Derived2 +>Array : Array +>Derived : Derived + + a13: (x: Array, y: Array) => Array; +>a13 : (x: Base[], y: Derived[]) => Derived[] +>x : Base[] +>Array : Array +>Base : Base +>y : Derived[] +>Array : Array +>Derived : Derived +>Array : Array +>Derived : Derived + + a14: (x: { a: string; b: number }) => Object; +>a14 : (x: { a: string; b: number; }) => Object +>x : { a: string; b: number; } +>a : string +>b : number +>Object : Object + + a15: { +>a15 : { (x: number): number[]; (x: string): string[]; } + + (x: number): number[]; +>x : number + + (x: string): string[]; +>x : string + + }; + a16: { +>a16 : { (x: T): number[]; (x: U): number[]; } + + (x: T): number[]; +>T : T +>Derived : Derived +>x : T +>T : T + + (x: U): number[]; +>U : U +>Base : Base +>x : U +>U : U + + }; + a17: { +>a17 : { (x: (a: number) => number): number[]; (x: (a: string) => string): string[]; } + + (x: (a: number) => number): number[]; +>x : (a: number) => number +>a : number + + (x: (a: string) => string): string[]; +>x : (a: string) => string +>a : string + + }; + a18: { +>a18 : { (x: { (a: number): number; (a: string): string; }): any[]; (x: { (a: boolean): boolean; (a: Date): Date; }): any[]; } + + (x: { +>x : { (a: number): number; (a: string): string; } + + (a: number): number; +>a : number + + (a: string): string; +>a : string + + }): any[]; + (x: { +>x : { (a: boolean): boolean; (a: Date): Date; } + + (a: boolean): boolean; +>a : boolean + + (a: Date): Date; +>a : Date +>Date : Date +>Date : Date + + }): any[]; + }; +} + +// S's +interface I extends A { +>I : I +>A : A + + // N's + a: (x: T) => T[]; // ok, instantiation of N is a subtype of M, T is number +>a : (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + + a2: (x: T) => string[]; // ok +>a2 : (x: T) => string[] +>T : T +>x : T +>T : T + + a3: (x: T) => T; // ok since Base returns void +>a3 : (x: T) => T +>T : T +>x : T +>T : T +>T : T + + a4: (x: T, y: U) => T; // ok, instantiation of N is a subtype of M, T is string, U is number +>a4 : (x: T, y: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T + + a5: (x: (arg: T) => U) => T; // ok, U is in a parameter position so inferences can be made +>a5 : (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a6: (x: (arg: T) => U) => T; // ok, same as a5 but with object type hierarchy +>a6 : (x: (arg: T) => U) => T +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a7: (x: (arg: T) => U) => (r: T) => U; // ok +>a7 : (x: (arg: T) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>r : T +>T : T +>U : U + + a8: (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U; // ok +>a8 : (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>y : (arg2: T) => U +>arg2 : T +>T : T +>U : U +>r : T +>T : T +>U : U + + a9: (x: (arg: T) => U, y: (arg2: { foo: string; bing: number }) => U) => (r: T) => U; // ok, same as a8 with compatible object literal +>a9 : (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>y : (arg2: { foo: string; bing: number; }) => U +>arg2 : { foo: string; bing: number; } +>foo : string +>bing : number +>U : U +>r : T +>T : T +>U : U + + a10: (...x: T[]) => T; // ok +>a10 : (...x: T[]) => T +>T : T +>Derived : Derived +>x : T[] +>T : T +>T : T + + a11: (x: T, y: T) => T; // ok +>a11 : (x: T, y: T) => T +>T : T +>Base : Base +>x : T +>T : T +>y : T +>T : T +>T : T + + a12: >(x: Array, y: T) => Array; // ok, less specific parameter type +>a12 : (x: Base[], y: T) => Derived[] +>T : T +>Array : Array +>Base : Base +>x : Base[] +>Array : Array +>Base : Base +>y : T +>T : T +>Array : Array +>Derived : Derived + + a13: >(x: Array, y: T) => T; // ok, T = Array, satisfies constraint, contextual signature instantiation succeeds +>a13 : (x: Base[], y: T) => T +>T : T +>Array : Array +>Derived : Derived +>x : Base[] +>Array : Array +>Base : Base +>y : T +>T : T +>T : T + + a14: (x: { a: T; b: T }) => T; // ok, best common type yields T = {} but that's satisfactory for this signature +>a14 : (x: { a: T; b: T; }) => T +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + + a15: (x: T) => T[]; // ok +>a15 : (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + + a16: (x: T) => number[]; // ok +>a16 : (x: T) => number[] +>T : T +>Base : Base +>x : T +>T : T + + a17: (x: (a: T) => T) => T[]; // ok +>a17 : (x: (a: T) => T) => T[] +>T : T +>x : (a: T) => T +>a : T +>T : T +>T : T +>T : T + + a18: (x: (a: T) => T) => T[]; // ok, no inferences for T but assignable to any +>a18 : (x: (a: T) => T) => T[] +>T : T +>x : (a: T) => T +>a : T +>T : T +>T : T +>T : T +} diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.types b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.types new file mode 100644 index 00000000000..0575d1332ce --- /dev/null +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.types @@ -0,0 +1,281 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance4.ts === +// checking subtype relations for function types as it relates to contextual signature instantiation + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Derived { baz: string; } +>Derived2 : Derived2 +>Derived : Derived +>baz : string + +class OtherDerived extends Base { bing: string; } +>OtherDerived : OtherDerived +>Base : Base +>bing : string + +interface A { // T +>A : A + + // M's + a: (x: T) => T[]; +>a : (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + + a2: (x: T) => string[]; +>a2 : (x: T) => string[] +>T : T +>x : T +>T : T + + a3: (x: T) => void; +>a3 : (x: T) => void +>T : T +>x : T +>T : T + + a4: (x: T, y: U) => string; +>a4 : (x: T, y: U) => string +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U + + a5: (x: (arg: T) => U) => T; +>a5 : (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a6: (x: (arg: T) => Derived) => T; +>a6 : (x: (arg: T) => Derived) => T +>T : T +>Base : Base +>x : (arg: T) => Derived +>arg : T +>T : T +>Derived : Derived +>T : T + + a11: (x: { foo: T }, y: { foo: T; bar: T }) => Base; +>a11 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>T : T +>x : { foo: T; } +>foo : T +>T : T +>y : { foo: T; bar: T; } +>foo : T +>T : T +>bar : T +>T : T +>Base : Base + + a15: (x: { a: T; b: T }) => T[]; +>a15 : (x: { a: T; b: T; }) => T[] +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + + a16: (x: { a: T; b: T }) => T[]; +>a16 : (x: { a: T; b: T; }) => T[] +>T : T +>Base : Base +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + + a17: { +>a17 : { (x: (a: T) => T): T[]; (x: (a: T) => T): T[]; } + + (x: (a: T) => T): T[]; +>T : T +>Derived : Derived +>x : (a: T) => T +>a : T +>T : T +>T : T +>T : T + + (x: (a: T) => T): T[]; +>T : T +>Base : Base +>x : (a: T) => T +>a : T +>T : T +>T : T +>T : T + + }; + a18: { +>a18 : { (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[]; } + + (x: { +>x : { (a: T): T; (a: T): T; } + + (a: T): T; +>T : T +>Derived : Derived +>a : T +>T : T +>T : T + + (a: T): T; +>T : T +>Base : Base +>a : T +>T : T +>T : T + + }): any[]; + (x: { +>x : { (a: T): T; (a: T): T; } + + (a: T): T; +>T : T +>Derived2 : Derived2 +>a : T +>T : T +>T : T + + (a: T): T; +>T : T +>Base : Base +>a : T +>T : T +>T : T + + }): any[]; + }; +} + +// S's +interface I extends A { +>I : I +>A : A + + // N's + a: (x: T) => T[]; // ok, instantiation of N is a subtype of M, T is number +>a : (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + + a2: (x: T) => string[]; // ok +>a2 : (x: T) => string[] +>T : T +>x : T +>T : T + + a3: (x: T) => T; // ok since Base returns void +>a3 : (x: T) => T +>T : T +>x : T +>T : T +>T : T + + a4: (x: T, y: U) => string; // ok, instantiation of N is a subtype of M, T is string, U is number +>a4 : (x: T, y: U) => string +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U + + a5: (x: (arg: T) => U) => T; // ok, U is in a parameter position so inferences can be made +>a5 : (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a6: (x: (arg: T) => U) => T; // ok, same as a5 but with object type hierarchy +>a6 : (x: (arg: T) => U) => T +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a11: (x: { foo: T }, y: { foo: U; bar: U }) => Base; // ok +>a11 : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base +>T : T +>U : U +>x : { foo: T; } +>foo : T +>T : T +>y : { foo: U; bar: U; } +>foo : U +>U : U +>bar : U +>U : U +>Base : Base + + a15: (x: { a: U; b: V; }) => U[]; // ok, T = U, T = V +>a15 : (x: { a: U; b: V; }) => U[] +>U : U +>V : V +>x : { a: U; b: V; } +>a : U +>U : U +>b : V +>V : V +>U : U + + a16: (x: { a: T; b: T }) => T[]; // ok, more general parameter type +>a16 : (x: { a: T; b: T; }) => T[] +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + + a17: (x: (a: T) => T) => T[]; // ok +>a17 : (x: (a: T) => T) => T[] +>T : T +>x : (a: T) => T +>a : T +>T : T +>T : T +>T : T + + a18: (x: (a: T) => T) => any[]; // ok +>a18 : (x: (a: T) => T) => any[] +>x : (a: T) => T +>T : T +>a : T +>T : T +>T : T +} diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.types b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.types new file mode 100644 index 00000000000..500646a189f --- /dev/null +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.types @@ -0,0 +1,314 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance5.ts === +// checking subtype relations for function types as it relates to contextual signature instantiation +// same as subtypingWithCallSignatures2 just with an extra level of indirection in the inheritance chain + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Derived { baz: string; } +>Derived2 : Derived2 +>Derived : Derived +>baz : string + +class OtherDerived extends Base { bing: string; } +>OtherDerived : OtherDerived +>Base : Base +>bing : string + +interface A { // T +>A : A + + // M's + a: (x: number) => number[]; +>a : (x: number) => number[] +>x : number + + a2: (x: number) => string[]; +>a2 : (x: number) => string[] +>x : number + + a3: (x: number) => void; +>a3 : (x: number) => void +>x : number + + a4: (x: string, y: number) => string; +>a4 : (x: string, y: number) => string +>x : string +>y : number + + a5: (x: (arg: string) => number) => string; +>a5 : (x: (arg: string) => number) => string +>x : (arg: string) => number +>arg : string + + a6: (x: (arg: Base) => Derived) => Base; +>a6 : (x: (arg: Base) => Derived) => Base +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>Base : Base + + a7: (x: (arg: Base) => Derived) => (r: Base) => Derived; +>a7 : (x: (arg: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + + a8: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; +>a8 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>y : (arg2: Base) => Derived +>arg2 : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + + a9: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; +>a9 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>y : (arg2: Base) => Derived +>arg2 : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + + a10: (...x: Derived[]) => Derived; +>a10 : (...x: Derived[]) => Derived +>x : Derived[] +>Derived : Derived +>Derived : Derived + + a11: (x: { foo: string }, y: { foo: string; bar: string }) => Base; +>a11 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base +>x : { foo: string; } +>foo : string +>y : { foo: string; bar: string; } +>foo : string +>bar : string +>Base : Base + + a12: (x: Array, y: Array) => Array; +>a12 : (x: Base[], y: Derived2[]) => Derived[] +>x : Base[] +>Array : Array +>Base : Base +>y : Derived2[] +>Array : Array +>Derived2 : Derived2 +>Array : Array +>Derived : Derived + + a13: (x: Array, y: Array) => Array; +>a13 : (x: Base[], y: Derived[]) => Derived[] +>x : Base[] +>Array : Array +>Base : Base +>y : Derived[] +>Array : Array +>Derived : Derived +>Array : Array +>Derived : Derived + + a14: (x: { a: string; b: number }) => Object; +>a14 : (x: { a: string; b: number; }) => Object +>x : { a: string; b: number; } +>a : string +>b : number +>Object : Object +} + +interface B extends A { +>B : B +>A : A + + a: (x: T) => T[]; +>a : (x: T) => T[] +>T : T +>x : T +>T : T +>T : T +} + +// S's +interface I extends B { +>I : I +>B : B + + // N's + a: (x: T) => T[]; // ok, instantiation of N is a subtype of M, T is number +>a : (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + + a2: (x: T) => string[]; // ok +>a2 : (x: T) => string[] +>T : T +>x : T +>T : T + + a3: (x: T) => T; // ok since Base returns void +>a3 : (x: T) => T +>T : T +>x : T +>T : T +>T : T + + a4: (x: T, y: U) => T; // ok, instantiation of N is a subtype of M, T is string, U is number +>a4 : (x: T, y: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T + + a5: (x: (arg: T) => U) => T; // ok, U is in a parameter position so inferences can be made +>a5 : (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a6: (x: (arg: T) => U) => T; // ok, same as a5 but with object type hierarchy +>a6 : (x: (arg: T) => U) => T +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a7: (x: (arg: T) => U) => (r: T) => U; // ok +>a7 : (x: (arg: T) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>r : T +>T : T +>U : U + + a8: (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U; // ok +>a8 : (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>y : (arg2: T) => U +>arg2 : T +>T : T +>U : U +>r : T +>T : T +>U : U + + a9: (x: (arg: T) => U, y: (arg2: { foo: string; bing: number }) => U) => (r: T) => U; // ok, same as a8 with compatible object literal +>a9 : (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>y : (arg2: { foo: string; bing: number; }) => U +>arg2 : { foo: string; bing: number; } +>foo : string +>bing : number +>U : U +>r : T +>T : T +>U : U + + a10: (...x: T[]) => T; // ok +>a10 : (...x: T[]) => T +>T : T +>Derived : Derived +>x : T[] +>T : T +>T : T + + a11: (x: T, y: T) => T; // ok +>a11 : (x: T, y: T) => T +>T : T +>Base : Base +>x : T +>T : T +>y : T +>T : T +>T : T + + a12: >(x: Array, y: T) => Array; // ok, less specific parameter type +>a12 : (x: Base[], y: T) => Derived[] +>T : T +>Array : Array +>Base : Base +>x : Base[] +>Array : Array +>Base : Base +>y : T +>T : T +>Array : Array +>Derived : Derived + + a13: >(x: Array, y: T) => T; // ok, T = Array, satisfies constraint, contextual signature instantiation succeeds +>a13 : (x: Base[], y: T) => T +>T : T +>Array : Array +>Derived : Derived +>x : Base[] +>Array : Array +>Base : Base +>y : T +>T : T +>T : T + + a14: (x: { a: T; b: T }) => T; // ok, best common type yields T = {} but that's satisfactory for this signature +>a14 : (x: { a: T; b: T; }) => T +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T +} diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.types b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.types new file mode 100644 index 00000000000..721b691be70 --- /dev/null +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.types @@ -0,0 +1,209 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance6.ts === +// checking subtype relations for function types as it relates to contextual signature instantiation +// same as subtypingWithCallSignatures4 but using class type parameters instead of generic signatures +// all are errors + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Derived { baz: string; } +>Derived2 : Derived2 +>Derived : Derived +>baz : string + +class OtherDerived extends Base { bing: string; } +>OtherDerived : OtherDerived +>Base : Base +>bing : string + +interface A { // T +>A : A + + // M's + a: (x: T) => T[]; +>a : (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + + a2: (x: T) => string[]; +>a2 : (x: T) => string[] +>T : T +>x : T +>T : T + + a3: (x: T) => void; +>a3 : (x: T) => void +>T : T +>x : T +>T : T + + a4: (x: T, y: U) => string; +>a4 : (x: T, y: U) => string +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U + + a5: (x: (arg: T) => U) => T; +>a5 : (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a6: (x: (arg: T) => Derived) => T; +>a6 : (x: (arg: T) => Derived) => T +>T : T +>Base : Base +>x : (arg: T) => Derived +>arg : T +>T : T +>Derived : Derived +>T : T + + a11: (x: { foo: T }, y: { foo: T; bar: T }) => Base; +>a11 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>T : T +>x : { foo: T; } +>foo : T +>T : T +>y : { foo: T; bar: T; } +>foo : T +>T : T +>bar : T +>T : T +>Base : Base + + a15: (x: { a: T; b: T }) => T[]; +>a15 : (x: { a: T; b: T; }) => T[] +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + + a16: (x: { a: T; b: T }) => T[]; +>a16 : (x: { a: T; b: T; }) => T[] +>T : T +>Base : Base +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T +} + +// S's +interface I extends A { +>I : I +>T : T +>A : A + + a: (x: T) => T[]; +>a : (x: T) => T[] +>x : T +>T : T +>T : T +} + +interface I2 extends A { +>I2 : I2 +>T : T +>A : A + + a2: (x: T) => string[]; +>a2 : (x: T) => string[] +>x : T +>T : T +} + +interface I3 extends A { +>I3 : I3 +>T : T +>A : A + + a3: (x: T) => T; +>a3 : (x: T) => T +>x : T +>T : T +>T : T +} + +interface I4 extends A { +>I4 : I4 +>T : T +>A : A + + a4: (x: T, y: U) => string; +>a4 : (x: T, y: U) => string +>U : U +>x : T +>T : T +>y : U +>U : U +} + +interface I5 extends A { +>I5 : I5 +>T : T +>A : A + + a5: (x: (arg: T) => U) => T; +>a5 : (x: (arg: T) => U) => T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T +} + +interface I7 extends A { +>I7 : I7 +>T : T +>A : A + + a11: (x: { foo: T }, y: { foo: U; bar: U }) => Base; +>a11 : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base +>U : U +>x : { foo: T; } +>foo : T +>T : T +>y : { foo: U; bar: U; } +>foo : U +>U : U +>bar : U +>U : U +>Base : Base +} + +interface I9 extends A { +>I9 : I9 +>T : T +>A : A + + a16: (x: { a: T; b: T }) => T[]; +>a16 : (x: { a: T; b: T; }) => T[] +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T +} diff --git a/tests/baselines/reference/callSignatureFunctionOverload.types b/tests/baselines/reference/callSignatureFunctionOverload.types new file mode 100644 index 00000000000..b9788e5b143 --- /dev/null +++ b/tests/baselines/reference/callSignatureFunctionOverload.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/callSignatureFunctionOverload.ts === +var foo: { +>foo : { (name: string): string; (name: 'order'): string; (name: 'content'): string; (name: 'done'): string; } + + (name: string): string; +>name : string + + (name: 'order'): string; +>name : 'order' + + (name: 'content'): string; +>name : 'content' + + (name: 'done'): string; +>name : 'done' +} + +var foo2: { +>foo2 : { (name: string): string; (name: 'order'): string; (name: 'order'): string; (name: 'done'): string; } + + (name: string): string; +>name : string + + (name: 'order'): string; +>name : 'order' + + (name: 'order'): string; +>name : 'order' + + (name: 'done'): string; +>name : 'done' +} + diff --git a/tests/baselines/reference/callSignatureWithoutAnnotationsOrBody.types b/tests/baselines/reference/callSignatureWithoutAnnotationsOrBody.types new file mode 100644 index 00000000000..b8b608762f5 --- /dev/null +++ b/tests/baselines/reference/callSignatureWithoutAnnotationsOrBody.types @@ -0,0 +1,55 @@ +=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutAnnotationsOrBody.ts === +// Call signatures without a return type annotation and function body return 'any' + +function foo(x) { } +>foo : (x: any) => void +>x : any + +var r = foo(1); // void since there's a body +>r : void +>foo(1) : void +>foo : (x: any) => void + +interface I { +>I : I + + (); + f(); +>f : () => any +} +var i: I; +>i : I +>I : I + +var r2 = i(); +>r2 : any +>i() : any +>i : I + +var r3 = i.f(); +>r3 : any +>i.f() : any +>i.f : () => any +>i : I +>f : () => any + +var a: { +>a : { (): any; f(): any; } + + (); + f(); +>f : () => any + +}; +var r4 = a(); +>r4 : any +>a() : any +>a : { (): any; f(): any; } + +var r5 = a.f(); +>r5 : any +>a.f() : any +>a.f : () => any +>a : { (): any; f(): any; } +>f : () => any + diff --git a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.types b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.types new file mode 100644 index 00000000000..2bb38c096f6 --- /dev/null +++ b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.types @@ -0,0 +1,276 @@ +=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts === +// Call signatures without a return type should infer one from the function body (if present) + +// Simple types +function foo(x) { +>foo : (x: any) => number +>x : any + + return 1; +} +var r = foo(1); +>r : number +>foo(1) : number +>foo : (x: any) => number + +function foo2(x) { +>foo2 : (x: any) => number +>x : any + + return foo(x); +>foo(x) : number +>foo : (x: any) => number +>x : any +} +var r2 = foo2(1); +>r2 : number +>foo2(1) : number +>foo2 : (x: any) => number + +function foo3() { +>foo3 : () => any + + return foo3(); +>foo3() : any +>foo3 : () => any +} +var r3 = foo3(); +>r3 : any +>foo3() : any +>foo3 : () => any + +function foo4(x: T) { +>foo4 : (x: T) => T +>T : T +>x : T +>T : T + + return x; +>x : T +} +var r4 = foo4(1); +>r4 : number +>foo4(1) : number +>foo4 : (x: T) => T + +function foo5(x) { +>foo5 : (x: any) => number +>x : any + + if (true) { + return 1; + } else { + return 2; + } +} +var r5 = foo5(1); +>r5 : number +>foo5(1) : number +>foo5 : (x: any) => number + +function foo6(x) { +>foo6 : (x: any) => any[] +>x : any + + try { + } + catch (e) { +>e : any + + return []; +>[] : undefined[] + } + finally { + return []; +>[] : undefined[] + } +} +var r6 = foo6(1); +>r6 : any[] +>foo6(1) : any[] +>foo6 : (x: any) => any[] + +function foo7(x) { +>foo7 : (x: any) => string +>x : any + + return typeof x; +>typeof x : string +>x : any +} +var r7 = foo7(1); +>r7 : string +>foo7(1) : string +>foo7 : (x: any) => string + +// object types +function foo8(x: number) { +>foo8 : (x: number) => { x: number; } +>x : number + + return { x: x }; +>{ x: x } : { x: number; } +>x : number +>x : x +} +var r8 = foo8(1); +>r8 : { x: number; } +>foo8(1) : { x: number; } +>foo8 : (x: number) => { x: number; } + +interface I { +>I : I + + foo: string; +>foo : string +} +function foo9(x: number) { +>foo9 : (x: number) => I +>x : number + + var i: I; +>i : I +>I : I + + return i; +>i : I +} +var r9 = foo9(1); +>r9 : I +>foo9(1) : I +>foo9 : (x: number) => I + +class C { +>C : C + + foo: string; +>foo : string +} +function foo10(x: number) { +>foo10 : (x: number) => C +>x : number + + var c: C; +>c : C +>C : C + + return c; +>c : C +} +var r10 = foo10(1); +>r10 : C +>foo10(1) : C +>foo10 : (x: number) => C + +module M { +>M : typeof M + + export var x = 1; +>x : number + + export class C { foo: string } +>C : C +>foo : string +} +function foo11() { +>foo11 : () => typeof M + + return M; +>M : typeof M +} +var r11 = foo11(); +>r11 : typeof M +>foo11() : typeof M +>foo11 : () => typeof M + +// merged declarations +interface I2 { +>I2 : I2 + + x: number; +>x : number +} +interface I2 { +>I2 : I2 + + y: number; +>y : number +} +function foo12() { +>foo12 : () => I2 + + var i2: I2; +>i2 : I2 +>I2 : I2 + + return i2; +>i2 : I2 +} +var r12 = foo12(); +>r12 : I2 +>foo12() : I2 +>foo12 : () => I2 + +function m1() { return 1; } +>m1 : typeof m1 + +module m1 { export var y = 2; } +>m1 : typeof m1 +>y : number + +function foo13() { +>foo13 : () => typeof m1 + + return m1; +>m1 : typeof m1 +} +var r13 = foo13(); +>r13 : typeof m1 +>foo13() : typeof m1 +>foo13 : () => typeof m1 + +class c1 { +>c1 : c1 + + foo: string; +>foo : string + + constructor(x) { } +>x : any +} +module c1 { +>c1 : typeof c1 + + export var x = 1; +>x : number +} +function foo14() { +>foo14 : () => typeof c1 + + return c1; +>c1 : typeof c1 +} +var r14 = foo14(); +>r14 : typeof c1 +>foo14() : typeof c1 +>foo14 : () => typeof c1 + +enum e1 { A } +>e1 : e1 +>A : e1 + +module e1 { export var y = 1; } +>e1 : typeof e1 +>y : number + +function foo15() { +>foo15 : () => typeof e1 + + return e1; +>e1 : typeof e1 +} +var r15 = foo15(); +>r15 : typeof e1 +>foo15() : typeof e1 +>foo15 : () => typeof e1 + diff --git a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType.types b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType.types new file mode 100644 index 00000000000..ff51a6fc60a --- /dev/null +++ b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType.types @@ -0,0 +1,76 @@ +=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType.ts === +// Each pair of signatures in these types has a signature that should cause an error. +// Overloads, generic or not, that differ only by return type are an error. +interface I { +>I : I + + (x): number; +>x : any + + (x): void; // error +>x : any + + (x: T): number; +>T : T +>x : T +>T : T + + (x: T): string; // error +>T : T +>x : T +>T : T +} + +interface I2 { +>I2 : I2 + + (x: T): number; +>T : T +>x : T +>T : T + + (x: T): string; // error +>T : T +>x : T +>T : T +} + +interface I3 { +>I3 : I3 +>T : T + + (x: T): number; +>x : T +>T : T + + (x: T): string; // error +>x : T +>T : T +} + +var a: { +>a : { (x: any, y: any): Object; (x: any, y: any): any; } + + (x, y): Object; +>x : any +>y : any +>Object : Object + + (x, y): any; // error +>x : any +>y : any +} + +var a2: { +>a2 : { (x: T): number; (x: T): string; } + + (x: T): number; +>T : T +>x : T +>T : T + + (x: T): string; // error +>T : T +>x : T +>T : T +} diff --git a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType3.types b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType3.types new file mode 100644 index 00000000000..3b1f2c5ca1a --- /dev/null +++ b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType3.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType3.ts === +// Normally it is an error to have multiple overloads with identical signatures in a single type declaration. +// Here the multiple overloads come from multiple merged declarations. + +interface I { +>I : I + + (x: string): string; +>x : string +} + +interface I { +>I : I + + (x: string): number; +>x : string +} + +interface I2 { +>I2 : I2 +>T : T + + (x: string): string; +>x : string +} + +interface I2 { +>I2 : I2 +>T : T + + (x: string): number; +>x : string +} diff --git a/tests/baselines/reference/callSignaturesWithOptionalParameters.types b/tests/baselines/reference/callSignaturesWithOptionalParameters.types new file mode 100644 index 00000000000..b38b5687ed4 --- /dev/null +++ b/tests/baselines/reference/callSignaturesWithOptionalParameters.types @@ -0,0 +1,196 @@ +=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters.ts === +// Optional parameters should be valid in all the below casts + +function foo(x?: number) { } +>foo : (x?: number) => void +>x : number + +var f = function foo(x?: number) { } +>f : (x?: number) => void +>function foo(x?: number) { } : (x?: number) => void +>foo : (x?: number) => void +>x : number + +var f2 = (x: number, y?: number) => { } +>f2 : (x: number, y?: number) => void +>(x: number, y?: number) => { } : (x: number, y?: number) => void +>x : number +>y : number + +foo(1); +>foo(1) : void +>foo : (x?: number) => void + +foo(); +>foo() : void +>foo : (x?: number) => void + +f(1); +>f(1) : void +>f : (x?: number) => void + +f(); +>f() : void +>f : (x?: number) => void + +f2(1); +>f2(1) : void +>f2 : (x: number, y?: number) => void + +f2(1, 2); +>f2(1, 2) : void +>f2 : (x: number, y?: number) => void + +class C { +>C : C + + foo(x?: number) { } +>foo : (x?: number) => void +>x : number +} + +var c: C; +>c : C +>C : C + +c.foo(); +>c.foo() : void +>c.foo : (x?: number) => void +>c : C +>foo : (x?: number) => void + +c.foo(1); +>c.foo(1) : void +>c.foo : (x?: number) => void +>c : C +>foo : (x?: number) => void + +interface I { +>I : I + + (x?: number); +>x : number + + foo(x: number, y?: number); +>foo : (x: number, y?: number) => any +>x : number +>y : number +} + +var i: I; +>i : I +>I : I + +i(); +>i() : any +>i : I + +i(1); +>i(1) : any +>i : I + +i.foo(1); +>i.foo(1) : any +>i.foo : (x: number, y?: number) => any +>i : I +>foo : (x: number, y?: number) => any + +i.foo(1, 2); +>i.foo(1, 2) : any +>i.foo : (x: number, y?: number) => any +>i : I +>foo : (x: number, y?: number) => any + +var a: { +>a : { (x?: number): any; foo(x?: number): any; } + + (x?: number); +>x : number + + foo(x?: number); +>foo : (x?: number) => any +>x : number +} + +a(); +>a() : any +>a : { (x?: number): any; foo(x?: number): any; } + +a(1); +>a(1) : any +>a : { (x?: number): any; foo(x?: number): any; } + +a.foo(); +>a.foo() : any +>a.foo : (x?: number) => any +>a : { (x?: number): any; foo(x?: number): any; } +>foo : (x?: number) => any + +a.foo(1); +>a.foo(1) : any +>a.foo : (x?: number) => any +>a : { (x?: number): any; foo(x?: number): any; } +>foo : (x?: number) => any + +var b = { +>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; } +>{ + foo(x?: number) { }, + a: function foo(x: number, y?: number) { }, + b: (x?: number) => { } +} : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; } + + foo(x?: number) { }, +>foo : (x?: number) => void +>foo(x?: number) { } : (x?: number) => void +>x : number + + a: function foo(x: number, y?: number) { }, +>a : (x: number, y?: number) => void +>function foo(x: number, y?: number) { } : (x: number, y?: number) => void +>foo : (x: number, y?: number) => void +>x : number +>y : number + + b: (x?: number) => { } +>b : (x?: number) => void +>(x?: number) => { } : (x?: number) => void +>x : number +} + +b.foo(); +>b.foo() : void +>b.foo : (x?: number) => void +>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; } +>foo : (x?: number) => void + +b.foo(1); +>b.foo(1) : void +>b.foo : (x?: number) => void +>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; } +>foo : (x?: number) => void + +b.a(1); +>b.a(1) : void +>b.a : (x: number, y?: number) => void +>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; } +>a : (x: number, y?: number) => void + +b.a(1, 2); +>b.a(1, 2) : void +>b.a : (x: number, y?: number) => void +>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; } +>a : (x: number, y?: number) => void + +b.b(); +>b.b() : void +>b.b : (x?: number) => void +>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; } +>b : (x?: number) => void + +b.b(1); +>b.b(1) : void +>b.b : (x?: number) => void +>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; } +>b : (x?: number) => void + diff --git a/tests/baselines/reference/callSignaturesWithOptionalParameters2.types b/tests/baselines/reference/callSignaturesWithOptionalParameters2.types new file mode 100644 index 00000000000..602edd911fe --- /dev/null +++ b/tests/baselines/reference/callSignaturesWithOptionalParameters2.types @@ -0,0 +1,203 @@ +=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters2.ts === +// Optional parameters should be valid in all the below casts + +function foo(x?: number); +>foo : (x?: number) => any +>x : number + +function foo(x?: number) { } +>foo : (x?: number) => any +>x : number + +foo(1); +>foo(1) : any +>foo : (x?: number) => any + +foo(); +>foo() : any +>foo : (x?: number) => any + +function foo2(x: number); +>foo2 : { (x: number): any; (x: number, y?: number): any; } +>x : number + +function foo2(x: number, y?: number); +>foo2 : { (x: number): any; (x: number, y?: number): any; } +>x : number +>y : number + +function foo2(x: number, y?: number) { } +>foo2 : { (x: number): any; (x: number, y?: number): any; } +>x : number +>y : number + +foo2(1); +>foo2(1) : any +>foo2 : { (x: number): any; (x: number, y?: number): any; } + +foo2(1, 2); +>foo2(1, 2) : any +>foo2 : { (x: number): any; (x: number, y?: number): any; } + +class C { +>C : C + + foo(x?: number); +>foo : (x?: number) => any +>x : number + + foo(x?: number) { } +>foo : (x?: number) => any +>x : number + + foo2(x: number); +>foo2 : { (x: number): any; (x: number, y?: number): any; } +>x : number + + foo2(x: number, y?: number); +>foo2 : { (x: number): any; (x: number, y?: number): any; } +>x : number +>y : number + + foo2(x: number, y?: number) { } +>foo2 : { (x: number): any; (x: number, y?: number): any; } +>x : number +>y : number +} + +var c: C; +>c : C +>C : C + +c.foo(); +>c.foo() : any +>c.foo : (x?: number) => any +>c : C +>foo : (x?: number) => any + +c.foo(1); +>c.foo(1) : any +>c.foo : (x?: number) => any +>c : C +>foo : (x?: number) => any + +c.foo2(1); +>c.foo2(1) : any +>c.foo2 : { (x: number): any; (x: number, y?: number): any; } +>c : C +>foo2 : { (x: number): any; (x: number, y?: number): any; } + +c.foo2(1, 2); +>c.foo2(1, 2) : any +>c.foo2 : { (x: number): any; (x: number, y?: number): any; } +>c : C +>foo2 : { (x: number): any; (x: number, y?: number): any; } + +interface I { +>I : I + + (x?: number); +>x : number + + (x?: number, y?: number); +>x : number +>y : number + + foo(x: number, y?: number); +>foo : { (x: number, y?: number): any; (x: number, y?: number, z?: number): any; } +>x : number +>y : number + + foo(x: number, y?: number, z?: number); +>foo : { (x: number, y?: number): any; (x: number, y?: number, z?: number): any; } +>x : number +>y : number +>z : number +} + +var i: I; +>i : I +>I : I + +i(); +>i() : any +>i : I + +i(1); +>i(1) : any +>i : I + +i(1, 2); +>i(1, 2) : any +>i : I + +i.foo(1); +>i.foo(1) : any +>i.foo : { (x: number, y?: number): any; (x: number, y?: number, z?: number): any; } +>i : I +>foo : { (x: number, y?: number): any; (x: number, y?: number, z?: number): any; } + +i.foo(1, 2); +>i.foo(1, 2) : any +>i.foo : { (x: number, y?: number): any; (x: number, y?: number, z?: number): any; } +>i : I +>foo : { (x: number, y?: number): any; (x: number, y?: number, z?: number): any; } + +i.foo(1, 2, 3); +>i.foo(1, 2, 3) : any +>i.foo : { (x: number, y?: number): any; (x: number, y?: number, z?: number): any; } +>i : I +>foo : { (x: number, y?: number): any; (x: number, y?: number, z?: number): any; } + +var a: { +>a : { (x?: number): any; (x?: number, y?: number): any; foo(x: number, y?: number): any; foo(x: number, y?: number, z?: number): any; } + + (x?: number); +>x : number + + (x?: number, y?: number); +>x : number +>y : number + + foo(x: number, y?: number); +>foo : { (x: number, y?: number): any; (x: number, y?: number, z?: number): any; } +>x : number +>y : number + + foo(x: number, y?: number, z?: number); +>foo : { (x: number, y?: number): any; (x: number, y?: number, z?: number): any; } +>x : number +>y : number +>z : number +} + +a(); +>a() : any +>a : { (x?: number): any; (x?: number, y?: number): any; foo(x: number, y?: number): any; foo(x: number, y?: number, z?: number): any; } + +a(1); +>a(1) : any +>a : { (x?: number): any; (x?: number, y?: number): any; foo(x: number, y?: number): any; foo(x: number, y?: number, z?: number): any; } + +a(1, 2); +>a(1, 2) : any +>a : { (x?: number): any; (x?: number, y?: number): any; foo(x: number, y?: number): any; foo(x: number, y?: number, z?: number): any; } + +a.foo(1); +>a.foo(1) : any +>a.foo : { (x: number, y?: number): any; (x: number, y?: number, z?: number): any; } +>a : { (x?: number): any; (x?: number, y?: number): any; foo(x: number, y?: number): any; foo(x: number, y?: number, z?: number): any; } +>foo : { (x: number, y?: number): any; (x: number, y?: number, z?: number): any; } + +a.foo(1, 2); +>a.foo(1, 2) : any +>a.foo : { (x: number, y?: number): any; (x: number, y?: number, z?: number): any; } +>a : { (x?: number): any; (x?: number, y?: number): any; foo(x: number, y?: number): any; foo(x: number, y?: number, z?: number): any; } +>foo : { (x: number, y?: number): any; (x: number, y?: number, z?: number): any; } + +a.foo(1, 2, 3); +>a.foo(1, 2, 3) : any +>a.foo : { (x: number, y?: number): any; (x: number, y?: number, z?: number): any; } +>a : { (x?: number): any; (x?: number, y?: number): any; foo(x: number, y?: number): any; foo(x: number, y?: number, z?: number): any; } +>foo : { (x: number, y?: number): any; (x: number, y?: number, z?: number): any; } + diff --git a/tests/baselines/reference/callbacksDontShareTypes.types b/tests/baselines/reference/callbacksDontShareTypes.types new file mode 100644 index 00000000000..b0ced875b67 --- /dev/null +++ b/tests/baselines/reference/callbacksDontShareTypes.types @@ -0,0 +1,110 @@ +=== tests/cases/compiler/callbacksDontShareTypes.ts === +interface Collection { +>Collection : Collection +>T : T + + length: number; +>length : number + + add(x: T): void; +>add : (x: T) => void +>x : T +>T : T + + remove(x: T): boolean; +>remove : (x: T) => boolean +>x : T +>T : T +} +interface Combinators { +>Combinators : Combinators + + map(c: Collection, f: (x: T) => U): Collection; +>map : { (c: Collection, f: (x: T) => U): Collection; (c: Collection, f: (x: T) => any): Collection; } +>T : T +>U : U +>c : Collection +>Collection : Collection +>T : T +>f : (x: T) => U +>x : T +>T : T +>U : U +>Collection : Collection +>U : U + + map(c: Collection, f: (x: T) => any): Collection; +>map : { (c: Collection, f: (x: T) => U): Collection; (c: Collection, f: (x: T) => any): Collection; } +>T : T +>c : Collection +>Collection : Collection +>T : T +>f : (x: T) => any +>x : T +>T : T +>Collection : Collection +} + +var _: Combinators; +>_ : Combinators +>Combinators : Combinators + +var c2: Collection; +>c2 : Collection +>Collection : Collection + +var rf1 = (x: number) => { return x.toFixed() }; +>rf1 : (x: number) => string +>(x: number) => { return x.toFixed() } : (x: number) => string +>x : number +>x.toFixed() : string +>x.toFixed : (fractionDigits?: number) => string +>x : number +>toFixed : (fractionDigits?: number) => string + +var r1a = _.map(c2, (x) => { return x.toFixed() }); +>r1a : Collection +>_.map(c2, (x) => { return x.toFixed() }) : Collection +>_.map : { (c: Collection, f: (x: T) => U): Collection; (c: Collection, f: (x: T) => any): Collection; } +>_ : Combinators +>map : { (c: Collection, f: (x: T) => U): Collection; (c: Collection, f: (x: T) => any): Collection; } +>c2 : Collection +>(x) => { return x.toFixed() } : (x: number) => string +>x : number +>x.toFixed() : string +>x.toFixed : (fractionDigits?: number) => string +>x : number +>toFixed : (fractionDigits?: number) => string + +var r1b = _.map(c2, rf1); // this line should not cause the following 2 to have errors +>r1b : Collection +>_.map(c2, rf1) : Collection +>_.map : { (c: Collection, f: (x: T) => U): Collection; (c: Collection, f: (x: T) => any): Collection; } +>_ : Combinators +>map : { (c: Collection, f: (x: T) => U): Collection; (c: Collection, f: (x: T) => any): Collection; } +>c2 : Collection +>rf1 : (x: number) => string + +var r5a = _.map(c2, (x) => { return x.toFixed() }); +>r5a : Collection +>_.map(c2, (x) => { return x.toFixed() }) : Collection +>_.map : { (c: Collection, f: (x: T) => U): Collection; (c: Collection, f: (x: T) => any): Collection; } +>_ : Combinators +>map : { (c: Collection, f: (x: T) => U): Collection; (c: Collection, f: (x: T) => any): Collection; } +>c2 : Collection +>(x) => { return x.toFixed() } : (x: number) => string +>x : number +>x.toFixed() : string +>x.toFixed : (fractionDigits?: number) => string +>x : number +>toFixed : (fractionDigits?: number) => string + +var r5b = _.map(c2, rf1); +>r5b : Collection +>_.map(c2, rf1) : Collection +>_.map : { (c: Collection, f: (x: T) => U): Collection; (c: Collection, f: (x: T) => any): Collection; } +>_ : Combinators +>map : { (c: Collection, f: (x: T) => U): Collection; (c: Collection, f: (x: T) => any): Collection; } +>c2 : Collection +>rf1 : (x: number) => string + diff --git a/tests/baselines/reference/captureThisInSuperCall.types b/tests/baselines/reference/captureThisInSuperCall.types new file mode 100644 index 00000000000..dc11b56ada2 --- /dev/null +++ b/tests/baselines/reference/captureThisInSuperCall.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/captureThisInSuperCall.ts === +class A { +>A : A + + constructor(p:any) {} +>p : any +} + +class B extends A { +>B : B +>A : A + + constructor() { super({ test: () => this.someMethod()}); } +>super({ test: () => this.someMethod()}) : void +>{ test: () => this.someMethod()} : { test: () => void; } +>test : () => void +>() => this.someMethod() : () => void +>this.someMethod() : void +>this.someMethod : () => void +>this : B +>someMethod : () => void + + someMethod() {} +>someMethod : () => void +} diff --git a/tests/baselines/reference/castExpressionParentheses.types b/tests/baselines/reference/castExpressionParentheses.types new file mode 100644 index 00000000000..590c23b048f --- /dev/null +++ b/tests/baselines/reference/castExpressionParentheses.types @@ -0,0 +1,170 @@ +=== tests/cases/compiler/castExpressionParentheses.ts === +declare var a; +>a : any + +// parentheses should be omitted +// literals +({a:0}); +>({a:0}) : any +>{a:0} : any +>{a:0} : { a: number; } +>a : number + +([1,3,]); +>([1,3,]) : any +>[1,3,] : any +>[1,3,] : number[] + +("string"); +>("string") : any +>"string" : any + +(23.0); +>(23.0) : any +>23.0 : any + +(/regexp/g); +>(/regexp/g) : any +>/regexp/g : any +>/regexp/g : RegExp + +(false); +>(false) : any +>false : any + +(true); +>(true) : any +>true : any + +(null); +>(null) : any +>null : any + +// names and dotted names +(this); +>(this) : any +>this : any +>this : any + +(this.x); +>(this.x) : any +>this.x : any +>this.x : any +>this : any +>x : any + +((a).x); +>((a).x) : any +>(a).x : any +>(a).x : any +>(a) : any +>a : any +>a : any +>x : any + +(a); +>(a) : any +>a : any +>a : any +>a : any + +(a[0]); +>(a[0]) : any +>a[0] : any +>a[0] : any +>a : any + +(a.b["0"]); +>(a.b["0"]) : any +>a.b["0"] : any +>a.b["0"] : any +>a.b : any +>a : any +>b : any + +(a()).x; +>(a()).x : any +>(a()) : any +>a() : any +>a() : any +>a : any +>x : any + +declare var A; +>A : any + +// should keep the parentheses in emit +(new A).foo; +>(new A).foo : any +>(new A) : any +>new A : any +>new A : any +>A : any +>foo : any + +(typeof A).x; +>(typeof A).x : any +>(typeof A) : any +>typeof A : any +>typeof A : string +>A : any +>x : any + +(-A).x; +>(-A).x : any +>(-A) : any +>-A : any +>-A : number +>A : any +>x : any + +new (A()); +>new (A()) : any +>(A()) : any +>A() : any +>A() : any +>A : any + +(()=> {})(); +>(()=> {})() : void +>(()=> {}) : () => void +>()=> {} : () => void +>Tany : Tany + +(function foo() { })(); +>(function foo() { })() : any +>(function foo() { }) : any +>function foo() { } : any +>function foo() { } : () => void +>foo : () => void + +(-A).x; +>(-A).x : any +>(-A) : any +>-A : any +>-A : number +>-A : any +>-A : number +>A : any +>x : any + +// nested cast, should keep one pair of parenthese +((-A)).x; +>((-A)).x : any +>((-A)) : any +>(-A) : any +>(-A) : number +>(-A) : any +>-A : any +>-A : number +>A : any +>x : any + +// nested parenthesized expression, should keep one pair of parenthese +((A)) +>((A)) : any +>(A) : any +>(A) : any +>A : any + + diff --git a/tests/baselines/reference/castNewObjectBug.types b/tests/baselines/reference/castNewObjectBug.types new file mode 100644 index 00000000000..c3a6cffb84f --- /dev/null +++ b/tests/baselines/reference/castNewObjectBug.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/castNewObjectBug.ts === +interface Foo { } +>Foo : Foo + +var xx = new Object(); +>xx : Foo +> new Object() : Foo +>Foo : Foo +>new Object() : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } + diff --git a/tests/baselines/reference/castParentheses.types b/tests/baselines/reference/castParentheses.types new file mode 100644 index 00000000000..f65a1d8f748 --- /dev/null +++ b/tests/baselines/reference/castParentheses.types @@ -0,0 +1,68 @@ +=== tests/cases/compiler/castParentheses.ts === +class a { +>a : a + + static b: any; +>b : any +} + +var b = (a); +>b : any +>(a) : any +>a : any +>a : typeof a + +var b = (a).b; +>b : any +>(a).b : any +>(a) : any +>a : any +>a : typeof a +>b : any + +var b = (a.b).c; +>b : any +>(a.b).c : any +>(a.b) : any +>a.b : any +>a.b : any +>a : typeof a +>b : any +>c : any + +var b = (a.b()).c; +>b : any +>(a.b()).c : any +>(a.b()) : any +>a.b() : any +>a.b() : any +>a.b : any +>a : typeof a +>b : any +>c : any + +var b = (new a); +>b : any +>(new a) : any +>new a : any +>new a : a +>a : typeof a + +var b = (new a.b); +>b : any +>(new a.b) : any +>new a.b : any +>new a.b : any +>a.b : any +>a : typeof a +>b : any + +var b = (new a).b +>b : any +>(new a).b : any +>(new a) : any +>new a : any +>new a : a +>a : typeof a +>b : any + diff --git a/tests/baselines/reference/castTest.types b/tests/baselines/reference/castTest.types new file mode 100644 index 00000000000..42a721d8fff --- /dev/null +++ b/tests/baselines/reference/castTest.types @@ -0,0 +1,129 @@ +=== tests/cases/compiler/castTest.ts === + +var x : any = 0; +>x : any + +var z = x; +>z : number +> x : number +>x : any + +var y = x + z; +>y : any +>x + z : any +>x : any +>z : number + +var a = 0; +>a : any +>0 : any + +var b = true; +>b : boolean +>true : boolean + +var s = ""; +>s : string +>"" : string + +var ar = null; +>ar : any[] +>null : any[] + +var f = <(res : number) => void>null; +>f : (res: number) => void +><(res : number) => void>null : (res: number) => void +>res : number + +declare class Point +>Point : Point +{ + x: number; +>x : number + + y: number; +>y : number + + add(dx: number, dy: number): Point; +>add : (dx: number, dy: number) => Point +>dx : number +>dy : number +>Point : Point + + mult(p: Point): Point; +>mult : (p: Point) => Point +>p : Point +>Point : Point +>Point : Point + + constructor(x: number, y: number); +>x : number +>y : number +} + +var p_cast = ({ +>p_cast : Point +> ({ + x: 0, + y: 0, + add: function(dx, dy) { + return new Point(this.x + dx, this.y + dy); + }, + mult: function(p) { return p; } +}) : Point +>Point : Point +>({ + x: 0, + y: 0, + add: function(dx, dy) { + return new Point(this.x + dx, this.y + dy); + }, + mult: function(p) { return p; } +}) : { x: number; y: number; add: (dx: any, dy: any) => Point; mult: (p: any) => any; } +>{ + x: 0, + y: 0, + add: function(dx, dy) { + return new Point(this.x + dx, this.y + dy); + }, + mult: function(p) { return p; } +} : { x: number; y: number; add: (dx: any, dy: any) => Point; mult: (p: any) => any; } + + x: 0, +>x : number + + y: 0, +>y : number + + add: function(dx, dy) { +>add : (dx: any, dy: any) => Point +>function(dx, dy) { + return new Point(this.x + dx, this.y + dy); + } : (dx: any, dy: any) => Point +>dx : any +>dy : any + + return new Point(this.x + dx, this.y + dy); +>new Point(this.x + dx, this.y + dy) : Point +>Point : typeof Point +>this.x + dx : any +>this.x : any +>this : any +>x : any +>dx : any +>this.y + dy : any +>this.y : any +>this : any +>y : any +>dy : any + + }, + mult: function(p) { return p; } +>mult : (p: any) => any +>function(p) { return p; } : (p: any) => any +>p : any +>p : any + +}) + + diff --git a/tests/baselines/reference/catch.types b/tests/baselines/reference/catch.types new file mode 100644 index 00000000000..bb0b2adbefe --- /dev/null +++ b/tests/baselines/reference/catch.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/catch.ts === +function f() { +>f : () => void + + try {} catch(e) { } +>e : any + + try {} catch(e) { } +>e : any +} + diff --git a/tests/baselines/reference/cf.types b/tests/baselines/reference/cf.types new file mode 100644 index 00000000000..62dcba0ba9a --- /dev/null +++ b/tests/baselines/reference/cf.types @@ -0,0 +1,138 @@ +=== tests/cases/compiler/cf.ts === +function f() { +>f : () => void + + var z; +>z : any + + var x=10; +>x : number + + var y=3; +>y : number + + L1: for (var i=0;i<19;i++) { +>i : number +>i<19 : boolean +>i : number +>i++ : number +>i : number + + if (y==7) { +>y==7 : boolean +>y : number + + continue L1; + x=11; +>x=11 : number +>x : number + } + if (y==3) { +>y==3 : boolean +>y : number + + y++; +>y++ : number +>y : number + } + else { + y--; +>y-- : number +>y : number + } + do { + y+=2; +>y+=2 : number +>y : number + + if (y==20) { +>y==20 : boolean +>y : number + + break; + x=12; +>x=12 : number +>x : number + } + } while (y<41); +>y<41 : boolean +>y : number + + y++; +>y++ : number +>y : number + } + while (y>2) { +>y>2 : boolean +>y : number + + y=y>>1; +>y=y>>1 : number +>y : number +>y>>1 : number +>y : number + } + L2: try { + L3: if (xxx : number +>y : number + + break L2; + x=13; +>x=13 : number +>x : number + } + else { + break L3; + x=14; +>x=14 : number +>x : number + } + } + catch (e) { +>e : any + + x++; +>x++ : number +>x : number + } + finally { + x+=3; +>x+=3 : number +>x : number + } + y++; +>y++ : number +>y : number + + for (var k=0;k<10;k++) { +>k : number +>k<10 : boolean +>k : number +>k++ : number +>k : number + + z; +>z : any + + break; + } + for (k=0;k<10;k++) { +>k=0 : number +>k : number +>k<10 : boolean +>k : number +>k++ : number +>k : number + + if (k==6) { +>k==6 : boolean +>k : number + + continue; + } + break; + } +} + diff --git a/tests/baselines/reference/chainedAssignment2.types b/tests/baselines/reference/chainedAssignment2.types new file mode 100644 index 00000000000..3ddd7412b9c --- /dev/null +++ b/tests/baselines/reference/chainedAssignment2.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/chainedAssignment2.ts === +var a: string; +>a : string + +var b: number; +>b : number + +var c: boolean; +>c : boolean + +var d: Date; +>d : Date +>Date : Date + +var e: RegExp; +>e : RegExp +>RegExp : RegExp + +a = b = c = d = e = null; +>a = b = c = d = e = null : null +>a : string +>b = c = d = e = null : null +>b : number +>c = d = e = null : null +>c : boolean +>d = e = null : null +>d : Date +>e = null : null +>e : RegExp + + diff --git a/tests/baselines/reference/chainedImportAlias.types b/tests/baselines/reference/chainedImportAlias.types new file mode 100644 index 00000000000..4a94cf6867e --- /dev/null +++ b/tests/baselines/reference/chainedImportAlias.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/chainedImportAlias_file1.ts === +import x = require('chainedImportAlias_file0'); +>x : typeof "tests/cases/compiler/chainedImportAlias_file0" + +import y = x; +>y : typeof "tests/cases/compiler/chainedImportAlias_file0" +>x : typeof "tests/cases/compiler/chainedImportAlias_file0" + +y.m.foo(); +>y.m.foo() : void +>y.m.foo : () => void +>y.m : typeof m +>y : typeof "tests/cases/compiler/chainedImportAlias_file0" +>m : typeof m +>foo : () => void + +=== tests/cases/compiler/chainedImportAlias_file0.ts === +export module m { +>m : typeof m + + export function foo() { } +>foo : () => void +} + diff --git a/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.types b/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.types new file mode 100644 index 00000000000..08fd92fbdc7 --- /dev/null +++ b/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.types @@ -0,0 +1,71 @@ +=== tests/cases/compiler/chainedSpecializationToObjectTypeLiteral.ts === +interface Sequence { +>Sequence : Sequence +>T : T + + each(iterator: (value: T) => void): void; +>each : (iterator: (value: T) => void) => void +>iterator : (value: T) => void +>value : T +>T : T + + map(iterator: (value: T) => U): Sequence; +>map : (iterator: (value: T) => U) => Sequence +>U : U +>iterator : (value: T) => U +>value : T +>T : T +>U : U +>Sequence : Sequence +>U : U + + filter(iterator: (value: T) => boolean): Sequence; +>filter : (iterator: (value: T) => boolean) => Sequence +>iterator : (value: T) => boolean +>value : T +>T : T +>Sequence : Sequence +>T : T + + groupBy(keySelector: (value: T) => K): Sequence<{ key: K; items: T[]; }>; +>groupBy : (keySelector: (value: T) => K) => Sequence<{ key: K; items: T[]; }> +>K : K +>keySelector : (value: T) => K +>value : T +>T : T +>K : K +>Sequence : Sequence +>key : K +>K : K +>items : T[] +>T : T +} + +var s: Sequence; +>s : Sequence +>Sequence : Sequence + +var s2 = s.groupBy(s => s.length); +>s2 : Sequence<{ key: number; items: string[]; }> +>s.groupBy(s => s.length) : Sequence<{ key: number; items: string[]; }> +>s.groupBy : (keySelector: (value: string) => K) => Sequence<{ key: K; items: string[]; }> +>s : Sequence +>groupBy : (keySelector: (value: string) => K) => Sequence<{ key: K; items: string[]; }> +>s => s.length : (s: string) => number +>s : string +>s.length : number +>s : string +>length : number + +var s3 = s2.each(x => { x.key /* Type is K, should be number */ }); +>s3 : void +>s2.each(x => { x.key /* Type is K, should be number */ }) : void +>s2.each : (iterator: (value: { key: number; items: string[]; }) => void) => void +>s2 : Sequence<{ key: number; items: string[]; }> +>each : (iterator: (value: { key: number; items: string[]; }) => void) => void +>x => { x.key /* Type is K, should be number */ } : (x: { key: number; items: string[]; }) => void +>x : { key: number; items: string[]; } +>x.key : number +>x : { key: number; items: string[]; } +>key : number + diff --git a/tests/baselines/reference/checkInterfaceBases.types b/tests/baselines/reference/checkInterfaceBases.types new file mode 100644 index 00000000000..3e9107bbd6e --- /dev/null +++ b/tests/baselines/reference/checkInterfaceBases.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/app.ts === +/// +interface SecondEvent { +>SecondEvent : SecondEvent + + data: any; +>data : any +} +interface Third extends JQueryEventObjectTest, SecondEvent {} +>Third : Third +>JQueryEventObjectTest : JQueryEventObjectTest +>SecondEvent : SecondEvent + +=== tests/cases/compiler/jquery.d.ts === +interface JQueryEventObjectTest { +>JQueryEventObjectTest : JQueryEventObjectTest + + data: any; +>data : any + + which: number; +>which : number + + metaKey: any; +>metaKey : any +} + diff --git a/tests/baselines/reference/circularImportAlias.types b/tests/baselines/reference/circularImportAlias.types new file mode 100644 index 00000000000..a8d952ae993 --- /dev/null +++ b/tests/baselines/reference/circularImportAlias.types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/internalModules/importDeclarations/circularImportAlias.ts === +// expected no error + +module B { +>B : typeof B + + export import a = A; +>a : typeof A +>A : typeof A + + export class D extends a.C { +>D : D +>a : a +>C : C + + id: number; +>id : number + } +} + +module A { +>A : typeof A + + export class C { name: string } +>C : C +>name : string + + export import b = B; +>b : typeof B +>B : typeof B +} + +var c: { name: string }; +>c : { name: string; } +>name : string + +var c = new B.a.C(); +>c : { name: string; } +>new B.a.C() : C +>B.a.C : typeof C +>B.a : typeof A +>B : typeof B +>a : typeof A +>C : typeof C + + + diff --git a/tests/baselines/reference/classAppearsToHaveMembersOfObject.types b/tests/baselines/reference/classAppearsToHaveMembersOfObject.types new file mode 100644 index 00000000000..fe4079bbfcf --- /dev/null +++ b/tests/baselines/reference/classAppearsToHaveMembersOfObject.types @@ -0,0 +1,32 @@ +=== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classAppearsToHaveMembersOfObject.ts === +class C { foo: string; } +>C : C +>foo : string + +var c: C; +>c : C +>C : C + +var r = c.toString(); +>r : string +>c.toString() : string +>c.toString : () => string +>c : C +>toString : () => string + +var r2 = c.hasOwnProperty(''); +>r2 : boolean +>c.hasOwnProperty('') : boolean +>c.hasOwnProperty : (v: string) => boolean +>c : C +>hasOwnProperty : (v: string) => boolean + +var o: Object = c; +>o : Object +>Object : Object +>c : C + +var o2: {} = c; +>o2 : {} +>c : C + diff --git a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.types b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.types new file mode 100644 index 00000000000..c58b1dd898d --- /dev/null +++ b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/classDeclarationMergedInModuleWithContinuation.ts === +module M { +>M : typeof M + + export class N { } +>N : N + + export module N { +>N : typeof N + + export var v = 0; +>v : number + } +} + +module M { +>M : typeof M + + export class O extends M.N { +>O : O +>M : M +>N : N + } +} diff --git a/tests/baselines/reference/classExtendingClass.types b/tests/baselines/reference/classExtendingClass.types new file mode 100644 index 00000000000..837adaf50fd --- /dev/null +++ b/tests/baselines/reference/classExtendingClass.types @@ -0,0 +1,112 @@ +=== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingClass.ts === +class C { +>C : C + + foo: string; +>foo : string + + thing() { } +>thing : () => void + + static other() { } +>other : () => void +} + +class D extends C { +>D : D +>C : C + + bar: string; +>bar : string +} + +var d: D; +>d : D +>D : D + +var r = d.foo; +>r : string +>d.foo : string +>d : D +>foo : string + +var r2 = d.bar; +>r2 : string +>d.bar : string +>d : D +>bar : string + +var r3 = d.thing(); +>r3 : void +>d.thing() : void +>d.thing : () => void +>d : D +>thing : () => void + +var r4 = D.other(); +>r4 : void +>D.other() : void +>D.other : () => void +>D : typeof D +>other : () => void + +class C2 { +>C2 : C2 +>T : T + + foo: T; +>foo : T +>T : T + + thing(x: T) { } +>thing : (x: T) => void +>x : T +>T : T + + static other(x: T) { } +>other : (x: T) => void +>T : T +>x : T +>T : T +} + +class D2 extends C2 { +>D2 : D2 +>T : T +>C2 : C2 +>T : T + + bar: string; +>bar : string +} + +var d2: D2; +>d2 : D2 +>D2 : D2 + +var r5 = d2.foo; +>r5 : string +>d2.foo : string +>d2 : D2 +>foo : string + +var r6 = d2.bar; +>r6 : string +>d2.bar : string +>d2 : D2 +>bar : string + +var r7 = d2.thing(''); +>r7 : void +>d2.thing('') : void +>d2.thing : (x: string) => void +>d2 : D2 +>thing : (x: string) => void + +var r8 = D2.other(1); +>r8 : void +>D2.other(1) : void +>D2.other : (x: T) => void +>D2 : typeof D2 +>other : (x: T) => void + diff --git a/tests/baselines/reference/classExtendingQualifiedName2.types b/tests/baselines/reference/classExtendingQualifiedName2.types new file mode 100644 index 00000000000..e2e1b7dfdd8 --- /dev/null +++ b/tests/baselines/reference/classExtendingQualifiedName2.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/classExtendingQualifiedName2.ts === +module M { +>M : typeof M + + export class C { +>C : C + } + + class D extends M.C { +>D : D +>M : M +>C : C + } +} diff --git a/tests/baselines/reference/classImplementingInterfaceIndexer.types b/tests/baselines/reference/classImplementingInterfaceIndexer.types new file mode 100644 index 00000000000..58e2eb29091 --- /dev/null +++ b/tests/baselines/reference/classImplementingInterfaceIndexer.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/classImplementingInterfaceIndexer.ts === +interface I { +>I : I + + [index: string]: { prop } +>index : string +>prop : any +} +class A implements I { +>A : A +>I : I + + [index: string]: { prop } +>index : string +>prop : any +} diff --git a/tests/baselines/reference/classImplementsClass1.types b/tests/baselines/reference/classImplementsClass1.types new file mode 100644 index 00000000000..c9485a6b904 --- /dev/null +++ b/tests/baselines/reference/classImplementsClass1.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/classImplementsClass1.ts === +class A { } +>A : A + +class C implements A { } +>C : C +>A : A + diff --git a/tests/baselines/reference/classImplementsClass3.types b/tests/baselines/reference/classImplementsClass3.types new file mode 100644 index 00000000000..182ac535966 --- /dev/null +++ b/tests/baselines/reference/classImplementsClass3.types @@ -0,0 +1,39 @@ +=== tests/cases/compiler/classImplementsClass3.ts === +class A { foo(): number { return 1; } } +>A : A +>foo : () => number + +class C implements A { +>C : C +>A : A + + foo() { +>foo : () => number + + return 1; + } +} + +class C2 extends A {} +>C2 : C2 +>A : A + +// no errors +var c: C; +>c : C +>C : C + +var c2: C2; +>c2 : C2 +>C2 : C2 + +c = c2; +>c = c2 : C2 +>c : C +>c2 : C2 + +c2 = c; +>c2 = c : C +>c2 : C2 +>c : C + diff --git a/tests/baselines/reference/classImplementsImportedInterface.types b/tests/baselines/reference/classImplementsImportedInterface.types new file mode 100644 index 00000000000..90944455ee1 --- /dev/null +++ b/tests/baselines/reference/classImplementsImportedInterface.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/classImplementsImportedInterface.ts === +module M1 { +>M1 : M1 + + export interface I { +>I : I + + foo(); +>foo : () => any + } +} + +module M2 { +>M2 : typeof M2 + + import T = M1.I; +>T : T +>M1 : I +>I : I + + class C implements T { +>C : C +>T : T + + foo() {} +>foo : () => void + } +} diff --git a/tests/baselines/reference/classIndexer.types b/tests/baselines/reference/classIndexer.types new file mode 100644 index 00000000000..01eda961112 --- /dev/null +++ b/tests/baselines/reference/classIndexer.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/classIndexer.ts === +class C123 { +>C123 : C123 + + [s: string]: number; +>s : string + + constructor() { + } +} diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping5.types b/tests/baselines/reference/classMemberInitializerWithLamdaScoping5.types new file mode 100644 index 00000000000..689ff5bdf41 --- /dev/null +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping5.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/classMemberInitializerWithLamdaScoping5.ts === +declare var console: { +>console : { log(message?: any, ...optionalParams: any[]): void; } + + log(message?: any, ...optionalParams: any[]): void; +>log : (message?: any, ...optionalParams: any[]) => void +>message : any +>optionalParams : any[] + +}; +class Greeter { +>Greeter : Greeter + + constructor(message: string) { +>message : string + } + + messageHandler = (message: string) => { +>messageHandler : (message: string) => void +>(message: string) => { + console.log(message); // This shouldnt be error + } : (message: string) => void +>message : string + + console.log(message); // This shouldnt be error +>console.log(message) : void +>console.log : (message?: any, ...optionalParams: any[]) => void +>console : { log(message?: any, ...optionalParams: any[]): void; } +>log : (message?: any, ...optionalParams: any[]) => void +>message : string + } +} diff --git a/tests/baselines/reference/classMethodWithKeywordName1.types b/tests/baselines/reference/classMethodWithKeywordName1.types new file mode 100644 index 00000000000..8ad128bdb00 --- /dev/null +++ b/tests/baselines/reference/classMethodWithKeywordName1.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/classMethodWithKeywordName1.ts === +class C { +>C : C + + static try() {} +>try : () => void +} diff --git a/tests/baselines/reference/classOrder1.types b/tests/baselines/reference/classOrder1.types new file mode 100644 index 00000000000..7019e53cbb7 --- /dev/null +++ b/tests/baselines/reference/classOrder1.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/classOrder1.ts === +class A { +>A : A + + public foo() { +>foo : () => void + + /*WScript.Echo("Here!");*/ + } +} + +var a = new A(); +>a : A +>new A() : A +>A : typeof A + +a.foo(); +>a.foo() : void +>a.foo : () => void +>a : A +>foo : () => void + + + diff --git a/tests/baselines/reference/classOrder2.types b/tests/baselines/reference/classOrder2.types new file mode 100644 index 00000000000..07bd6ba45a5 --- /dev/null +++ b/tests/baselines/reference/classOrder2.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/classOrder2.ts === + +class A extends B { +>A : A +>B : B + + foo() { this.bar(); } +>foo : () => void +>this.bar() : void +>this.bar : () => void +>this : A +>bar : () => void + +} + +class B { +>B : B + + bar() { } +>bar : () => void + +} + + +var a = new A(); +>a : A +>new A() : A +>A : typeof A + +a.foo(); +>a.foo() : void +>a.foo : () => void +>a : A +>foo : () => void + + diff --git a/tests/baselines/reference/classOrderBug.types b/tests/baselines/reference/classOrderBug.types new file mode 100644 index 00000000000..979b65b8008 --- /dev/null +++ b/tests/baselines/reference/classOrderBug.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/classOrderBug.ts === +class bar { +>bar : bar + + public baz: foo; +>baz : foo +>foo : foo + + constructor() { + + this.baz = new foo(); +>this.baz = new foo() : foo +>this.baz : foo +>this : bar +>baz : foo +>new foo() : foo +>foo : typeof foo + + } + +} + +class baz {} +>baz : baz + +class foo extends baz {} +>foo : foo +>baz : baz + + + diff --git a/tests/baselines/reference/classSideInheritance2.types b/tests/baselines/reference/classSideInheritance2.types new file mode 100644 index 00000000000..8f89cca44bd --- /dev/null +++ b/tests/baselines/reference/classSideInheritance2.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/classSideInheritance2.ts === +interface IText { +>IText : IText + + foo: number; +>foo : number +} + +interface TextSpan {} +>TextSpan : TextSpan + +class SubText extends TextBase { +>SubText : SubText +>TextBase : TextBase + + constructor(text: IText, span: TextSpan) { +>text : IText +>IText : IText +>span : TextSpan +>TextSpan : TextSpan + + super(); +>super() : void + } +} + +class TextBase implements IText { +>TextBase : TextBase +>IText : IText + + public foo: number; +>foo : number + + public subText(span: TextSpan): IText { +>subText : (span: TextSpan) => IText +>span : TextSpan +>TextSpan : TextSpan +>IText : IText + + return new SubText(this, span); +>new SubText(this, span) : SubText +>SubText : typeof SubText +>this : TextBase +>span : TextSpan + } +} diff --git a/tests/baselines/reference/classWithEmptyBody.types b/tests/baselines/reference/classWithEmptyBody.types new file mode 100644 index 00000000000..ccf3c8556e0 --- /dev/null +++ b/tests/baselines/reference/classWithEmptyBody.types @@ -0,0 +1,59 @@ +=== tests/cases/conformance/classes/classDeclarations/classBody/classWithEmptyBody.ts === +class C { +>C : C +} + +var c: C; +>c : C +>C : C + +var o: {} = c; +>o : {} +>c : C + +c = 1; +>c = 1 : number +>c : C + +c = { foo: '' } +>c = { foo: '' } : { foo: string; } +>c : C +>{ foo: '' } : { foo: string; } +>foo : string + +c = () => { } +>c = () => { } : () => void +>c : C +>() => { } : () => void + +class D { +>D : D + + constructor() { + return 1; + } +} + +var d: D; +>d : D +>D : D + +var o: {} = d; +>o : {} +>d : D + +d = 1; +>d = 1 : number +>d : D + +d = { foo: '' } +>d = { foo: '' } : { foo: string; } +>d : D +>{ foo: '' } : { foo: string; } +>foo : string + +d = () => { } +>d = () => { } : () => void +>d : D +>() => { } : () => void + diff --git a/tests/baselines/reference/classWithNoConstructorOrBaseClass.types b/tests/baselines/reference/classWithNoConstructorOrBaseClass.types new file mode 100644 index 00000000000..9df56f81bb1 --- /dev/null +++ b/tests/baselines/reference/classWithNoConstructorOrBaseClass.types @@ -0,0 +1,45 @@ +=== tests/cases/conformance/classes/members/constructorFunctionTypes/classWithNoConstructorOrBaseClass.ts === +class C { +>C : C + + x: string; +>x : string +} + +var c = new C(); +>c : C +>new C() : C +>C : typeof C + +var r = C; +>r : typeof C +>C : typeof C + +class D { +>D : D +>T : T +>U : U + + x: T; +>x : T +>T : T + + y: U; +>y : U +>U : U +} + +var d = new D(); +>d : D<{}, {}> +>new D() : D<{}, {}> +>D : typeof D + +var d2 = new D(); +>d2 : D +>new D() : D +>D : typeof D + +var r2 = D; +>r2 : typeof D +>D : typeof D + diff --git a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.types b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.types new file mode 100644 index 00000000000..9f6d031bf20 --- /dev/null +++ b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.types @@ -0,0 +1,73 @@ +=== tests/cases/conformance/types/namedTypes/classWithOnlyPublicMembersEquivalentToInterface.ts === +// no errors expected + +class C { +>C : C + + public x: string; +>x : string + + public y(a: number): number { return null; } +>y : (a: number) => number +>a : number + + public get z() { return 1; } +>z : number + + public set z(v) { } +>z : number +>v : number + + [x: string]: Object; +>x : string +>Object : Object + + [x: number]: Object; +>x : number +>Object : Object + + 0: number; +} + +interface I { +>I : I + + x: string; +>x : string + + y(b: number): number; +>y : (b: number) => number +>b : number + + z: number; +>z : number + + [x: string]: Object; +>x : string +>Object : Object + + [x: number]: Object; +>x : number +>Object : Object + + 0: number; +} + +var c: C; +>c : C +>C : C + +var i: I; +>i : I +>I : I + +c = i; +>c = i : I +>c : C +>i : I + +i = c; +>i = c : C +>i : I +>c : C + diff --git a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.types b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.types new file mode 100644 index 00000000000..be504f895fd --- /dev/null +++ b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.types @@ -0,0 +1,76 @@ +=== tests/cases/conformance/types/namedTypes/classWithOnlyPublicMembersEquivalentToInterface2.ts === +// no errors expected + +class C { +>C : C + + public x: string; +>x : string + + public y(a: number): number { return null; } +>y : (a: number) => number +>a : number + + public get z() { return 1; } +>z : number + + public set z(v) { } +>z : number +>v : number + + [x: string]: Object; +>x : string +>Object : Object + + [x: number]: Object; +>x : number +>Object : Object + + 0: number; + + public static foo: string; // doesn't effect equivalence +>foo : string +} + +interface I { +>I : I + + x: string; +>x : string + + y(b: number): number; +>y : (b: number) => number +>b : number + + z: number; +>z : number + + [x: string]: Object; +>x : string +>Object : Object + + [x: number]: Object; +>x : number +>Object : Object + + 0: number; +} + +var c: C; +>c : C +>C : C + +var i: I; +>i : I +>I : I + +c = i; +>c = i : I +>c : C +>i : I + +i = c; +>i = c : C +>i : I +>c : C + diff --git a/tests/baselines/reference/classWithPublicProperty.types b/tests/baselines/reference/classWithPublicProperty.types new file mode 100644 index 00000000000..a5bdeb95f1a --- /dev/null +++ b/tests/baselines/reference/classWithPublicProperty.types @@ -0,0 +1,89 @@ +=== tests/cases/conformance/types/members/classWithPublicProperty.ts === +class C { +>C : C + + public x; +>x : any + + public a = ''; +>a : string + + public b: string = ''; +>b : string + + public c() { return '' } +>c : () => string + + public d = () => ''; +>d : () => string +>() => '' : () => string + + public static e; +>e : any + + public static f() { return '' } +>f : () => string + + public static g = () => ''; +>g : () => string +>() => '' : () => string +} + +// all of these are valid +var c = new C(); +>c : C +>new C() : C +>C : typeof C + +var r1: string = c.x; +>r1 : string +>c.x : any +>c : C +>x : any + +var r2: string = c.a; +>r2 : string +>c.a : string +>c : C +>a : string + +var r3: string = c.b; +>r3 : string +>c.b : string +>c : C +>b : string + +var r4: string = c.c(); +>r4 : string +>c.c() : string +>c.c : () => string +>c : C +>c : () => string + +var r5: string = c.d(); +>r5 : string +>c.d() : string +>c.d : () => string +>c : C +>d : () => string + +var r6: string = C.e; +>r6 : string +>C.e : any +>C : typeof C +>e : any + +var r7: string = C.f(); +>r7 : string +>C.f() : string +>C.f : () => string +>C : typeof C +>f : () => string + +var r8: string = C.g(); +>r8 : string +>C.g() : string +>C.g : () => string +>C : typeof C +>g : () => string + diff --git a/tests/baselines/reference/cloduleAcrossModuleDefinitions.types b/tests/baselines/reference/cloduleAcrossModuleDefinitions.types new file mode 100644 index 00000000000..3bd384b6e95 --- /dev/null +++ b/tests/baselines/reference/cloduleAcrossModuleDefinitions.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/cloduleAcrossModuleDefinitions.ts === +module A { +>A : typeof A + + export class B { +>B : B + + foo() { } +>foo : () => void + + static bar() { } +>bar : () => void + } +} + +module A { +>A : typeof A + + export module B { +>B : typeof B + + export var x = 1; +>x : number + } +} + +var b: A.B; // ok +>b : B +>A : A +>B : B + diff --git a/tests/baselines/reference/cloduleAndTypeParameters.types b/tests/baselines/reference/cloduleAndTypeParameters.types new file mode 100644 index 00000000000..63c80a44f18 --- /dev/null +++ b/tests/baselines/reference/cloduleAndTypeParameters.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/cloduleAndTypeParameters.ts === +class Foo { +>Foo : Foo +>T : T +>Foo : Foo +>Bar : Bar + + constructor() { + } +} + +module Foo { +>Foo : typeof Foo + + export interface Bar { +>Bar : Bar + + bar(): void; +>bar : () => void + } + + export class Baz { +>Baz : Baz + } +} diff --git a/tests/baselines/reference/cloduleTest1.types b/tests/baselines/reference/cloduleTest1.types new file mode 100644 index 00000000000..a92355b483a --- /dev/null +++ b/tests/baselines/reference/cloduleTest1.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/cloduleTest1.ts === + declare function $(selector: string): $; +>$ : typeof $ +>selector : string +>$ : $ + + interface $ { +>$ : $ + + addClass(className: string): $; +>addClass : (className: string) => $ +>className : string +>$ : $ + } + module $ { +>$ : typeof $ + + export interface AjaxSettings { +>AjaxSettings : AjaxSettings + } + export function ajax(options: AjaxSettings) { } +>ajax : (options: AjaxSettings) => void +>options : AjaxSettings +>AjaxSettings : AjaxSettings + } + var it: $ = $('.foo').addClass('bar'); +>it : $ +>$ : $ +>$('.foo').addClass('bar') : $ +>$('.foo').addClass : (className: string) => $ +>$('.foo') : $ +>$ : typeof $ +>addClass : (className: string) => $ + diff --git a/tests/baselines/reference/cloduleWithRecursiveReference.types b/tests/baselines/reference/cloduleWithRecursiveReference.types new file mode 100644 index 00000000000..d9f28399a53 --- /dev/null +++ b/tests/baselines/reference/cloduleWithRecursiveReference.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/cloduleWithRecursiveReference.ts === +module M +>M : typeof M +{ + export class C { } +>C : C + + export module C { +>C : typeof C + + export var C = M.C +>C : typeof C +>M.C : typeof C +>M : typeof M +>C : typeof C + } +} diff --git a/tests/baselines/reference/collisionArgumentsInType.types b/tests/baselines/reference/collisionArgumentsInType.types new file mode 100644 index 00000000000..a8096e2e7f5 --- /dev/null +++ b/tests/baselines/reference/collisionArgumentsInType.types @@ -0,0 +1,53 @@ +=== tests/cases/compiler/collisionArgumentsInType.ts === +var v1: (i: number, ...arguments) => void; // no error - no code gen +>v1 : (i: number, ...arguments: any[]) => void +>i : number +>arguments : any[] + +var v12: (arguments: number, ...restParameters) => void; // no error - no code gen +>v12 : (arguments: number, ...restParameters: any[]) => void +>arguments : number +>restParameters : any[] + +var v2: { +>v2 : { (arguments: number, ...restParameters: any[]): any; new (arguments: number, ...restParameters: any[]): any; foo(arguments: number, ...restParameters: any[]): any; prop: (arguments: number, ...restParameters: any[]) => void; } + + (arguments: number, ...restParameters); // no error - no code gen +>arguments : number +>restParameters : any[] + + new (arguments: number, ...restParameters); // no error - no code gen +>arguments : number +>restParameters : any[] + + foo(arguments: number, ...restParameters); // no error - no code gen +>foo : (arguments: number, ...restParameters: any[]) => any +>arguments : number +>restParameters : any[] + + prop: (arguments: number, ...restParameters) => void; // no error - no code gen +>prop : (arguments: number, ...restParameters: any[]) => void +>arguments : number +>restParameters : any[] +} +var v21: { +>v21 : { (i: number, ...arguments: any[]): any; new (i: number, ...arguments: any[]): any; foo(i: number, ...arguments: any[]): any; prop: (i: number, ...arguments: any[]) => void; } + + (i: number, ...arguments); // no error - no code gen +>i : number +>arguments : any[] + + new (i: number, ...arguments); // no error - no code gen +>i : number +>arguments : any[] + + foo(i: number, ...arguments); // no error - no code gen +>foo : (i: number, ...arguments: any[]) => any +>i : number +>arguments : any[] + + prop: (i: number, ...arguments) => void; // no error - no code gen +>prop : (i: number, ...arguments: any[]) => void +>i : number +>arguments : any[] +} diff --git a/tests/baselines/reference/collisionArgumentsInterfaceMembers.types b/tests/baselines/reference/collisionArgumentsInterfaceMembers.types new file mode 100644 index 00000000000..6edb0a7ebed --- /dev/null +++ b/tests/baselines/reference/collisionArgumentsInterfaceMembers.types @@ -0,0 +1,63 @@ +=== tests/cases/compiler/collisionArgumentsInterfaceMembers.ts === +// call +interface i1 { +>i1 : i1 + + (i: number, ...arguments); // no error - no code gen +>i : number +>arguments : any[] +} +interface i12 { +>i12 : i12 + + (arguments: number, ...rest); // no error - no code gen +>arguments : number +>rest : any[] +} +interface i1NoError { +>i1NoError : i1NoError + + (arguments: number); // no error +>arguments : number +} + +// new +interface i2 { +>i2 : i2 + + new (i: number, ...arguments); // no error - no code gen +>i : number +>arguments : any[] +} +interface i21 { +>i21 : i21 + + new (arguments: number, ...rest); // no error - no code gen +>arguments : number +>rest : any[] +} +interface i2NoError { +>i2NoError : i2NoError + + new (arguments: number); // no error +>arguments : number +} + +// method +interface i3 { +>i3 : i3 + + foo(i: number, ...arguments); // no error - no code gen +>foo : (i: number, ...arguments: any[]) => any +>i : number +>arguments : any[] + + foo1(arguments: number, ...rest); // no error - no code gen +>foo1 : (arguments: number, ...rest: any[]) => any +>arguments : number +>rest : any[] + + fooNoError(arguments: number); // no error +>fooNoError : (arguments: number) => any +>arguments : number +} diff --git a/tests/baselines/reference/collisionCodeGenEnumWithEnumMemberConflict.types b/tests/baselines/reference/collisionCodeGenEnumWithEnumMemberConflict.types new file mode 100644 index 00000000000..398179b5cdc --- /dev/null +++ b/tests/baselines/reference/collisionCodeGenEnumWithEnumMemberConflict.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/collisionCodeGenEnumWithEnumMemberConflict.ts === +enum Color { +>Color : Color + + Color, +>Color : Color + + Thing = Color +>Thing : Color +>Color : Color +} diff --git a/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.types b/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.types new file mode 100644 index 00000000000..f63f7eeb4f2 --- /dev/null +++ b/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.types @@ -0,0 +1,48 @@ +=== tests/cases/compiler/collisionCodeGenModuleWithConstructorChildren.ts === +module M { +>M : typeof M + + export var x = 3; +>x : number + + class c { +>c : c + + constructor(M, p = x) { +>M : any +>p : number +>x : number + } + } +} + +module M { +>M : typeof M + + class d { +>d : d + + constructor(private M, p = x) { +>M : any +>p : number +>x : number + } + } +} + +module M { +>M : typeof M + + class d2 { +>d2 : d2 + + constructor() { + var M = 10; +>M : number + + var p = x; +>p : number +>x : number + } + } +} diff --git a/tests/baselines/reference/collisionCodeGenModuleWithEnumMemberConflict.types b/tests/baselines/reference/collisionCodeGenModuleWithEnumMemberConflict.types new file mode 100644 index 00000000000..527c8930fcb --- /dev/null +++ b/tests/baselines/reference/collisionCodeGenModuleWithEnumMemberConflict.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/collisionCodeGenModuleWithEnumMemberConflict.ts === +module m1 { +>m1 : typeof m1 + + enum e { +>e : e + + m1, +>m1 : e + + m2 = m1 +>m2 : e +>m1 : e + } +} diff --git a/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.types b/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.types new file mode 100644 index 00000000000..07ef123f642 --- /dev/null +++ b/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.types @@ -0,0 +1,44 @@ +=== tests/cases/compiler/collisionCodeGenModuleWithFunctionChildren.ts === +module M { +>M : typeof M + + export var x = 3; +>x : number + + function fn(M, p = x) { } +>fn : (M: any, p?: number) => void +>M : any +>p : number +>x : number +} + +module M { +>M : typeof M + + function fn2() { +>fn2 : () => void + + var M; +>M : any + + var p = x; +>p : number +>x : number + } +} + +module M { +>M : typeof M + + function fn3() { +>fn3 : () => void + + function M() { +>M : () => void + + var p = x; +>p : number +>x : number + } + } +} diff --git a/tests/baselines/reference/collisionCodeGenModuleWithMemberClassConflict.types b/tests/baselines/reference/collisionCodeGenModuleWithMemberClassConflict.types new file mode 100644 index 00000000000..d9901034517 --- /dev/null +++ b/tests/baselines/reference/collisionCodeGenModuleWithMemberClassConflict.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/collisionCodeGenModuleWithMemberClassConflict.ts === +module m1 { +>m1 : typeof m1 + + export class m1 { +>m1 : m1 + } +} +var foo = new m1.m1(); +>foo : m1 +>new m1.m1() : m1 +>m1.m1 : typeof m1 +>m1 : typeof m1 +>m1 : typeof m1 + +module m2 { +>m2 : typeof m2 + + export class m2 { +>m2 : m2 + } + + export class _m2 { +>_m2 : _m2 + } +} +var foo = new m2.m2(); +>foo : m1 +>new m2.m2() : m2 +>m2.m2 : typeof m2 +>m2 : typeof m2 +>m2 : typeof m2 + +var foo = new m2._m2(); +>foo : m1 +>new m2._m2() : _m2 +>m2._m2 : typeof _m2 +>m2 : typeof m2 +>_m2 : typeof _m2 + diff --git a/tests/baselines/reference/collisionCodeGenModuleWithMemberInterfaceConflict.types b/tests/baselines/reference/collisionCodeGenModuleWithMemberInterfaceConflict.types new file mode 100644 index 00000000000..fde4c2fefeb --- /dev/null +++ b/tests/baselines/reference/collisionCodeGenModuleWithMemberInterfaceConflict.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/collisionCodeGenModuleWithMemberInterfaceConflict.ts === +module m1 { +>m1 : typeof m1 + + export interface m1 { +>m1 : m1 + } + export class m2 implements m1 { +>m2 : m2 +>m1 : m1 + } +} +var foo = new m1.m2(); +>foo : m2 +>new m1.m2() : m2 +>m1.m2 : typeof m2 +>m1 : typeof m1 +>m2 : typeof m2 + diff --git a/tests/baselines/reference/collisionCodeGenModuleWithMemberVariable.types b/tests/baselines/reference/collisionCodeGenModuleWithMemberVariable.types new file mode 100644 index 00000000000..86f0767959d --- /dev/null +++ b/tests/baselines/reference/collisionCodeGenModuleWithMemberVariable.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/collisionCodeGenModuleWithMemberVariable.ts === +module m1 { +>m1 : typeof m1 + + export var m1 = 10; +>m1 : number + + var b = m1; +>b : number +>m1 : number +} +var foo = m1.m1; +>foo : number +>m1.m1 : number +>m1 : typeof m1 +>m1 : number + diff --git a/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.types b/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.types new file mode 100644 index 00000000000..3632806e9b3 --- /dev/null +++ b/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.types @@ -0,0 +1,68 @@ +=== tests/cases/compiler/collisionCodeGenModuleWithMethodChildren.ts === +module M { +>M : typeof M + + export var x = 3; +>x : number + + class c { +>c : c + + fn(M, p = x) { } +>fn : (M: any, p?: number) => void +>M : any +>p : number +>x : number + } +} + +module M { +>M : typeof M + + class d { +>d : d + + fn2() { +>fn2 : () => void + + var M; +>M : any + + var p = x; +>p : number +>x : number + } + } +} + +module M { +>M : typeof M + + class e { +>e : e + + fn3() { +>fn3 : () => void + + function M() { +>M : () => void + + var p = x; +>p : number +>x : number + } + } + } +} + +module M { // Shouldnt bn _M +>M : typeof M + + class f { +>f : f + + M() { +>M : () => void + } + } +} diff --git a/tests/baselines/reference/collisionCodeGenModuleWithModuleChildren.types b/tests/baselines/reference/collisionCodeGenModuleWithModuleChildren.types new file mode 100644 index 00000000000..7853bcbdb32 --- /dev/null +++ b/tests/baselines/reference/collisionCodeGenModuleWithModuleChildren.types @@ -0,0 +1,93 @@ +=== tests/cases/compiler/collisionCodeGenModuleWithModuleChildren.ts === +module M { +>M : typeof M + + export var x = 3; +>x : number + + module m1 { +>m1 : typeof m1 + + var M = 10; +>M : number + + var p = x; +>p : number +>x : number + } +} + +module M { +>M : typeof M + + module m2 { +>m2 : typeof m2 + + class M { +>M : M + } + var p = x; +>p : number +>x : number + + var p2 = new M(); +>p2 : M +>new M() : M +>M : typeof M + } +} + +module M { +>M : typeof M + + module m3 { +>m3 : typeof m3 + + function M() { +>M : () => void + } + var p = x; +>p : number +>x : number + + var p2 = M(); +>p2 : void +>M() : void +>M : () => void + } +} + +module M { // shouldnt be _M +>M : typeof M + + module m3 { +>m3 : typeof m3 + + interface M { +>M : M + } + var p = x; +>p : number +>x : number + + var p2: M; +>p2 : M +>M : M + } +} + +module M { +>M : typeof M + + module m4 { +>m4 : typeof m4 + + module M { +>M : typeof M + + var p = x; +>p : number +>x : number + } + } +} diff --git a/tests/baselines/reference/collisionCodeGenModuleWithModuleReopening.types b/tests/baselines/reference/collisionCodeGenModuleWithModuleReopening.types new file mode 100644 index 00000000000..7a8090a6666 --- /dev/null +++ b/tests/baselines/reference/collisionCodeGenModuleWithModuleReopening.types @@ -0,0 +1,93 @@ +=== tests/cases/compiler/collisionCodeGenModuleWithModuleReopening.ts === +module m1 { +>m1 : typeof m1 + + export class m1 { +>m1 : m1 + } +} +var foo = new m1.m1(); +>foo : m1 +>new m1.m1() : m1 +>m1.m1 : typeof m1 +>m1 : typeof m1 +>m1 : typeof m1 + +module m1 { +>m1 : typeof m1 + + export class c1 { +>c1 : c1 + } + var b = new c1(); +>b : c1 +>new c1() : c1 +>c1 : typeof c1 + + var c = new m1(); +>c : m1 +>new m1() : m1 +>m1 : typeof m1 +} +var foo2 = new m1.c1(); +>foo2 : c1 +>new m1.c1() : c1 +>m1.c1 : typeof c1 +>m1 : typeof m1 +>c1 : typeof c1 + +module m2 { +>m2 : typeof m2 + + export class c1 { +>c1 : c1 + } + export var b10 = 10; +>b10 : number + + var x = new c1(); +>x : c1 +>new c1() : c1 +>c1 : typeof c1 +} +var foo3 = new m2.c1(); +>foo3 : c1 +>new m2.c1() : c1 +>m2.c1 : typeof c1 +>m2 : typeof m2 +>c1 : typeof c1 + +module m2 { +>m2 : typeof m2 + + export class m2 { +>m2 : m2 + } + var b = new m2(); +>b : m2 +>new m2() : m2 +>m2 : typeof m2 + + var d = b10; +>d : number +>b10 : number + + var c = new c1(); +>c : c1 +>new c1() : c1 +>c1 : typeof c1 +} +var foo3 = new m2.c1(); +>foo3 : c1 +>new m2.c1() : c1 +>m2.c1 : typeof c1 +>m2 : typeof m2 +>c1 : typeof c1 + +var foo2 = new m2.m2(); +>foo2 : c1 +>new m2.m2() : m2 +>m2.m2 : typeof m2 +>m2 : typeof m2 +>m2 : typeof m2 + diff --git a/tests/baselines/reference/collisionCodeGenModuleWithPrivateMember.types b/tests/baselines/reference/collisionCodeGenModuleWithPrivateMember.types new file mode 100644 index 00000000000..47898d28352 --- /dev/null +++ b/tests/baselines/reference/collisionCodeGenModuleWithPrivateMember.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/collisionCodeGenModuleWithPrivateMember.ts === +module m1 { +>m1 : typeof m1 + + class m1 { +>m1 : m1 + } + var x = new m1(); +>x : m1 +>new m1() : m1 +>m1 : typeof m1 + + export class c1 { +>c1 : c1 + } +} +var foo = new m1.c1(); +>foo : c1 +>new m1.c1() : c1 +>m1.c1 : typeof c1 +>m1 : typeof m1 +>c1 : typeof c1 + diff --git a/tests/baselines/reference/collisionCodeGenModuleWithUnicodeNames.types b/tests/baselines/reference/collisionCodeGenModuleWithUnicodeNames.types new file mode 100644 index 00000000000..e690ba6b713 --- /dev/null +++ b/tests/baselines/reference/collisionCodeGenModuleWithUnicodeNames.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/collisionCodeGenModuleWithUnicodeNames.ts === +module 才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123 { +>才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123 : typeof 才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123 + + export class 才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123 { +>才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123 : 才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123 + } +} + +var x = new 才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123.才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123(); +>x : 才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123 +>new 才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123.才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123() : 才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123 +>才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123.才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123 : typeof 才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123 +>才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123 : typeof 才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123 +>才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123 : typeof 才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüß才能ソЫⅨ蒤郳र्क्ड्राüışğİliيونيكودöÄüßAbcd123 + + + diff --git a/tests/baselines/reference/collisionExportsRequireAndAlias.types b/tests/baselines/reference/collisionExportsRequireAndAlias.types new file mode 100644 index 00000000000..0e13caf3247 --- /dev/null +++ b/tests/baselines/reference/collisionExportsRequireAndAlias.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/collisionExportsRequireAndAlias.ts === +// TODO: re-enable, fails when run in the browser with full compiler suite, but not when run alone +No type information for this code. +No type information for this code.////@module: amd +No type information for this code.//// @Filename: collisionExportsRequireAndAlias_file1.ts +No type information for this code.//export function bar() { +No type information for this code.//} +No type information for this code. +No type information for this code.//// @Filename: collisionExportsRequireAndAlias_file3333.ts +No type information for this code.//export function bar2() { +No type information for this code.//} +No type information for this code.//// @Filename: collisionExportsRequireAndAlias_file2.ts +No type information for this code.//import require = require('collisionExportsRequireAndAlias_file1'); // Error +No type information for this code.//import exports = require('collisionExportsRequireAndAlias_file3333'); // Error +No type information for this code.//export function foo() { +No type information for this code.// require.bar(); +No type information for this code.//} +No type information for this code.//export function foo2() { +No type information for this code.// exports.bar2(); +No type information for this code.//} +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/collisionExportsRequireAndClass.types b/tests/baselines/reference/collisionExportsRequireAndClass.types new file mode 100644 index 00000000000..07debc40147 --- /dev/null +++ b/tests/baselines/reference/collisionExportsRequireAndClass.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/collisionExportsRequireAndClass.ts === +export class require { +>require : require +} +export class exports { +>exports : exports +} + diff --git a/tests/baselines/reference/collisionExportsRequireAndEnum.types b/tests/baselines/reference/collisionExportsRequireAndEnum.types new file mode 100644 index 00000000000..b347b72284b --- /dev/null +++ b/tests/baselines/reference/collisionExportsRequireAndEnum.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/collisionExportsRequireAndEnum.ts === +export enum require { // Error +>require : require + + _thisVal1, +>_thisVal1 : require + + _thisVal2, +>_thisVal2 : require +} +export enum exports { // Error +>exports : exports + + _thisVal1, +>_thisVal1 : exports + + _thisVal2, +>_thisVal2 : exports +} diff --git a/tests/baselines/reference/collisionExportsRequireAndFunction.types b/tests/baselines/reference/collisionExportsRequireAndFunction.types new file mode 100644 index 00000000000..8b90397c6fe --- /dev/null +++ b/tests/baselines/reference/collisionExportsRequireAndFunction.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/collisionExportsRequireAndFunction.ts === +export function exports() { +>exports : () => number + + return 1; +} +export function require() { +>require : () => string + + return "require"; +} + diff --git a/tests/baselines/reference/collisionExportsRequireAndModule.types b/tests/baselines/reference/collisionExportsRequireAndModule.types new file mode 100644 index 00000000000..e2956ee1ba8 --- /dev/null +++ b/tests/baselines/reference/collisionExportsRequireAndModule.types @@ -0,0 +1,35 @@ +=== tests/cases/compiler/collisionExportsRequireAndModule.ts === +export module require { +>require : typeof require + + export interface I { +>I : I + } + export class C { +>C : C + } +} +export function foo(): require.I { +>foo : () => I +>require : require +>I : I + + return null; +} +export module exports { +>exports : typeof exports + + export interface I { +>I : I + } + export class C { +>C : C + } +} +export function foo2(): exports.I { +>foo2 : () => I +>exports : exports +>I : I + + return null; +} diff --git a/tests/baselines/reference/collisionExportsRequireAndUninstantiatedModule.types b/tests/baselines/reference/collisionExportsRequireAndUninstantiatedModule.types new file mode 100644 index 00000000000..4b219229ef3 --- /dev/null +++ b/tests/baselines/reference/collisionExportsRequireAndUninstantiatedModule.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/collisionExportsRequireAndUninstantiatedModule.ts === +export module require { // no error +>require : require + + export interface I { +>I : I + } +} +export function foo(): require.I { +>foo : () => I +>require : require +>I : I + + return null; +} +export module exports { // no error +>exports : exports + + export interface I { +>I : I + } +} +export function foo2(): exports.I { +>foo2 : () => I +>exports : exports +>I : I + + return null; +} diff --git a/tests/baselines/reference/collisionExportsRequireAndVar.types b/tests/baselines/reference/collisionExportsRequireAndVar.types new file mode 100644 index 00000000000..656c705aa23 --- /dev/null +++ b/tests/baselines/reference/collisionExportsRequireAndVar.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/collisionExportsRequireAndVar.ts === +export function foo() { +>foo : () => void +} +var exports = 1; +>exports : number + +var require = "require"; +>require : string + diff --git a/tests/baselines/reference/collisionRestParameterInType.types b/tests/baselines/reference/collisionRestParameterInType.types new file mode 100644 index 00000000000..5987409407d --- /dev/null +++ b/tests/baselines/reference/collisionRestParameterInType.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/collisionRestParameterInType.ts === +var v1: (_i: number, ...restParameters) => void; // no error - no code gen +>v1 : (_i: number, ...restParameters: any[]) => void +>_i : number +>restParameters : any[] + +var v2: { +>v2 : { (_i: number, ...restParameters: any[]): any; new (_i: number, ...restParameters: any[]): any; foo(_i: number, ...restParameters: any[]): any; prop: (_i: number, ...restParameters: any[]) => void; } + + (_i: number, ...restParameters); // no error - no code gen +>_i : number +>restParameters : any[] + + new (_i: number, ...restParameters); // no error - no code gen +>_i : number +>restParameters : any[] + + foo(_i: number, ...restParameters); // no error - no code gen +>foo : (_i: number, ...restParameters: any[]) => any +>_i : number +>restParameters : any[] + + prop: (_i: number, ...restParameters) => void; // no error - no code gen +>prop : (_i: number, ...restParameters: any[]) => void +>_i : number +>restParameters : any[] +} diff --git a/tests/baselines/reference/collisionRestParameterInterfaceMembers.types b/tests/baselines/reference/collisionRestParameterInterfaceMembers.types new file mode 100644 index 00000000000..f060857f2d0 --- /dev/null +++ b/tests/baselines/reference/collisionRestParameterInterfaceMembers.types @@ -0,0 +1,44 @@ +=== tests/cases/compiler/collisionRestParameterInterfaceMembers.ts === +// call +interface i1 { +>i1 : i1 + + (_i: number, ...restParameters); // no error - no code gen +>_i : number +>restParameters : any[] +} +interface i1NoError { +>i1NoError : i1NoError + + (_i: number); // no error +>_i : number +} + +// new +interface i2 { +>i2 : i2 + + new (_i: number, ...restParameters); // no error - no code gen +>_i : number +>restParameters : any[] +} +interface i2NoError { +>i2NoError : i2NoError + + new (_i: number); // no error +>_i : number +} + +// method +interface i3 { +>i3 : i3 + + foo (_i: number, ...restParameters); // no error - no code gen +>foo : (_i: number, ...restParameters: any[]) => any +>_i : number +>restParameters : any[] + + fooNoError (_i: number); // no error +>fooNoError : (_i: number) => any +>_i : number +} diff --git a/tests/baselines/reference/commaOperator1.types b/tests/baselines/reference/commaOperator1.types new file mode 100644 index 00000000000..52a36e33024 --- /dev/null +++ b/tests/baselines/reference/commaOperator1.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/commaOperator1.ts === +var v1 = ((1, 2, 3), 4, 5, (6, 7)); +>v1 : number +>((1, 2, 3), 4, 5, (6, 7)) : number +>(1, 2, 3), 4, 5, (6, 7) : number +>(1, 2, 3), 4, 5 : number +>(1, 2, 3), 4 : number +>(1, 2, 3) : number +>1, 2, 3 : number +>1, 2 : number +>(6, 7) : number +>6, 7 : number + +function f1() { +>f1 : () => number + + var a = 1; +>a : number + + return a, v1, a; +>a, v1, a : number +>a, v1 : number +>a : number +>v1 : number +>a : number +} + diff --git a/tests/baselines/reference/commaOperatorOtherValidOperation.types b/tests/baselines/reference/commaOperatorOtherValidOperation.types new file mode 100644 index 00000000000..e42991e7b5a --- /dev/null +++ b/tests/baselines/reference/commaOperatorOtherValidOperation.types @@ -0,0 +1,59 @@ +=== tests/cases/conformance/expressions/commaOperator/commaOperatorOtherValidOperation.ts === +//Comma operator in for loop +for (var i = 0, j = 10; i < j; i++, j--) +>i : number +>j : number +>i < j : boolean +>i : number +>j : number +>i++, j-- : number +>i++ : number +>i : number +>j-- : number +>j : number +{ +} + +//Comma operator in fuction arguments and return +function foo(x: number, y: string) +>foo : (x: number, y: string) => string +>x : number +>y : string +{ + return x, y; +>x, y : string +>x : number +>y : string +} +var resultIsString = foo(1, "123"); +>resultIsString : string +>foo(1, "123") : string +>foo : (x: number, y: string) => string + +//TypeParameters +function foo1() +>foo1 : () => void +>T1 : T1 +>T2 : T2 +{ + var x: T1; +>x : T1 +>T1 : T1 + + var y: T2; +>y : T2 +>T2 : T2 + + x, y; +>x, y : T2 +>x : T1 +>y : T2 + + var resultIsT1 = (y, x); +>resultIsT1 : T1 +>(y, x) : T1 +>y, x : T1 +>y : T2 +>x : T1 +} + diff --git a/tests/baselines/reference/commaOperatorWithSecondOperandAnyType.types b/tests/baselines/reference/commaOperatorWithSecondOperandAnyType.types new file mode 100644 index 00000000000..a63e20cf673 --- /dev/null +++ b/tests/baselines/reference/commaOperatorWithSecondOperandAnyType.types @@ -0,0 +1,164 @@ +=== tests/cases/conformance/expressions/commaOperator/commaOperatorWithSecondOperandAnyType.ts === +var ANY: any; +>ANY : any + +var BOOLEAN: boolean; +>BOOLEAN : boolean + +var NUMBER: number; +>NUMBER : number + +var STRING: string; +>STRING : string + +var OBJECT: Object; +>OBJECT : Object +>Object : Object + +//The second operand type is any +ANY, ANY; +>ANY, ANY : any +>ANY : any +>ANY : any + +BOOLEAN, ANY; +>BOOLEAN, ANY : any +>BOOLEAN : boolean +>ANY : any + +NUMBER, ANY; +>NUMBER, ANY : any +>NUMBER : number +>ANY : any + +STRING, ANY; +>STRING, ANY : any +>STRING : string +>ANY : any + +OBJECT, ANY; +>OBJECT, ANY : any +>OBJECT : Object +>ANY : any + +//Return type is any +var resultIsAny1 = (ANY, ANY); +>resultIsAny1 : any +>(ANY, ANY) : any +>ANY, ANY : any +>ANY : any +>ANY : any + +var resultIsAny2 = (BOOLEAN, ANY); +>resultIsAny2 : any +>(BOOLEAN, ANY) : any +>BOOLEAN, ANY : any +>BOOLEAN : boolean +>ANY : any + +var resultIsAny3 = (NUMBER, ANY); +>resultIsAny3 : any +>(NUMBER, ANY) : any +>NUMBER, ANY : any +>NUMBER : number +>ANY : any + +var resultIsAny4 = (STRING, ANY); +>resultIsAny4 : any +>(STRING, ANY) : any +>STRING, ANY : any +>STRING : string +>ANY : any + +var resultIsAny5 = (OBJECT, ANY); +>resultIsAny5 : any +>(OBJECT, ANY) : any +>OBJECT, ANY : any +>OBJECT : Object +>ANY : any + +//Literal and expression +var x: any; +>x : any + +1, ANY; +>1, ANY : any +>ANY : any + +++NUMBER, ANY; +>++NUMBER, ANY : any +>++NUMBER : number +>NUMBER : number +>ANY : any + +"string", [null, 1]; +>"string", [null, 1] : number[] +>[null, 1] : number[] + +"string".charAt(0), [null, 1]; +>"string".charAt(0), [null, 1] : number[] +>"string".charAt(0) : string +>"string".charAt : (pos: number) => string +>charAt : (pos: number) => string +>[null, 1] : number[] + +true, x("any"); +>true, x("any") : any +>x("any") : any +>x : any + +!BOOLEAN, x.doSomeThing(); +>!BOOLEAN, x.doSomeThing() : any +>!BOOLEAN : boolean +>BOOLEAN : boolean +>x.doSomeThing() : any +>x.doSomeThing : any +>x : any +>doSomeThing : any + +var resultIsAny6 = (1, ANY); +>resultIsAny6 : any +>(1, ANY) : any +>1, ANY : any +>ANY : any + +var resultIsAny7 = (++NUMBER, ANY); +>resultIsAny7 : any +>(++NUMBER, ANY) : any +>++NUMBER, ANY : any +>++NUMBER : number +>NUMBER : number +>ANY : any + +var resultIsAny8 = ("string", null); +>resultIsAny8 : any +>("string", null) : null +>"string", null : null + +var resultIsAny9 = ("string".charAt(0), undefined); +>resultIsAny9 : any +>("string".charAt(0), undefined) : undefined +>"string".charAt(0), undefined : undefined +>"string".charAt(0) : string +>"string".charAt : (pos: number) => string +>charAt : (pos: number) => string +>undefined : undefined + +var resultIsAny10 = (true, x("any")); +>resultIsAny10 : any +>(true, x("any")) : any +>true, x("any") : any +>x("any") : any +>x : any + +var resultIsAny11 = (!BOOLEAN, x.doSomeThing()); +>resultIsAny11 : any +>(!BOOLEAN, x.doSomeThing()) : any +>!BOOLEAN, x.doSomeThing() : any +>!BOOLEAN : boolean +>BOOLEAN : boolean +>x.doSomeThing() : any +>x.doSomeThing : any +>x : any +>doSomeThing : any + diff --git a/tests/baselines/reference/commaOperatorWithSecondOperandBooleanType.types b/tests/baselines/reference/commaOperatorWithSecondOperandBooleanType.types new file mode 100644 index 00000000000..49a3fdc4cc5 --- /dev/null +++ b/tests/baselines/reference/commaOperatorWithSecondOperandBooleanType.types @@ -0,0 +1,158 @@ +=== tests/cases/conformance/expressions/commaOperator/commaOperatorWithSecondOperandBooleanType.ts === +var ANY: any; +>ANY : any + +var BOOLEAN: boolean; +>BOOLEAN : boolean + +var NUMBER: number; +>NUMBER : number + +var STRING: string; +>STRING : string + +var OBJECT: Object; +>OBJECT : Object +>Object : Object + +//The second operand type is boolean +ANY, BOOLEAN; +>ANY, BOOLEAN : boolean +>ANY : any +>BOOLEAN : boolean + +BOOLEAN, BOOLEAN; +>BOOLEAN, BOOLEAN : boolean +>BOOLEAN : boolean +>BOOLEAN : boolean + +NUMBER, BOOLEAN; +>NUMBER, BOOLEAN : boolean +>NUMBER : number +>BOOLEAN : boolean + +STRING, BOOLEAN; +>STRING, BOOLEAN : boolean +>STRING : string +>BOOLEAN : boolean + +OBJECT, BOOLEAN; +>OBJECT, BOOLEAN : boolean +>OBJECT : Object +>BOOLEAN : boolean + +//Return type is boolean +var resultIsBoolean1 = (ANY, BOOLEAN); +>resultIsBoolean1 : boolean +>(ANY, BOOLEAN) : boolean +>ANY, BOOLEAN : boolean +>ANY : any +>BOOLEAN : boolean + +var resultIsBoolean2 = (BOOLEAN, BOOLEAN); +>resultIsBoolean2 : boolean +>(BOOLEAN, BOOLEAN) : boolean +>BOOLEAN, BOOLEAN : boolean +>BOOLEAN : boolean +>BOOLEAN : boolean + +var resultIsBoolean3 = (NUMBER, BOOLEAN); +>resultIsBoolean3 : boolean +>(NUMBER, BOOLEAN) : boolean +>NUMBER, BOOLEAN : boolean +>NUMBER : number +>BOOLEAN : boolean + +var resultIsBoolean4 = (STRING, BOOLEAN); +>resultIsBoolean4 : boolean +>(STRING, BOOLEAN) : boolean +>STRING, BOOLEAN : boolean +>STRING : string +>BOOLEAN : boolean + +var resultIsBoolean5 = (OBJECT, BOOLEAN); +>resultIsBoolean5 : boolean +>(OBJECT, BOOLEAN) : boolean +>OBJECT, BOOLEAN : boolean +>OBJECT : Object +>BOOLEAN : boolean + +//Literal and expression +null, BOOLEAN; +>null, BOOLEAN : boolean +>BOOLEAN : boolean + +ANY = undefined, BOOLEAN; +>ANY = undefined, BOOLEAN : boolean +>ANY = undefined : undefined +>ANY : any +>undefined : undefined +>BOOLEAN : boolean + +1, true; +>1, true : boolean + +++NUMBER, true; +>++NUMBER, true : boolean +>++NUMBER : number +>NUMBER : number + +[1, 2, 3], !BOOLEAN; +>[1, 2, 3], !BOOLEAN : boolean +>[1, 2, 3] : number[] +>!BOOLEAN : boolean +>BOOLEAN : boolean + +OBJECT = [1, 2, 3], BOOLEAN = false; +>OBJECT = [1, 2, 3], BOOLEAN = false : boolean +>OBJECT = [1, 2, 3] : number[] +>OBJECT : Object +>[1, 2, 3] : number[] +>BOOLEAN = false : boolean +>BOOLEAN : boolean + +var resultIsBoolean6 = (null, BOOLEAN); +>resultIsBoolean6 : boolean +>(null, BOOLEAN) : boolean +>null, BOOLEAN : boolean +>BOOLEAN : boolean + +var resultIsBoolean7 = (ANY = undefined, BOOLEAN); +>resultIsBoolean7 : boolean +>(ANY = undefined, BOOLEAN) : boolean +>ANY = undefined, BOOLEAN : boolean +>ANY = undefined : undefined +>ANY : any +>undefined : undefined +>BOOLEAN : boolean + +var resultIsBoolean8 = (1, true); +>resultIsBoolean8 : boolean +>(1, true) : boolean +>1, true : boolean + +var resultIsBoolean9 = (++NUMBER, true); +>resultIsBoolean9 : boolean +>(++NUMBER, true) : boolean +>++NUMBER, true : boolean +>++NUMBER : number +>NUMBER : number + +var resultIsBoolean10 = ([1, 2, 3], !BOOLEAN); +>resultIsBoolean10 : boolean +>([1, 2, 3], !BOOLEAN) : boolean +>[1, 2, 3], !BOOLEAN : boolean +>[1, 2, 3] : number[] +>!BOOLEAN : boolean +>BOOLEAN : boolean + +var resultIsBoolean11 = (OBJECT = [1, 2, 3], BOOLEAN = false); +>resultIsBoolean11 : boolean +>(OBJECT = [1, 2, 3], BOOLEAN = false) : boolean +>OBJECT = [1, 2, 3], BOOLEAN = false : boolean +>OBJECT = [1, 2, 3] : number[] +>OBJECT : Object +>[1, 2, 3] : number[] +>BOOLEAN = false : boolean +>BOOLEAN : boolean + diff --git a/tests/baselines/reference/commaOperatorWithSecondOperandNumberType.types b/tests/baselines/reference/commaOperatorWithSecondOperandNumberType.types new file mode 100644 index 00000000000..a144466d4c8 --- /dev/null +++ b/tests/baselines/reference/commaOperatorWithSecondOperandNumberType.types @@ -0,0 +1,158 @@ +=== tests/cases/conformance/expressions/commaOperator/commaOperatorWithSecondOperandNumberType.ts === +var ANY: any; +>ANY : any + +var BOOLEAN: boolean; +>BOOLEAN : boolean + +var NUMBER: number; +>NUMBER : number + +var STRING: string; +>STRING : string + +var OBJECT: Object; +>OBJECT : Object +>Object : Object + +//The second operand type is number +ANY, NUMBER; +>ANY, NUMBER : number +>ANY : any +>NUMBER : number + +BOOLEAN, NUMBER; +>BOOLEAN, NUMBER : number +>BOOLEAN : boolean +>NUMBER : number + +NUMBER, NUMBER; +>NUMBER, NUMBER : number +>NUMBER : number +>NUMBER : number + +STRING, NUMBER; +>STRING, NUMBER : number +>STRING : string +>NUMBER : number + +OBJECT, NUMBER; +>OBJECT, NUMBER : number +>OBJECT : Object +>NUMBER : number + +//Return type is number +var resultIsNumber1 = (ANY, NUMBER); +>resultIsNumber1 : number +>(ANY, NUMBER) : number +>ANY, NUMBER : number +>ANY : any +>NUMBER : number + +var resultIsNumber2 = (BOOLEAN, NUMBER); +>resultIsNumber2 : number +>(BOOLEAN, NUMBER) : number +>BOOLEAN, NUMBER : number +>BOOLEAN : boolean +>NUMBER : number + +var resultIsNumber3 = (NUMBER, NUMBER); +>resultIsNumber3 : number +>(NUMBER, NUMBER) : number +>NUMBER, NUMBER : number +>NUMBER : number +>NUMBER : number + +var resultIsNumber4 = (STRING, NUMBER); +>resultIsNumber4 : number +>(STRING, NUMBER) : number +>STRING, NUMBER : number +>STRING : string +>NUMBER : number + +var resultIsNumber5 = (OBJECT, NUMBER); +>resultIsNumber5 : number +>(OBJECT, NUMBER) : number +>OBJECT, NUMBER : number +>OBJECT : Object +>NUMBER : number + +//Literal and expression +null, NUMBER; +>null, NUMBER : number +>NUMBER : number + +ANY = undefined, NUMBER; +>ANY = undefined, NUMBER : number +>ANY = undefined : undefined +>ANY : any +>undefined : undefined +>NUMBER : number + +true, 1; +>true, 1 : number + +BOOLEAN = false, 1; +>BOOLEAN = false, 1 : number +>BOOLEAN = false : boolean +>BOOLEAN : boolean + +"", NUMBER = 1; +>"", NUMBER = 1 : number +>NUMBER = 1 : number +>NUMBER : number + +STRING.trim(), NUMBER = 1; +>STRING.trim(), NUMBER = 1 : number +>STRING.trim() : string +>STRING.trim : () => string +>STRING : string +>trim : () => string +>NUMBER = 1 : number +>NUMBER : number + +var resultIsNumber6 = (null, NUMBER); +>resultIsNumber6 : number +>(null, NUMBER) : number +>null, NUMBER : number +>NUMBER : number + +var resultIsNumber7 = (ANY = undefined, NUMBER); +>resultIsNumber7 : number +>(ANY = undefined, NUMBER) : number +>ANY = undefined, NUMBER : number +>ANY = undefined : undefined +>ANY : any +>undefined : undefined +>NUMBER : number + +var resultIsNumber8 = (true, 1); +>resultIsNumber8 : number +>(true, 1) : number +>true, 1 : number + +var resultIsNumber9 = (BOOLEAN = false, 1); +>resultIsNumber9 : number +>(BOOLEAN = false, 1) : number +>BOOLEAN = false, 1 : number +>BOOLEAN = false : boolean +>BOOLEAN : boolean + +var resultIsNumber10 = ("", NUMBER = 1); +>resultIsNumber10 : number +>("", NUMBER = 1) : number +>"", NUMBER = 1 : number +>NUMBER = 1 : number +>NUMBER : number + +var resultIsNumber11 = (STRING.trim(), NUMBER = 1); +>resultIsNumber11 : number +>(STRING.trim(), NUMBER = 1) : number +>STRING.trim(), NUMBER = 1 : number +>STRING.trim() : string +>STRING.trim : () => string +>STRING : string +>trim : () => string +>NUMBER = 1 : number +>NUMBER : number + diff --git a/tests/baselines/reference/commaOperatorWithSecondOperandObjectType.types b/tests/baselines/reference/commaOperatorWithSecondOperandObjectType.types new file mode 100644 index 00000000000..ebd102c0fde --- /dev/null +++ b/tests/baselines/reference/commaOperatorWithSecondOperandObjectType.types @@ -0,0 +1,169 @@ +=== tests/cases/conformance/expressions/commaOperator/commaOperatorWithSecondOperandObjectType.ts === +var ANY: any; +>ANY : any + +var BOOLEAN: boolean; +>BOOLEAN : boolean + +var NUMBER: number; +>NUMBER : number + +var STRING: string; +>STRING : string + +var OBJECT: Object; +>OBJECT : Object +>Object : Object + +class CLASS { +>CLASS : CLASS + + num: number; +>num : number +} + +//The second operand type is Object +ANY, OBJECT; +>ANY, OBJECT : Object +>ANY : any +>OBJECT : Object + +BOOLEAN, OBJECT; +>BOOLEAN, OBJECT : Object +>BOOLEAN : boolean +>OBJECT : Object + +NUMBER, OBJECT; +>NUMBER, OBJECT : Object +>NUMBER : number +>OBJECT : Object + +STRING, OBJECT; +>STRING, OBJECT : Object +>STRING : string +>OBJECT : Object + +OBJECT, OBJECT; +>OBJECT, OBJECT : Object +>OBJECT : Object +>OBJECT : Object + +//Return type is Object +var resultIsObject1 = (ANY, OBJECT); +>resultIsObject1 : Object +>(ANY, OBJECT) : Object +>ANY, OBJECT : Object +>ANY : any +>OBJECT : Object + +var resultIsObject2 = (BOOLEAN, OBJECT); +>resultIsObject2 : Object +>(BOOLEAN, OBJECT) : Object +>BOOLEAN, OBJECT : Object +>BOOLEAN : boolean +>OBJECT : Object + +var resultIsObject3 = (NUMBER, OBJECT); +>resultIsObject3 : Object +>(NUMBER, OBJECT) : Object +>NUMBER, OBJECT : Object +>NUMBER : number +>OBJECT : Object + +var resultIsObject4 = (STRING, OBJECT); +>resultIsObject4 : Object +>(STRING, OBJECT) : Object +>STRING, OBJECT : Object +>STRING : string +>OBJECT : Object + +var resultIsObject5 = (OBJECT, OBJECT); +>resultIsObject5 : Object +>(OBJECT, OBJECT) : Object +>OBJECT, OBJECT : Object +>OBJECT : Object +>OBJECT : Object + +//Literal and expression +null, OBJECT +>null, OBJECT : Object +>OBJECT : Object + +ANY = null, OBJECT +>ANY = null, OBJECT : Object +>ANY = null : null +>ANY : any +>OBJECT : Object + +true, {} +>true, {} : {} +>{} : {} + +!BOOLEAN, [] +>!BOOLEAN, [] : undefined[] +>!BOOLEAN : boolean +>BOOLEAN : boolean +>[] : undefined[] + +"string", new Date() +>"string", new Date() : Date +>new Date() : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } + +STRING.toLowerCase(), new CLASS() +>STRING.toLowerCase(), new CLASS() : CLASS +>STRING.toLowerCase() : string +>STRING.toLowerCase : () => string +>STRING : string +>toLowerCase : () => string +>new CLASS() : CLASS +>CLASS : typeof CLASS + +var resultIsObject6 = (null, OBJECT); +>resultIsObject6 : Object +>(null, OBJECT) : Object +>null, OBJECT : Object +>OBJECT : Object + +var resultIsObject7 = (ANY = null, OBJECT); +>resultIsObject7 : Object +>(ANY = null, OBJECT) : Object +>ANY = null, OBJECT : Object +>ANY = null : null +>ANY : any +>OBJECT : Object + +var resultIsObject8 = (true, {}); +>resultIsObject8 : {} +>(true, {}) : {} +>true, {} : {} +>{} : {} + +var resultIsObject9 = (!BOOLEAN, { a: 1, b: "s" }); +>resultIsObject9 : { a: number; b: string; } +>(!BOOLEAN, { a: 1, b: "s" }) : { a: number; b: string; } +>!BOOLEAN, { a: 1, b: "s" } : { a: number; b: string; } +>!BOOLEAN : boolean +>BOOLEAN : boolean +>{ a: 1, b: "s" } : { a: number; b: string; } +>a : number +>b : string + +var resultIsObject10 = ("string", new Date()); +>resultIsObject10 : Date +>("string", new Date()) : Date +>"string", new Date() : Date +>new Date() : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } + +var resultIsObject11 = (STRING.toLowerCase(), new CLASS()); +>resultIsObject11 : CLASS +>(STRING.toLowerCase(), new CLASS()) : CLASS +>STRING.toLowerCase(), new CLASS() : CLASS +>STRING.toLowerCase() : string +>STRING.toLowerCase : () => string +>STRING : string +>toLowerCase : () => string +>new CLASS() : CLASS +>CLASS : typeof CLASS + diff --git a/tests/baselines/reference/commaOperatorWithSecondOperandStringType.types b/tests/baselines/reference/commaOperatorWithSecondOperandStringType.types new file mode 100644 index 00000000000..2fd182114bb --- /dev/null +++ b/tests/baselines/reference/commaOperatorWithSecondOperandStringType.types @@ -0,0 +1,169 @@ +=== tests/cases/conformance/expressions/commaOperator/commaOperatorWithSecondOperandStringType.ts === +var ANY: any; +>ANY : any + +var BOOLEAN: boolean; +>BOOLEAN : boolean + +var NUMBER: number; +>NUMBER : number + +var STRING: string; +>STRING : string + +var OBJECT: Object; +>OBJECT : Object +>Object : Object + +var resultIsString: string; +>resultIsString : string + +//The second operand is string +ANY, STRING; +>ANY, STRING : string +>ANY : any +>STRING : string + +BOOLEAN, STRING; +>BOOLEAN, STRING : string +>BOOLEAN : boolean +>STRING : string + +NUMBER, STRING; +>NUMBER, STRING : string +>NUMBER : number +>STRING : string + +STRING, STRING; +>STRING, STRING : string +>STRING : string +>STRING : string + +OBJECT, STRING; +>OBJECT, STRING : string +>OBJECT : Object +>STRING : string + +//Return type is string +var resultIsString1 = (ANY, STRING); +>resultIsString1 : string +>(ANY, STRING) : string +>ANY, STRING : string +>ANY : any +>STRING : string + +var resultIsString2 = (BOOLEAN, STRING); +>resultIsString2 : string +>(BOOLEAN, STRING) : string +>BOOLEAN, STRING : string +>BOOLEAN : boolean +>STRING : string + +var resultIsString3 = (NUMBER, STRING); +>resultIsString3 : string +>(NUMBER, STRING) : string +>NUMBER, STRING : string +>NUMBER : number +>STRING : string + +var resultIsString4 = (STRING, STRING); +>resultIsString4 : string +>(STRING, STRING) : string +>STRING, STRING : string +>STRING : string +>STRING : string + +var resultIsString5 = (OBJECT, STRING); +>resultIsString5 : string +>(OBJECT, STRING) : string +>OBJECT, STRING : string +>OBJECT : Object +>STRING : string + +//Literal and expression +null, STRING; +>null, STRING : string +>STRING : string + +ANY = new Date(), STRING; +>ANY = new Date(), STRING : string +>ANY = new Date() : Date +>ANY : any +>new Date() : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>STRING : string + +true, ""; +>true, "" : string + +BOOLEAN == undefined, ""; +>BOOLEAN == undefined, "" : string +>BOOLEAN == undefined : boolean +>BOOLEAN : boolean +>undefined : undefined + +["a", "b"], NUMBER.toString(); +>["a", "b"], NUMBER.toString() : string +>["a", "b"] : string[] +>NUMBER.toString() : string +>NUMBER.toString : (radix?: number) => string +>NUMBER : number +>toString : (radix?: number) => string + +OBJECT = new Object, STRING + "string"; +>OBJECT = new Object, STRING + "string" : string +>OBJECT = new Object : Object +>OBJECT : Object +>new Object : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } +>STRING + "string" : string +>STRING : string + +var resultIsString6 = (null, STRING); +>resultIsString6 : string +>(null, STRING) : string +>null, STRING : string +>STRING : string + +var resultIsString7 = (ANY = new Date(), STRING); +>resultIsString7 : string +>(ANY = new Date(), STRING) : string +>ANY = new Date(), STRING : string +>ANY = new Date() : Date +>ANY : any +>new Date() : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>STRING : string + +var resultIsString8 = (true, ""); +>resultIsString8 : string +>(true, "") : string +>true, "" : string + +var resultIsString9 = (BOOLEAN == undefined, ""); +>resultIsString9 : string +>(BOOLEAN == undefined, "") : string +>BOOLEAN == undefined, "" : string +>BOOLEAN == undefined : boolean +>BOOLEAN : boolean +>undefined : undefined + +var resultIsString10 = (["a", "b"], NUMBER.toString()); +>resultIsString10 : string +>(["a", "b"], NUMBER.toString()) : string +>["a", "b"], NUMBER.toString() : string +>["a", "b"] : string[] +>NUMBER.toString() : string +>NUMBER.toString : (radix?: number) => string +>NUMBER : number +>toString : (radix?: number) => string + +var resultIsString11 = (new Object, STRING + "string"); +>resultIsString11 : string +>(new Object, STRING + "string") : string +>new Object, STRING + "string" : string +>new Object : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } +>STRING + "string" : string +>STRING : string + diff --git a/tests/baselines/reference/commaOperatorsMultipleOperators.types b/tests/baselines/reference/commaOperatorsMultipleOperators.types new file mode 100644 index 00000000000..9297ea1aa47 --- /dev/null +++ b/tests/baselines/reference/commaOperatorsMultipleOperators.types @@ -0,0 +1,136 @@ +=== tests/cases/conformance/expressions/commaOperator/commaOperatorsMultipleOperators.ts === +var ANY: any; +>ANY : any + +var BOOLEAN: boolean; +>BOOLEAN : boolean + +var NUMBER: number; +>NUMBER : number + +var STRING: string; +>STRING : string + +var OBJECT: Object; +>OBJECT : Object +>Object : Object + +//Expected: work well +ANY, BOOLEAN, NUMBER; +>ANY, BOOLEAN, NUMBER : number +>ANY, BOOLEAN : boolean +>ANY : any +>BOOLEAN : boolean +>NUMBER : number + +BOOLEAN, NUMBER, STRING; +>BOOLEAN, NUMBER, STRING : string +>BOOLEAN, NUMBER : number +>BOOLEAN : boolean +>NUMBER : number +>STRING : string + +NUMBER, STRING, OBJECT; +>NUMBER, STRING, OBJECT : Object +>NUMBER, STRING : string +>NUMBER : number +>STRING : string +>OBJECT : Object + +STRING, OBJECT, ANY; +>STRING, OBJECT, ANY : any +>STRING, OBJECT : Object +>STRING : string +>OBJECT : Object +>ANY : any + +OBJECT, ANY, BOOLEAN; +>OBJECT, ANY, BOOLEAN : boolean +>OBJECT, ANY : any +>OBJECT : Object +>ANY : any +>BOOLEAN : boolean + +//Results should have the same type as the third operand +var resultIsAny1 = (STRING, OBJECT, ANY); +>resultIsAny1 : any +>(STRING, OBJECT, ANY) : any +>STRING, OBJECT, ANY : any +>STRING, OBJECT : Object +>STRING : string +>OBJECT : Object +>ANY : any + +var resultIsBoolean1 = (OBJECT, ANY, BOOLEAN); +>resultIsBoolean1 : boolean +>(OBJECT, ANY, BOOLEAN) : boolean +>OBJECT, ANY, BOOLEAN : boolean +>OBJECT, ANY : any +>OBJECT : Object +>ANY : any +>BOOLEAN : boolean + +var resultIsNumber1 = (ANY, BOOLEAN, NUMBER); +>resultIsNumber1 : number +>(ANY, BOOLEAN, NUMBER) : number +>ANY, BOOLEAN, NUMBER : number +>ANY, BOOLEAN : boolean +>ANY : any +>BOOLEAN : boolean +>NUMBER : number + +var resultIsString1 = (BOOLEAN, NUMBER, STRING); +>resultIsString1 : string +>(BOOLEAN, NUMBER, STRING) : string +>BOOLEAN, NUMBER, STRING : string +>BOOLEAN, NUMBER : number +>BOOLEAN : boolean +>NUMBER : number +>STRING : string + +var resultIsObject1 = (NUMBER, STRING, OBJECT); +>resultIsObject1 : Object +>(NUMBER, STRING, OBJECT) : Object +>NUMBER, STRING, OBJECT : Object +>NUMBER, STRING : string +>NUMBER : number +>STRING : string +>OBJECT : Object + +//Literal and expression +null, true, 1; +>null, true, 1 : number +>null, true : boolean + +++NUMBER, STRING.charAt(0), new Object(); +>++NUMBER, STRING.charAt(0), new Object() : Object +>++NUMBER, STRING.charAt(0) : string +>++NUMBER : number +>NUMBER : number +>STRING.charAt(0) : string +>STRING.charAt : (pos: number) => string +>STRING : string +>charAt : (pos: number) => string +>new Object() : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } + +var resultIsNumber2 = (null, true, 1); +>resultIsNumber2 : number +>(null, true, 1) : number +>null, true, 1 : number +>null, true : boolean + +var resultIsObject2 = (++NUMBER, STRING.charAt(0), new Object()); +>resultIsObject2 : Object +>(++NUMBER, STRING.charAt(0), new Object()) : Object +>++NUMBER, STRING.charAt(0), new Object() : Object +>++NUMBER, STRING.charAt(0) : string +>++NUMBER : number +>NUMBER : number +>STRING.charAt(0) : string +>STRING.charAt : (pos: number) => string +>STRING : string +>charAt : (pos: number) => string +>new Object() : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } + diff --git a/tests/baselines/reference/commentBeforeStaticMethod1.types b/tests/baselines/reference/commentBeforeStaticMethod1.types new file mode 100644 index 00000000000..db674324306 --- /dev/null +++ b/tests/baselines/reference/commentBeforeStaticMethod1.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/commentBeforeStaticMethod1.ts === +class C { +>C : C + + /** + * Returns bar + */ + public static foo(): string { +>foo : () => string + + return "bar"; + } +} diff --git a/tests/baselines/reference/commentInEmptyParameterList1.types b/tests/baselines/reference/commentInEmptyParameterList1.types new file mode 100644 index 00000000000..dd708e8c9ac --- /dev/null +++ b/tests/baselines/reference/commentInEmptyParameterList1.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/commentInEmptyParameterList1.ts === +function foo(/** nothing */) { +>foo : () => void +} diff --git a/tests/baselines/reference/commentInMethodCall.types b/tests/baselines/reference/commentInMethodCall.types new file mode 100644 index 00000000000..dad966bd3df --- /dev/null +++ b/tests/baselines/reference/commentInMethodCall.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/commentInMethodCall.ts === +//commment here +var s: string[]; +>s : string[] + +s.map(// do something +>s.map(// do something + function () { }) : void[] +>s.map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>s : string[] +>map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] + + function () { }); +>function () { } : () => void + diff --git a/tests/baselines/reference/commentOnAmbientClass1.types b/tests/baselines/reference/commentOnAmbientClass1.types new file mode 100644 index 00000000000..f7b9f206f0d --- /dev/null +++ b/tests/baselines/reference/commentOnAmbientClass1.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/commentOnAmbientClass1.ts === +/*! Keep this pinned comment */ +declare class C { +>C : C +} + +// Don't keep this comment. +declare class D { +>D : D +} diff --git a/tests/baselines/reference/commentOnAmbientVariable1.types b/tests/baselines/reference/commentOnAmbientVariable1.types new file mode 100644 index 00000000000..feff50f4293 --- /dev/null +++ b/tests/baselines/reference/commentOnAmbientVariable1.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/commentOnAmbientVariable1.ts === +/*! Keep this pinned comment */ +declare var v: number; +>v : number + +// Don't keep this comment. +declare var y: number; +>y : number + diff --git a/tests/baselines/reference/commentOnAmbientVariable2.types b/tests/baselines/reference/commentOnAmbientVariable2.types new file mode 100644 index 00000000000..68ca1459575 --- /dev/null +++ b/tests/baselines/reference/commentOnAmbientVariable2.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/commentOnAmbientVariable2_2.ts === +/// +declare var x: number; +>x : number + +x = 2; +>x = 2 : number +>x : number + +=== tests/cases/compiler/commentOnAmbientVariable2_1.ts === +var y = 1; +>y : number + diff --git a/tests/baselines/reference/commentOnClassMethod1.types b/tests/baselines/reference/commentOnClassMethod1.types new file mode 100644 index 00000000000..1ad8182b9c9 --- /dev/null +++ b/tests/baselines/reference/commentOnClassMethod1.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/commentOnClassMethod1.ts === +class WebControls { +>WebControls : WebControls + + /** + * Render a control + */ + createControl(): any { +>createControl : () => any + } +} diff --git a/tests/baselines/reference/commentOnElidedModule1.types b/tests/baselines/reference/commentOnElidedModule1.types new file mode 100644 index 00000000000..1a13ba668cf --- /dev/null +++ b/tests/baselines/reference/commentOnElidedModule1.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/commentOnElidedModule1.ts === +/*! Keep this pinned comment */ +module ElidedModule { +>ElidedModule : ElidedModule +} + +// Don't keep this comment. +module ElidedModule2 { +>ElidedModule2 : ElidedModule2 +} diff --git a/tests/baselines/reference/commentOnExpressionStatement1.types b/tests/baselines/reference/commentOnExpressionStatement1.types new file mode 100644 index 00000000000..c39689ed381 --- /dev/null +++ b/tests/baselines/reference/commentOnExpressionStatement1.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/commentOnExpressionStatement1.ts === + +1 + 1; // Comment. +>1 + 1 : number + diff --git a/tests/baselines/reference/commentOnIfStatement1.types b/tests/baselines/reference/commentOnIfStatement1.types new file mode 100644 index 00000000000..03f357c8ccf --- /dev/null +++ b/tests/baselines/reference/commentOnIfStatement1.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/commentOnIfStatement1.ts === + +No type information for this code.// Test +No type information for this code.if (true) { +No type information for this code.} +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/commentOnInterface1.types b/tests/baselines/reference/commentOnInterface1.types new file mode 100644 index 00000000000..60ddb0ccae6 --- /dev/null +++ b/tests/baselines/reference/commentOnInterface1.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/commentOnInterface1.ts === +/*! Keep this pinned comment */ +interface I { +>I : I +} + +// Don't keep this comment. +interface I2 { +>I2 : I2 +} diff --git a/tests/baselines/reference/commentOnParenthesizedExpressionOpenParen1.types b/tests/baselines/reference/commentOnParenthesizedExpressionOpenParen1.types new file mode 100644 index 00000000000..94a2930d314 --- /dev/null +++ b/tests/baselines/reference/commentOnParenthesizedExpressionOpenParen1.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/commentOnParenthesizedExpressionOpenParen1.ts === +var j; +>j : any + +var f: () => any; +>f : () => any + +( /* Preserve */ j = f()); +>( /* Preserve */ j = f()) : any +>( /* Preserve */ j = f()) : any +>j = f() : any +>j : any +>f() : any +>f : () => any + diff --git a/tests/baselines/reference/commentOnSignature1.types b/tests/baselines/reference/commentOnSignature1.types new file mode 100644 index 00000000000..6fd4516d4e9 --- /dev/null +++ b/tests/baselines/reference/commentOnSignature1.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/commentOnSignature1.ts === +/*! Keep this pinned comment */ +function foo(n: number): void; +>foo : { (n: number): void; (s: string): void; } +>n : number + +// Don't keep this comment. +function foo(s: string): void; +>foo : { (n: number): void; (s: string): void; } +>s : string + +function foo(a: any): void { +>foo : { (n: number): void; (s: string): void; } +>a : any +} diff --git a/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.types b/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.types new file mode 100644 index 00000000000..797da3e419a --- /dev/null +++ b/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/commentOnSimpleArrowFunctionBody1.ts === +function Foo(x: any) +>Foo : (x: any) => void +>x : any +{ +} + +Foo(() => +>Foo(() => + // do something + 127) : void +>Foo : (x: any) => void +>() => + // do something + 127 : () => number + + // do something + 127); + diff --git a/tests/baselines/reference/commentOnStaticMember1.types b/tests/baselines/reference/commentOnStaticMember1.types new file mode 100644 index 00000000000..4b54b07570a --- /dev/null +++ b/tests/baselines/reference/commentOnStaticMember1.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/commentOnStaticMember1.ts === +class Greeter { +>Greeter : Greeter + + //Hello World + static foo(){ +>foo : () => void + } +} diff --git a/tests/baselines/reference/commentsAtEndOfFile1.types b/tests/baselines/reference/commentsAtEndOfFile1.types new file mode 100644 index 00000000000..c09a435f1a7 --- /dev/null +++ b/tests/baselines/reference/commentsAtEndOfFile1.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/commentsAtEndOfFile1.ts === +Input: +No type information for this code.; +No type information for this code.//Testing two +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/commentsBeforeFunctionExpression1.types b/tests/baselines/reference/commentsBeforeFunctionExpression1.types new file mode 100644 index 00000000000..50bb6352fad --- /dev/null +++ b/tests/baselines/reference/commentsBeforeFunctionExpression1.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/commentsBeforeFunctionExpression1.ts === +var v = { +>v : { f: (a: any) => number; } +>{ + f: /**own f*/ (a) => 0 +} : { f: (a: any) => number; } + + f: /**own f*/ (a) => 0 +>f : (a: any) => number +>(a) => 0 : (a: any) => number +>a : any +} + diff --git a/tests/baselines/reference/commentsBeforeVariableStatement1.types b/tests/baselines/reference/commentsBeforeVariableStatement1.types new file mode 100644 index 00000000000..ec5a599e75c --- /dev/null +++ b/tests/baselines/reference/commentsBeforeVariableStatement1.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/commentsBeforeVariableStatement1.ts === +/** b's comment*/ +export var b: number; +>b : number + diff --git a/tests/baselines/reference/commentsClass.types b/tests/baselines/reference/commentsClass.types new file mode 100644 index 00000000000..ec3d610f47e --- /dev/null +++ b/tests/baselines/reference/commentsClass.types @@ -0,0 +1,131 @@ +=== tests/cases/compiler/commentsClass.ts === + +/** This is class c2 without constuctor*/ +class c2 { +>c2 : c2 +} +var i2 = new c2(); +>i2 : c2 +>new c2() : c2 +>c2 : typeof c2 + +var i2_c = c2; +>i2_c : typeof c2 +>c2 : typeof c2 + +class c3 { +>c3 : c3 + + /** Constructor comment*/ + constructor() { + } +} +var i3 = new c3(); +>i3 : c3 +>new c3() : c3 +>c3 : typeof c3 + +var i3_c = c3; +>i3_c : typeof c3 +>c3 : typeof c3 + +/** Class comment*/ +class c4 { +>c4 : c4 + + /** Constructor comment*/ + constructor() { + } +} +var i4 = new c4(); +>i4 : c4 +>new c4() : c4 +>c4 : typeof c4 + +var i4_c = c4; +>i4_c : typeof c4 +>c4 : typeof c4 + +/** Class with statics*/ +class c5 { +>c5 : c5 + + static s1: number; +>s1 : number +} +var i5 = new c5(); +>i5 : c5 +>new c5() : c5 +>c5 : typeof c5 + +var i5_c = c5; +>i5_c : typeof c5 +>c5 : typeof c5 + +/// class with statics and constructor +class c6 { /// class with statics and constructor2 +>c6 : c6 + + /// s1 comment + static s1: number; /// s1 comment2 +>s1 : number + + /// constructor comment + constructor() { /// constructor comment2 + } +} +var i6 = new c6(); +>i6 : c6 +>new c6() : c6 +>c6 : typeof c6 + +var i6_c = c6; +>i6_c : typeof c6 +>c6 : typeof c6 + +// class with statics and constructor +class c7 { +>c7 : c7 + + // s1 comment + static s1: number; +>s1 : number + + // constructor comment + constructor() { + } +} +var i7 = new c7(); +>i7 : c7 +>new c7() : c7 +>c7 : typeof c7 + +var i7_c = c7; +>i7_c : typeof c7 +>c7 : typeof c7 + +/** class with statics and constructor + */ +class c8 { +>c8 : c8 + + /** s1 comment */ + static s1: number; /** s1 comment2 */ +>s1 : number + + /** constructor comment + */ + constructor() { + /** constructor comment2 + */ + } +} +var i8 = new c8(); +>i8 : c8 +>new c8() : c8 +>c8 : typeof c8 + +var i8_c = c8; +>i8_c : typeof c8 +>c8 : typeof c8 + diff --git a/tests/baselines/reference/commentsClassMembers.types b/tests/baselines/reference/commentsClassMembers.types new file mode 100644 index 00000000000..85cf1e369f3 --- /dev/null +++ b/tests/baselines/reference/commentsClassMembers.types @@ -0,0 +1,754 @@ +=== tests/cases/compiler/commentsClassMembers.ts === + +/** This is comment for c1*/ +class c1 { +>c1 : c1 + + /** p1 is property of c1*/ + public p1: number; +>p1 : number + + /** sum with property*/ + public p2(/** number to add*/b: number) { +>p2 : (b: number) => number +>b : number + + return this.p1 + b; +>this.p1 + b : number +>this.p1 : number +>this : c1 +>p1 : number +>b : number + } + /** getter property*/ + public get p3() { +>p3 : number + + return this.p2(this.p1); +>this.p2(this.p1) : number +>this.p2 : (b: number) => number +>this : c1 +>p2 : (b: number) => number +>this.p1 : number +>this : c1 +>p1 : number + } + /** setter property*/ + public set p3(/** this is value*/value: number) { +>p3 : number +>value : number + + this.p1 = this.p2(value); +>this.p1 = this.p2(value) : number +>this.p1 : number +>this : c1 +>p1 : number +>this.p2(value) : number +>this.p2 : (b: number) => number +>this : c1 +>p2 : (b: number) => number +>value : number + } + /** pp1 is property of c1*/ + private pp1: number; +>pp1 : number + + /** sum with property*/ + private pp2(/** number to add*/b: number) { +>pp2 : (b: number) => number +>b : number + + return this.p1 + b; +>this.p1 + b : number +>this.p1 : number +>this : c1 +>p1 : number +>b : number + } + /** getter property*/ + private get pp3() { +>pp3 : number + + return this.pp2(this.pp1); +>this.pp2(this.pp1) : number +>this.pp2 : (b: number) => number +>this : c1 +>pp2 : (b: number) => number +>this.pp1 : number +>this : c1 +>pp1 : number + } + /** setter property*/ + private set pp3( /** this is value*/value: number) { +>pp3 : number +>value : number + + this.pp1 = this.pp2(value); +>this.pp1 = this.pp2(value) : number +>this.pp1 : number +>this : c1 +>pp1 : number +>this.pp2(value) : number +>this.pp2 : (b: number) => number +>this : c1 +>pp2 : (b: number) => number +>value : number + } + /** Constructor method*/ + constructor() { + } + /** s1 is static property of c1*/ + static s1: number; +>s1 : number + + /** static sum with property*/ + static s2(/** number to add*/b: number) { +>s2 : (b: number) => number +>b : number + + return c1.s1 + b; +>c1.s1 + b : number +>c1.s1 : number +>c1 : typeof c1 +>s1 : number +>b : number + } + /** static getter property*/ + static get s3() { +>s3 : number + + return c1.s2(c1.s1); +>c1.s2(c1.s1) : number +>c1.s2 : (b: number) => number +>c1 : typeof c1 +>s2 : (b: number) => number +>c1.s1 : number +>c1 : typeof c1 +>s1 : number + } + /** setter property*/ + static set s3( /** this is value*/value: number) { +>s3 : number +>value : number + + c1.s1 = c1.s2(value); +>c1.s1 = c1.s2(value) : number +>c1.s1 : number +>c1 : typeof c1 +>s1 : number +>c1.s2(value) : number +>c1.s2 : (b: number) => number +>c1 : typeof c1 +>s2 : (b: number) => number +>value : number + } + public nc_p1: number; +>nc_p1 : number + + public nc_p2(b: number) { +>nc_p2 : (b: number) => number +>b : number + + return this.nc_p1 + b; +>this.nc_p1 + b : number +>this.nc_p1 : number +>this : c1 +>nc_p1 : number +>b : number + } + public get nc_p3() { +>nc_p3 : number + + return this.nc_p2(this.nc_p1); +>this.nc_p2(this.nc_p1) : number +>this.nc_p2 : (b: number) => number +>this : c1 +>nc_p2 : (b: number) => number +>this.nc_p1 : number +>this : c1 +>nc_p1 : number + } + public set nc_p3(value: number) { +>nc_p3 : number +>value : number + + this.nc_p1 = this.nc_p2(value); +>this.nc_p1 = this.nc_p2(value) : number +>this.nc_p1 : number +>this : c1 +>nc_p1 : number +>this.nc_p2(value) : number +>this.nc_p2 : (b: number) => number +>this : c1 +>nc_p2 : (b: number) => number +>value : number + } + private nc_pp1: number; +>nc_pp1 : number + + private nc_pp2(b: number) { +>nc_pp2 : (b: number) => number +>b : number + + return this.nc_pp1 + b; +>this.nc_pp1 + b : number +>this.nc_pp1 : number +>this : c1 +>nc_pp1 : number +>b : number + } + private get nc_pp3() { +>nc_pp3 : number + + return this.nc_pp2(this.nc_pp1); +>this.nc_pp2(this.nc_pp1) : number +>this.nc_pp2 : (b: number) => number +>this : c1 +>nc_pp2 : (b: number) => number +>this.nc_pp1 : number +>this : c1 +>nc_pp1 : number + } + private set nc_pp3(value: number) { +>nc_pp3 : number +>value : number + + this.nc_pp1 = this.nc_pp2(value); +>this.nc_pp1 = this.nc_pp2(value) : number +>this.nc_pp1 : number +>this : c1 +>nc_pp1 : number +>this.nc_pp2(value) : number +>this.nc_pp2 : (b: number) => number +>this : c1 +>nc_pp2 : (b: number) => number +>value : number + } + static nc_s1: number; +>nc_s1 : number + + static nc_s2(b: number) { +>nc_s2 : (b: number) => number +>b : number + + return c1.nc_s1 + b; +>c1.nc_s1 + b : number +>c1.nc_s1 : number +>c1 : typeof c1 +>nc_s1 : number +>b : number + } + static get nc_s3() { +>nc_s3 : number + + return c1.nc_s2(c1.nc_s1); +>c1.nc_s2(c1.nc_s1) : number +>c1.nc_s2 : (b: number) => number +>c1 : typeof c1 +>nc_s2 : (b: number) => number +>c1.nc_s1 : number +>c1 : typeof c1 +>nc_s1 : number + } + static set nc_s3(value: number) { +>nc_s3 : number +>value : number + + c1.nc_s1 = c1.nc_s2(value); +>c1.nc_s1 = c1.nc_s2(value) : number +>c1.nc_s1 : number +>c1 : typeof c1 +>nc_s1 : number +>c1.nc_s2(value) : number +>c1.nc_s2 : (b: number) => number +>c1 : typeof c1 +>nc_s2 : (b: number) => number +>value : number + } + + // p1 is property of c1 + public a_p1: number; +>a_p1 : number + + // sum with property + public a_p2(b: number) { +>a_p2 : (b: number) => number +>b : number + + return this.a_p1 + b; +>this.a_p1 + b : number +>this.a_p1 : number +>this : c1 +>a_p1 : number +>b : number + } + // getter property + public get a_p3() { +>a_p3 : number + + return this.a_p2(this.a_p1); +>this.a_p2(this.a_p1) : number +>this.a_p2 : (b: number) => number +>this : c1 +>a_p2 : (b: number) => number +>this.a_p1 : number +>this : c1 +>a_p1 : number + } + // setter property + public set a_p3(value: number) { +>a_p3 : number +>value : number + + this.a_p1 = this.a_p2(value); +>this.a_p1 = this.a_p2(value) : number +>this.a_p1 : number +>this : c1 +>a_p1 : number +>this.a_p2(value) : number +>this.a_p2 : (b: number) => number +>this : c1 +>a_p2 : (b: number) => number +>value : number + } + // pp1 is property of c1 + private a_pp1: number; +>a_pp1 : number + + // sum with property + private a_pp2(b: number) { +>a_pp2 : (b: number) => number +>b : number + + return this.a_p1 + b; +>this.a_p1 + b : number +>this.a_p1 : number +>this : c1 +>a_p1 : number +>b : number + } + // getter property + private get a_pp3() { +>a_pp3 : number + + return this.a_pp2(this.a_pp1); +>this.a_pp2(this.a_pp1) : number +>this.a_pp2 : (b: number) => number +>this : c1 +>a_pp2 : (b: number) => number +>this.a_pp1 : number +>this : c1 +>a_pp1 : number + } + // setter property + private set a_pp3(value: number) { +>a_pp3 : number +>value : number + + this.a_pp1 = this.a_pp2(value); +>this.a_pp1 = this.a_pp2(value) : number +>this.a_pp1 : number +>this : c1 +>a_pp1 : number +>this.a_pp2(value) : number +>this.a_pp2 : (b: number) => number +>this : c1 +>a_pp2 : (b: number) => number +>value : number + } + + // s1 is static property of c1 + static a_s1: number; +>a_s1 : number + + // static sum with property + static a_s2(b: number) { +>a_s2 : (b: number) => number +>b : number + + return c1.a_s1 + b; +>c1.a_s1 + b : number +>c1.a_s1 : number +>c1 : typeof c1 +>a_s1 : number +>b : number + } + // static getter property + static get a_s3() { +>a_s3 : number + + return c1.s2(c1.s1); +>c1.s2(c1.s1) : number +>c1.s2 : (b: number) => number +>c1 : typeof c1 +>s2 : (b: number) => number +>c1.s1 : number +>c1 : typeof c1 +>s1 : number + } + + // setter property + static set a_s3(value: number) { +>a_s3 : number +>value : number + + c1.a_s1 = c1.a_s2(value); +>c1.a_s1 = c1.a_s2(value) : number +>c1.a_s1 : number +>c1 : typeof c1 +>a_s1 : number +>c1.a_s2(value) : number +>c1.a_s2 : (b: number) => number +>c1 : typeof c1 +>a_s2 : (b: number) => number +>value : number + } + + /** p1 is property of c1 */ + public b_p1: number; +>b_p1 : number + + /** sum with property */ + public b_p2(b: number) { +>b_p2 : (b: number) => number +>b : number + + return this.b_p1 + b; +>this.b_p1 + b : number +>this.b_p1 : number +>this : c1 +>b_p1 : number +>b : number + } + /** getter property */ + public get b_p3() { +>b_p3 : number + + return this.b_p2(this.b_p1); +>this.b_p2(this.b_p1) : number +>this.b_p2 : (b: number) => number +>this : c1 +>b_p2 : (b: number) => number +>this.b_p1 : number +>this : c1 +>b_p1 : number + } + /** setter property */ + public set b_p3(value: number) { +>b_p3 : number +>value : number + + this.b_p1 = this.b_p2(value); +>this.b_p1 = this.b_p2(value) : number +>this.b_p1 : number +>this : c1 +>b_p1 : number +>this.b_p2(value) : number +>this.b_p2 : (b: number) => number +>this : c1 +>b_p2 : (b: number) => number +>value : number + } + /** pp1 is property of c1 */ + private b_pp1: number; +>b_pp1 : number + + /** sum with property */ + private b_pp2(b: number) { +>b_pp2 : (b: number) => number +>b : number + + return this.b_p1 + b; +>this.b_p1 + b : number +>this.b_p1 : number +>this : c1 +>b_p1 : number +>b : number + } + /** getter property */ + private get b_pp3() { +>b_pp3 : number + + return this.b_pp2(this.b_pp1); +>this.b_pp2(this.b_pp1) : number +>this.b_pp2 : (b: number) => number +>this : c1 +>b_pp2 : (b: number) => number +>this.b_pp1 : number +>this : c1 +>b_pp1 : number + } + /** setter property */ + private set b_pp3(value: number) { +>b_pp3 : number +>value : number + + this.b_pp1 = this.b_pp2(value); +>this.b_pp1 = this.b_pp2(value) : number +>this.b_pp1 : number +>this : c1 +>b_pp1 : number +>this.b_pp2(value) : number +>this.b_pp2 : (b: number) => number +>this : c1 +>b_pp2 : (b: number) => number +>value : number + } + + /** s1 is static property of c1 */ + static b_s1: number; +>b_s1 : number + + /** static sum with property */ + static b_s2(b: number) { +>b_s2 : (b: number) => number +>b : number + + return c1.b_s1 + b; +>c1.b_s1 + b : number +>c1.b_s1 : number +>c1 : typeof c1 +>b_s1 : number +>b : number + } + /** static getter property + */ + static get b_s3() { +>b_s3 : number + + return c1.s2(c1.s1); +>c1.s2(c1.s1) : number +>c1.s2 : (b: number) => number +>c1 : typeof c1 +>s2 : (b: number) => number +>c1.s1 : number +>c1 : typeof c1 +>s1 : number + } + + /** setter property + */ + static set b_s3(value: number) { +>b_s3 : number +>value : number + + /** setter */ + c1.b_s1 = c1.b_s2(value); +>c1.b_s1 = c1.b_s2(value) : number +>c1.b_s1 : number +>c1 : typeof c1 +>b_s1 : number +>c1.b_s2(value) : number +>c1.b_s2 : (b: number) => number +>c1 : typeof c1 +>b_s2 : (b: number) => number +>value : number + } +} +var i1 = new c1(); +>i1 : c1 +>new c1() : c1 +>c1 : typeof c1 + +var i1_p = i1.p1; +>i1_p : number +>i1.p1 : number +>i1 : c1 +>p1 : number + +var i1_f = i1.p2; +>i1_f : (b: number) => number +>i1.p2 : (b: number) => number +>i1 : c1 +>p2 : (b: number) => number + +var i1_r = i1.p2(20); +>i1_r : number +>i1.p2(20) : number +>i1.p2 : (b: number) => number +>i1 : c1 +>p2 : (b: number) => number + +var i1_prop = i1.p3; +>i1_prop : number +>i1.p3 : number +>i1 : c1 +>p3 : number + +i1.p3 = i1_prop; +>i1.p3 = i1_prop : number +>i1.p3 : number +>i1 : c1 +>p3 : number +>i1_prop : number + +var i1_nc_p = i1.nc_p1; +>i1_nc_p : number +>i1.nc_p1 : number +>i1 : c1 +>nc_p1 : number + +var i1_ncf = i1.nc_p2; +>i1_ncf : (b: number) => number +>i1.nc_p2 : (b: number) => number +>i1 : c1 +>nc_p2 : (b: number) => number + +var i1_ncr = i1.nc_p2(20); +>i1_ncr : number +>i1.nc_p2(20) : number +>i1.nc_p2 : (b: number) => number +>i1 : c1 +>nc_p2 : (b: number) => number + +var i1_ncprop = i1.nc_p3; +>i1_ncprop : number +>i1.nc_p3 : number +>i1 : c1 +>nc_p3 : number + +i1.nc_p3 = i1_ncprop; +>i1.nc_p3 = i1_ncprop : number +>i1.nc_p3 : number +>i1 : c1 +>nc_p3 : number +>i1_ncprop : number + +var i1_s_p = c1.s1; +>i1_s_p : number +>c1.s1 : number +>c1 : typeof c1 +>s1 : number + +var i1_s_f = c1.s2; +>i1_s_f : (b: number) => number +>c1.s2 : (b: number) => number +>c1 : typeof c1 +>s2 : (b: number) => number + +var i1_s_r = c1.s2(20); +>i1_s_r : number +>c1.s2(20) : number +>c1.s2 : (b: number) => number +>c1 : typeof c1 +>s2 : (b: number) => number + +var i1_s_prop = c1.s3; +>i1_s_prop : number +>c1.s3 : number +>c1 : typeof c1 +>s3 : number + +c1.s3 = i1_s_prop; +>c1.s3 = i1_s_prop : number +>c1.s3 : number +>c1 : typeof c1 +>s3 : number +>i1_s_prop : number + +var i1_s_nc_p = c1.nc_s1; +>i1_s_nc_p : number +>c1.nc_s1 : number +>c1 : typeof c1 +>nc_s1 : number + +var i1_s_ncf = c1.nc_s2; +>i1_s_ncf : (b: number) => number +>c1.nc_s2 : (b: number) => number +>c1 : typeof c1 +>nc_s2 : (b: number) => number + +var i1_s_ncr = c1.nc_s2(20); +>i1_s_ncr : number +>c1.nc_s2(20) : number +>c1.nc_s2 : (b: number) => number +>c1 : typeof c1 +>nc_s2 : (b: number) => number + +var i1_s_ncprop = c1.nc_s3; +>i1_s_ncprop : number +>c1.nc_s3 : number +>c1 : typeof c1 +>nc_s3 : number + +c1.nc_s3 = i1_s_ncprop; +>c1.nc_s3 = i1_s_ncprop : number +>c1.nc_s3 : number +>c1 : typeof c1 +>nc_s3 : number +>i1_s_ncprop : number + +var i1_c = c1; +>i1_c : typeof c1 +>c1 : typeof c1 + +class cProperties { +>cProperties : cProperties + + private val: number; +>val : number + + /** getter only property*/ + public get p1() { +>p1 : number + + return this.val; +>this.val : number +>this : cProperties +>val : number + } + public get nc_p1() { +>nc_p1 : number + + return this.val; +>this.val : number +>this : cProperties +>val : number + } + /**setter only property*/ + public set p2(value: number) { +>p2 : number +>value : number + + this.val = value; +>this.val = value : number +>this.val : number +>this : cProperties +>val : number +>value : number + } + public set nc_p2(value: number) { +>nc_p2 : number +>value : number + + this.val = value; +>this.val = value : number +>this.val : number +>this : cProperties +>val : number +>value : number + } +} +var cProperties_i = new cProperties(); +>cProperties_i : cProperties +>new cProperties() : cProperties +>cProperties : typeof cProperties + +cProperties_i.p2 = cProperties_i.p1; +>cProperties_i.p2 = cProperties_i.p1 : number +>cProperties_i.p2 : number +>cProperties_i : cProperties +>p2 : number +>cProperties_i.p1 : number +>cProperties_i : cProperties +>p1 : number + +cProperties_i.nc_p2 = cProperties_i.nc_p1; +>cProperties_i.nc_p2 = cProperties_i.nc_p1 : number +>cProperties_i.nc_p2 : number +>cProperties_i : cProperties +>nc_p2 : number +>cProperties_i.nc_p1 : number +>cProperties_i : cProperties +>nc_p1 : number + diff --git a/tests/baselines/reference/commentsCommentParsing.types b/tests/baselines/reference/commentsCommentParsing.types new file mode 100644 index 00000000000..a9194f9a63a --- /dev/null +++ b/tests/baselines/reference/commentsCommentParsing.types @@ -0,0 +1,255 @@ +=== tests/cases/compiler/commentsCommentParsing.ts === + +/// This is simple /// comments +function simple() { +>simple : () => void +} + +simple(); +>simple() : void +>simple : () => void + +/// multiLine /// Comments +/// This is example of multiline /// comments +/// Another multiLine +function multiLine() { +>multiLine : () => void +} +multiLine(); +>multiLine() : void +>multiLine : () => void + +/** this is eg of single line jsdoc style comment */ +function jsDocSingleLine() { +>jsDocSingleLine : () => void +} +jsDocSingleLine(); +>jsDocSingleLine() : void +>jsDocSingleLine : () => void + + +/** this is multiple line jsdoc stule comment +*New line1 +*New Line2*/ +function jsDocMultiLine() { +>jsDocMultiLine : () => void +} +jsDocMultiLine(); +>jsDocMultiLine() : void +>jsDocMultiLine : () => void + +/** this is multiple line jsdoc stule comment +*New line1 +*New Line2*/ +/** Shoul mege this line as well +* and this too*/ /** Another this one too*/ +function jsDocMultiLineMerge() { +>jsDocMultiLineMerge : () => void +} +jsDocMultiLineMerge(); +>jsDocMultiLineMerge() : void +>jsDocMultiLineMerge : () => void + + +/// Triple slash comment +/** jsdoc comment */ +function jsDocMixedComments1() { +>jsDocMixedComments1 : () => void +} +jsDocMixedComments1(); +>jsDocMixedComments1() : void +>jsDocMixedComments1 : () => void + +/// Triple slash comment +/** jsdoc comment */ /*** another jsDocComment*/ +function jsDocMixedComments2() { +>jsDocMixedComments2 : () => void +} +jsDocMixedComments2(); +>jsDocMixedComments2() : void +>jsDocMixedComments2 : () => void + +/** jsdoc comment */ /*** another jsDocComment*/ +/// Triple slash comment +function jsDocMixedComments3() { +>jsDocMixedComments3 : () => void +} +jsDocMixedComments3(); +>jsDocMixedComments3() : void +>jsDocMixedComments3 : () => void + +/** jsdoc comment */ /*** another jsDocComment*/ +/// Triple slash comment +/// Triple slash comment 2 +function jsDocMixedComments4() { +>jsDocMixedComments4 : () => void +} +jsDocMixedComments4(); +>jsDocMixedComments4() : void +>jsDocMixedComments4 : () => void + +/// Triple slash comment 1 +/** jsdoc comment */ /*** another jsDocComment*/ +/// Triple slash comment +/// Triple slash comment 2 +function jsDocMixedComments5() { +>jsDocMixedComments5 : () => void +} +jsDocMixedComments5(); +>jsDocMixedComments5() : void +>jsDocMixedComments5 : () => void + +/*** another jsDocComment*/ +/// Triple slash comment 1 +/// Triple slash comment +/// Triple slash comment 2 +/** jsdoc comment */ +function jsDocMixedComments6() { +>jsDocMixedComments6 : () => void +} +jsDocMixedComments6(); +>jsDocMixedComments6() : void +>jsDocMixedComments6 : () => void + +// This shoulnot be help comment +function noHelpComment1() { +>noHelpComment1 : () => void +} +noHelpComment1(); +>noHelpComment1() : void +>noHelpComment1 : () => void + +/* This shoulnot be help comment */ +function noHelpComment2() { +>noHelpComment2 : () => void +} +noHelpComment2(); +>noHelpComment2() : void +>noHelpComment2 : () => void + +function noHelpComment3() { +>noHelpComment3 : () => void +} +noHelpComment3(); +>noHelpComment3() : void +>noHelpComment3 : () => void + +/** Adds two integers and returns the result + * @param {number} a first number + * @param b second number + */ +function sum(a: number, b: number) { +>sum : (a: number, b: number) => number +>a : number +>b : number + + return a + b; +>a + b : number +>a : number +>b : number +} +sum(10, 20); +>sum(10, 20) : number +>sum : (a: number, b: number) => number + +/** This is multiplication function*/ +/** @param */ +/** @param a first number*/ +/** @param b */ +/** @param c { + @param d @anotherTag*/ +/** @param e LastParam @anotherTag*/ +function multiply(a: number, b: number, c?: number, d?, e?) { +>multiply : (a: number, b: number, c?: number, d?: any, e?: any) => void +>a : number +>b : number +>c : number +>d : any +>e : any +} +/** fn f1 with number +* @param { string} b about b +*/ +function f1(a: number); +>f1 : { (a: number): any; (b: string): any; } +>a : number + +function f1(b: string); +>f1 : { (a: number): any; (b: string): any; } +>b : string + +/**@param opt optional parameter*/ +function f1(aOrb, opt?) { +>f1 : { (a: number): any; (b: string): any; } +>aOrb : any +>opt : any + + return aOrb; +>aOrb : any +} +/** This is subtract function +@param { a +*@param { number | } b this is about b +@param { { () => string; } } c this is optional param c +@param { { () => string; } d this is optional param d +@param { { () => string; } } e this is optional param e +@param { { { () => string; } } f this is optional param f +*/ +function subtract(a: number, b: number, c?: () => string, d?: () => string, e?: () => string, f?: () => string) { +>subtract : (a: number, b: number, c?: () => string, d?: () => string, e?: () => string, f?: () => string) => void +>a : number +>b : number +>c : () => string +>d : () => string +>e : () => string +>f : () => string +} +/** this is square function +@paramTag { number } a this is input number of paramTag +@param { number } a this is input number +@returnType { number } it is return type +*/ +function square(a: number) { +>square : (a: number) => number +>a : number + + return a * a; +>a * a : number +>a : number +>a : number +} +/** this is divide function +@param { number} a this is a +@paramTag { number } g this is optional param g +@param { number} b this is b +*/ +function divide(a: number, b: number) { +>divide : (a: number, b: number) => void +>a : number +>b : number +} +/** this is jsdoc style function with param tag as well as inline parameter help +*@param a it is first parameter +*@param c it is third parameter +*/ +function jsDocParamTest(/** this is inline comment for a */a: number, /** this is inline comment for b*/ b: number, c: number, d: number) { +>jsDocParamTest : (a: number, b: number, c: number, d: number) => number +>a : number +>b : number +>c : number +>d : number + + return a + b + c + d; +>a + b + c + d : number +>a + b + c : number +>a + b : number +>a : number +>b : number +>c : number +>d : number +} + +/**/ +class NoQuickInfoClass { +>NoQuickInfoClass : NoQuickInfoClass +} diff --git a/tests/baselines/reference/commentsDottedModuleName.types b/tests/baselines/reference/commentsDottedModuleName.types new file mode 100644 index 00000000000..53195bfccfa --- /dev/null +++ b/tests/baselines/reference/commentsDottedModuleName.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/commentsDottedModuleName.ts === + +/** this is multi declare module*/ +export module outerModule.InnerModule { +>outerModule : typeof outerModule +>InnerModule : typeof InnerModule + + /// class b comment + export class b { +>b : b + } +} diff --git a/tests/baselines/reference/commentsEnums.types b/tests/baselines/reference/commentsEnums.types new file mode 100644 index 00000000000..639958f9c42 --- /dev/null +++ b/tests/baselines/reference/commentsEnums.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/commentsEnums.ts === + +/** Enum of colors*/ +enum Colors { +>Colors : Colors + + /** Fancy name for 'blue'*/ + Cornflower /* blue */, +>Cornflower : Colors + + /** Fancy name for 'pink'*/ + FancyPink +>FancyPink : Colors +} +var x = Colors.Cornflower; +>x : Colors +>Colors.Cornflower : Colors +>Colors : typeof Colors +>Cornflower : Colors + +x = Colors.FancyPink; +>x = Colors.FancyPink : Colors +>x : Colors +>Colors.FancyPink : Colors +>Colors : typeof Colors +>FancyPink : Colors + + diff --git a/tests/baselines/reference/commentsExternalModules.types b/tests/baselines/reference/commentsExternalModules.types new file mode 100644 index 00000000000..8f7e270d1b9 --- /dev/null +++ b/tests/baselines/reference/commentsExternalModules.types @@ -0,0 +1,155 @@ +=== tests/cases/compiler/commentsExternalModules_1.ts === +/**This is on import declaration*/ +import extMod = require("commentsExternalModules_0"); +>extMod : typeof "tests/cases/compiler/commentsExternalModules_0" + +extMod.m1.fooExport(); +>extMod.m1.fooExport() : number +>extMod.m1.fooExport : () => number +>extMod.m1 : typeof m1 +>extMod : typeof "tests/cases/compiler/commentsExternalModules_0" +>m1 : typeof m1 +>fooExport : () => number + +var newVar = new extMod.m1.m2.c(); +>newVar : c +>new extMod.m1.m2.c() : c +>extMod.m1.m2.c : typeof c +>extMod.m1.m2 : typeof m2 +>extMod.m1 : typeof m1 +>extMod : typeof "tests/cases/compiler/commentsExternalModules_0" +>m1 : typeof m1 +>m2 : typeof m2 +>c : typeof c + +extMod.m4.fooExport(); +>extMod.m4.fooExport() : number +>extMod.m4.fooExport : () => number +>extMod.m4 : typeof m4 +>extMod : typeof "tests/cases/compiler/commentsExternalModules_0" +>m4 : typeof m4 +>fooExport : () => number + +var newVar2 = new extMod.m4.m2.c(); +>newVar2 : c +>new extMod.m4.m2.c() : c +>extMod.m4.m2.c : typeof c +>extMod.m4.m2 : typeof m2 +>extMod.m4 : typeof m4 +>extMod : typeof "tests/cases/compiler/commentsExternalModules_0" +>m4 : typeof m4 +>m2 : typeof m2 +>c : typeof c + +=== tests/cases/compiler/commentsExternalModules_0.ts === + +/** Module comment*/ +export module m1 { +>m1 : typeof m1 + + /** b's comment*/ + export var b: number; +>b : number + + /** foo's comment*/ + function foo() { +>foo : () => number + + return b; +>b : number + } + /** m2 comments*/ + export module m2 { +>m2 : typeof m2 + + /** class comment;*/ + export class c { +>c : c + + }; + /** i*/ + export var i = new c(); +>i : c +>new c() : c +>c : typeof c + } + /** exported function*/ + export function fooExport() { +>fooExport : () => number + + return foo(); +>foo() : number +>foo : () => number + } +} +m1.fooExport(); +>m1.fooExport() : number +>m1.fooExport : () => number +>m1 : typeof m1 +>fooExport : () => number + +var myvar = new m1.m2.c(); +>myvar : c +>new m1.m2.c() : c +>m1.m2.c : typeof c +>m1.m2 : typeof m2 +>m1 : typeof m1 +>m2 : typeof m2 +>c : typeof c + +/** Module comment */ +export module m4 { +>m4 : typeof m4 + + /** b's comment */ + export var b: number; +>b : number + + /** foo's comment + */ + function foo() { +>foo : () => number + + return b; +>b : number + } + /** m2 comments + */ + export module m2 { +>m2 : typeof m2 + + /** class comment; */ + export class c { +>c : c + + }; + /** i */ + export var i = new c(); +>i : c +>new c() : c +>c : typeof c + } + /** exported function */ + export function fooExport() { +>fooExport : () => number + + return foo(); +>foo() : number +>foo : () => number + } +} +m4.fooExport(); +>m4.fooExport() : number +>m4.fooExport : () => number +>m4 : typeof m4 +>fooExport : () => number + +var myvar2 = new m4.m2.c(); +>myvar2 : c +>new m4.m2.c() : c +>m4.m2.c : typeof c +>m4.m2 : typeof m2 +>m4 : typeof m4 +>m2 : typeof m2 +>c : typeof c + diff --git a/tests/baselines/reference/commentsFunction.types b/tests/baselines/reference/commentsFunction.types new file mode 100644 index 00000000000..ce8a07bccef --- /dev/null +++ b/tests/baselines/reference/commentsFunction.types @@ -0,0 +1,69 @@ +=== tests/cases/compiler/commentsFunction.ts === + +/** This comment should appear for foo*/ +function foo() { +>foo : () => void +} +foo(); +>foo() : void +>foo : () => void + +/** This is comment for function signature*/ +function fooWithParameters(/** this is comment about a*/a: string, +>fooWithParameters : (a: string, b: number) => void +>a : string + + /** this is comment for b*/ + b: number) { +>b : number + + var d = a; +>d : string +>a : string +} +fooWithParameters("a", 10); +>fooWithParameters("a", 10) : void +>fooWithParameters : (a: string, b: number) => void + +/** fooFunc + * comment + */ +var fooFunc = function FooFunctionValue(/** fooFunctionValue param */ b: string) { +>fooFunc : (b: string) => string +>function FooFunctionValue(/** fooFunctionValue param */ b: string) { + return b; +} : (b: string) => string +>FooFunctionValue : (b: string) => string +>b : string + + return b; +>b : string +} + +/// lamdaFoo var comment +var lambdaFoo = /** this is lambda comment*/ (/**param a*/a: number, /**param b*/b: number) => a + b; +>lambdaFoo : (a: number, b: number) => number +>(/**param a*/a: number, /**param b*/b: number) => a + b : (a: number, b: number) => number +>a : number +>b : number +>a + b : number +>a : number +>b : number + +var lambddaNoVarComment = /** this is lambda multiplication*/ (/**param a*/a: number, /**param b*/b: number) => a * b; +>lambddaNoVarComment : (a: number, b: number) => number +>(/**param a*/a: number, /**param b*/b: number) => a * b : (a: number, b: number) => number +>a : number +>b : number +>a * b : number +>a : number +>b : number + +lambdaFoo(10, 20); +>lambdaFoo(10, 20) : number +>lambdaFoo : (a: number, b: number) => number + +lambddaNoVarComment(10, 20); +>lambddaNoVarComment(10, 20) : number +>lambddaNoVarComment : (a: number, b: number) => number + diff --git a/tests/baselines/reference/commentsInheritance.types b/tests/baselines/reference/commentsInheritance.types new file mode 100644 index 00000000000..5fc9a564cf1 --- /dev/null +++ b/tests/baselines/reference/commentsInheritance.types @@ -0,0 +1,319 @@ +=== tests/cases/compiler/commentsInheritance.ts === + +/** i1 is interface with properties*/ +interface i1 { +>i1 : i1 + + /** i1_p1*/ + i1_p1: number; +>i1_p1 : number + + /** i1_f1*/ + i1_f1(): void; +>i1_f1 : () => void + + /** i1_l1*/ + i1_l1: () => void; +>i1_l1 : () => void + + // il_nc_p1 + i1_nc_p1: number; +>i1_nc_p1 : number + + i1_nc_f1(): void; +>i1_nc_f1 : () => void + + i1_nc_l1: () => void; +>i1_nc_l1 : () => void + + p1: number; +>p1 : number + + f1(): void; +>f1 : () => void + + l1: () => void; +>l1 : () => void + + nc_p1: number; +>nc_p1 : number + + nc_f1(): void; +>nc_f1 : () => void + + nc_l1: () => void; +>nc_l1 : () => void +} +class c1 implements i1 { +>c1 : c1 +>i1 : i1 + + public i1_p1: number; +>i1_p1 : number + + // i1_f1 + public i1_f1() { +>i1_f1 : () => void + } + public i1_l1: () => void; +>i1_l1 : () => void + + public i1_nc_p1: number; +>i1_nc_p1 : number + + public i1_nc_f1() { +>i1_nc_f1 : () => void + } + public i1_nc_l1: () => void; +>i1_nc_l1 : () => void + + /** c1_p1*/ + public p1: number; +>p1 : number + + /** c1_f1*/ + public f1() { +>f1 : () => void + } + /** c1_l1*/ + public l1: () => void; +>l1 : () => void + + /** c1_nc_p1*/ + public nc_p1: number; +>nc_p1 : number + + /** c1_nc_f1*/ + public nc_f1() { +>nc_f1 : () => void + } + /** c1_nc_l1*/ + public nc_l1: () => void; +>nc_l1 : () => void +} +var i1_i: i1; +>i1_i : i1 +>i1 : i1 + +var c1_i = new c1(); +>c1_i : c1 +>new c1() : c1 +>c1 : typeof c1 + +// assign to interface +i1_i = c1_i; +>i1_i = c1_i : c1 +>i1_i : i1 +>c1_i : c1 + +class c2 { +>c2 : c2 + + /** c2 c2_p1*/ + public c2_p1: number; +>c2_p1 : number + + /** c2 c2_f1*/ + public c2_f1() { +>c2_f1 : () => void + } + /** c2 c2_prop*/ + public get c2_prop() { +>c2_prop : number + + return 10; + } + public c2_nc_p1: number; +>c2_nc_p1 : number + + public c2_nc_f1() { +>c2_nc_f1 : () => void + } + public get c2_nc_prop() { +>c2_nc_prop : number + + return 10; + } + /** c2 p1*/ + public p1: number; +>p1 : number + + /** c2 f1*/ + public f1() { +>f1 : () => void + } + /** c2 prop*/ + public get prop() { +>prop : number + + return 10; + } + public nc_p1: number; +>nc_p1 : number + + public nc_f1() { +>nc_f1 : () => void + } + public get nc_prop() { +>nc_prop : number + + return 10; + } + /** c2 constructor*/ + constructor(a: number) { +>a : number + + this.c2_p1 = a; +>this.c2_p1 = a : number +>this.c2_p1 : number +>this : c2 +>c2_p1 : number +>a : number + } +} +class c3 extends c2 { +>c3 : c3 +>c2 : c2 + + constructor() { + super(10); +>super(10) : void + } + /** c3 p1*/ + public p1: number; +>p1 : number + + /** c3 f1*/ + public f1() { +>f1 : () => void + } + /** c3 prop*/ + public get prop() { +>prop : number + + return 10; + } + public nc_p1: number; +>nc_p1 : number + + public nc_f1() { +>nc_f1 : () => void + } + public get nc_prop() { +>nc_prop : number + + return 10; + } +} +var c2_i = new c2(10); +>c2_i : c2 +>new c2(10) : c2 +>c2 : typeof c2 + +var c3_i = new c3(); +>c3_i : c3 +>new c3() : c3 +>c3 : typeof c3 + +// assign +c2_i = c3_i; +>c2_i = c3_i : c3 +>c2_i : c2 +>c3_i : c3 + +class c4 extends c2 { +>c4 : c4 +>c2 : c2 +} +var c4_i = new c4(10); +>c4_i : c4 +>new c4(10) : c4 +>c4 : typeof c4 + +interface i2 { +>i2 : i2 + + /** i2_p1*/ + i2_p1: number; +>i2_p1 : number + + /** i2_f1*/ + i2_f1(): void; +>i2_f1 : () => void + + /** i2_l1*/ + i2_l1: () => void; +>i2_l1 : () => void + + // i2_nc_p1 + i2_nc_p1: number; +>i2_nc_p1 : number + + i2_nc_f1(): void; +>i2_nc_f1 : () => void + + i2_nc_l1: () => void; +>i2_nc_l1 : () => void + + /** i2 p1*/ + p1: number; +>p1 : number + + /** i2 f1*/ + f1(): void; +>f1 : () => void + + /** i2 l1*/ + l1: () => void; +>l1 : () => void + + nc_p1: number; +>nc_p1 : number + + nc_f1(): void; +>nc_f1 : () => void + + nc_l1: () => void; +>nc_l1 : () => void +} +interface i3 extends i2 { +>i3 : i3 +>i2 : i2 + + /** i3 p1 */ + p1: number; +>p1 : number + + /** + * i3 f1 + */ + f1(): void; +>f1 : () => void + + /** i3 l1*/ + l1: () => void; +>l1 : () => void + + nc_p1: number; +>nc_p1 : number + + nc_f1(): void; +>nc_f1 : () => void + + nc_l1: () => void; +>nc_l1 : () => void +} +var i2_i: i2; +>i2_i : i2 +>i2 : i2 + +var i3_i: i3; +>i3_i : i3 +>i3 : i3 + +// assign to interface +i2_i = i3_i; +>i2_i = i3_i : i3 +>i2_i : i2 +>i3_i : i3 + diff --git a/tests/baselines/reference/commentsInterface.types b/tests/baselines/reference/commentsInterface.types new file mode 100644 index 00000000000..74ae683cff2 --- /dev/null +++ b/tests/baselines/reference/commentsInterface.types @@ -0,0 +1,276 @@ +=== tests/cases/compiler/commentsInterface.ts === +/** this is interface 1*/ +interface i1 { +>i1 : i1 +} +var i1_i: i1; +>i1_i : i1 +>i1 : i1 + +interface nc_i1 { +>nc_i1 : nc_i1 +} +var nc_i1_i: nc_i1; +>nc_i1_i : nc_i1 +>nc_i1 : nc_i1 + +/** this is interface 2 with memebers*/ +interface i2 { +>i2 : i2 + + /** this is x*/ + x: number; +>x : number + + /** this is foo*/ + foo: (/**param help*/b: number) => string; +>foo : (b: number) => string +>b : number + + /** this is indexer*/ + [/**string param*/i: string]: any; +>i : string + + /**new method*/ + new (/** param*/i: i1); +>i : i1 +>i1 : i1 + + nc_x: number; +>nc_x : number + + nc_foo: (b: number) => string; +>nc_foo : (b: number) => string +>b : number + + [i: number]: number; +>i : number + + /** this is call signature*/ + (/**paramhelp a*/a: number,/**paramhelp b*/ b: number) : number; +>a : number +>b : number + + /** this is fnfoo*/ + fnfoo(/**param help*/b: number): string; +>fnfoo : (b: number) => string +>b : number + + nc_fnfoo(b: number): string; +>nc_fnfoo : (b: number) => string +>b : number + + // nc_y + nc_y: number; +>nc_y : number +} +var i2_i: i2; +>i2_i : i2 +>i2 : i2 + +var i2_i_x = i2_i.x; +>i2_i_x : number +>i2_i.x : number +>i2_i : i2 +>x : number + +var i2_i_foo = i2_i.foo; +>i2_i_foo : (b: number) => string +>i2_i.foo : (b: number) => string +>i2_i : i2 +>foo : (b: number) => string + +var i2_i_foo_r = i2_i.foo(30); +>i2_i_foo_r : string +>i2_i.foo(30) : string +>i2_i.foo : (b: number) => string +>i2_i : i2 +>foo : (b: number) => string + +var i2_i_i2_si = i2_i["hello"]; +>i2_i_i2_si : any +>i2_i["hello"] : any +>i2_i : i2 + +var i2_i_i2_ii = i2_i[30]; +>i2_i_i2_ii : number +>i2_i[30] : number +>i2_i : i2 + +var i2_i_n = new i2_i(i1_i); +>i2_i_n : any +>new i2_i(i1_i) : any +>i2_i : i2 +>i1_i : i1 + +var i2_i_nc_x = i2_i.nc_x; +>i2_i_nc_x : number +>i2_i.nc_x : number +>i2_i : i2 +>nc_x : number + +var i2_i_nc_foo = i2_i.nc_foo; +>i2_i_nc_foo : (b: number) => string +>i2_i.nc_foo : (b: number) => string +>i2_i : i2 +>nc_foo : (b: number) => string + +var i2_i_nc_foo_r = i2_i.nc_foo(30); +>i2_i_nc_foo_r : string +>i2_i.nc_foo(30) : string +>i2_i.nc_foo : (b: number) => string +>i2_i : i2 +>nc_foo : (b: number) => string + +var i2_i_r = i2_i(10, 20); +>i2_i_r : number +>i2_i(10, 20) : number +>i2_i : i2 + +var i2_i_fnfoo = i2_i.fnfoo; +>i2_i_fnfoo : (b: number) => string +>i2_i.fnfoo : (b: number) => string +>i2_i : i2 +>fnfoo : (b: number) => string + +var i2_i_fnfoo_r = i2_i.fnfoo(10); +>i2_i_fnfoo_r : string +>i2_i.fnfoo(10) : string +>i2_i.fnfoo : (b: number) => string +>i2_i : i2 +>fnfoo : (b: number) => string + +var i2_i_nc_fnfoo = i2_i.nc_fnfoo; +>i2_i_nc_fnfoo : (b: number) => string +>i2_i.nc_fnfoo : (b: number) => string +>i2_i : i2 +>nc_fnfoo : (b: number) => string + +var i2_i_nc_fnfoo_r = i2_i.nc_fnfoo(10); +>i2_i_nc_fnfoo_r : string +>i2_i.nc_fnfoo(10) : string +>i2_i.nc_fnfoo : (b: number) => string +>i2_i : i2 +>nc_fnfoo : (b: number) => string + +interface i3 { +>i3 : i3 + + /** Comment i3 x*/ + x: number; +>x : number + + /** Function i3 f*/ + f(/**number parameter*/a: number): string; +>f : (a: number) => string +>a : number + + /** i3 l*/ + l: (/**comment i3 l b*/b: number) => string; +>l : (b: number) => string +>b : number + + nc_x: number; +>nc_x : number + + nc_f(a: number): string; +>nc_f : (a: number) => string +>a : number + + nc_l: (b: number) => string; +>nc_l : (b: number) => string +>b : number +} +var i3_i: i3; +>i3_i : i3 +>i3 : i3 + +i3_i = { +>i3_i = { + f: /**own f*/ (/**i3_i a*/a: number) => "Hello" + a, + l: this.f, + /** own x*/ + x: this.f(10), + nc_x: this.l(this.x), + nc_f: this.f, + nc_l: this.l +} : { f: (a: number) => string; l: any; x: any; nc_x: any; nc_f: any; nc_l: any; } +>i3_i : i3 +>{ + f: /**own f*/ (/**i3_i a*/a: number) => "Hello" + a, + l: this.f, + /** own x*/ + x: this.f(10), + nc_x: this.l(this.x), + nc_f: this.f, + nc_l: this.l +} : { f: (a: number) => string; l: any; x: any; nc_x: any; nc_f: any; nc_l: any; } + + f: /**own f*/ (/**i3_i a*/a: number) => "Hello" + a, +>f : (a: number) => string +>(/**i3_i a*/a: number) => "Hello" + a : (a: number) => string +>a : number +>"Hello" + a : string +>a : number + + l: this.f, +>l : any +>this.f : any +>this : any +>f : any + + /** own x*/ + x: this.f(10), +>x : any +>this.f(10) : any +>this.f : any +>this : any +>f : any + + nc_x: this.l(this.x), +>nc_x : any +>this.l(this.x) : any +>this.l : any +>this : any +>l : any +>this.x : any +>this : any +>x : any + + nc_f: this.f, +>nc_f : any +>this.f : any +>this : any +>f : any + + nc_l: this.l +>nc_l : any +>this.l : any +>this : any +>l : any + +}; +i3_i.f(10); +>i3_i.f(10) : string +>i3_i.f : (a: number) => string +>i3_i : i3 +>f : (a: number) => string + +i3_i.l(10); +>i3_i.l(10) : string +>i3_i.l : (b: number) => string +>i3_i : i3 +>l : (b: number) => string + +i3_i.nc_f(10); +>i3_i.nc_f(10) : string +>i3_i.nc_f : (a: number) => string +>i3_i : i3 +>nc_f : (a: number) => string + +i3_i.nc_l(10); +>i3_i.nc_l(10) : string +>i3_i.nc_l : (b: number) => string +>i3_i : i3 +>nc_l : (b: number) => string + diff --git a/tests/baselines/reference/commentsModules.types b/tests/baselines/reference/commentsModules.types new file mode 100644 index 00000000000..053e2e64256 --- /dev/null +++ b/tests/baselines/reference/commentsModules.types @@ -0,0 +1,226 @@ +=== tests/cases/compiler/commentsModules.ts === +/** Module comment*/ +module m1 { +>m1 : typeof m1 + + /** b's comment*/ + export var b: number; +>b : number + + /** foo's comment*/ + function foo() { +>foo : () => number + + return b; +>b : number + } + /** m2 comments*/ + export module m2 { +>m2 : typeof m2 + + /** class comment;*/ + export class c { +>c : c + + }; + /** i*/ + export var i = new c(); +>i : c +>new c() : c +>c : typeof c + } + /** exported function*/ + export function fooExport() { +>fooExport : () => number + + return foo(); +>foo() : number +>foo : () => number + } + + // shouldn't appear + export function foo2Export(/**hm*/ a: string) { +>foo2Export : (a: string) => void +>a : string + } + + /** foo3Export + * comment + */ + export function foo3Export() { +>foo3Export : () => void + } + + /** foo4Export + * comment + */ + function foo4Export() { +>foo4Export : () => void + } +} +m1.fooExport(); +>m1.fooExport() : number +>m1.fooExport : () => number +>m1 : typeof m1 +>fooExport : () => number + +var myvar = new m1.m2.c(); +>myvar : c +>new m1.m2.c() : c +>m1.m2.c : typeof c +>m1.m2 : typeof m2 +>m1 : typeof m1 +>m2 : typeof m2 +>c : typeof c + +/** module comment of m2.m3*/ +module m2.m3 { +>m2 : typeof m2 +>m3 : typeof m3 + + /** Exported class comment*/ + export class c { +>c : c + } +} +new m2.m3.c(); +>new m2.m3.c() : c +>m2.m3.c : typeof c +>m2.m3 : typeof m3 +>m2 : typeof m2 +>m3 : typeof m3 +>c : typeof c + +/** module comment of m3.m4.m5*/ +module m3.m4.m5 { +>m3 : typeof m3 +>m4 : typeof m4 +>m5 : typeof m5 + + /** Exported class comment*/ + export class c { +>c : c + } +} +new m3.m4.m5.c(); +>new m3.m4.m5.c() : c +>m3.m4.m5.c : typeof c +>m3.m4.m5 : typeof m5 +>m3.m4 : typeof m4 +>m3 : typeof m3 +>m4 : typeof m4 +>m5 : typeof m5 +>c : typeof c + +/** module comment of m4.m5.m6*/ +module m4.m5.m6 { +>m4 : typeof m4 +>m5 : typeof m5 +>m6 : typeof m6 + + export module m7 { +>m7 : typeof m7 + + /** Exported class comment*/ + export class c { +>c : c + } + } +} +new m4.m5.m6.m7.c(); +>new m4.m5.m6.m7.c() : c +>m4.m5.m6.m7.c : typeof c +>m4.m5.m6.m7 : typeof m7 +>m4.m5.m6 : typeof m6 +>m4.m5 : typeof m5 +>m4 : typeof m4 +>m5 : typeof m5 +>m6 : typeof m6 +>m7 : typeof m7 +>c : typeof c + +/** module comment of m5.m6.m7*/ +module m5.m6.m7 { +>m5 : typeof m5 +>m6 : typeof m6 +>m7 : typeof m7 + + /** module m8 comment*/ + export module m8 { +>m8 : typeof m8 + + /** Exported class comment*/ + export class c { +>c : c + } + } +} +new m5.m6.m7.m8.c(); +>new m5.m6.m7.m8.c() : c +>m5.m6.m7.m8.c : typeof c +>m5.m6.m7.m8 : typeof m8 +>m5.m6.m7 : typeof m7 +>m5.m6 : typeof m6 +>m5 : typeof m5 +>m6 : typeof m6 +>m7 : typeof m7 +>m8 : typeof m8 +>c : typeof c + +module m6.m7 { +>m6 : typeof m6 +>m7 : typeof m7 + + export module m8 { +>m8 : typeof m8 + + /** Exported class comment*/ + export class c { +>c : c + } + } +} +new m6.m7.m8.c(); +>new m6.m7.m8.c() : c +>m6.m7.m8.c : typeof c +>m6.m7.m8 : typeof m8 +>m6.m7 : typeof m7 +>m6 : typeof m6 +>m7 : typeof m7 +>m8 : typeof m8 +>c : typeof c + +module m7.m8 { +>m7 : typeof m7 +>m8 : typeof m8 + + /** module m9 comment*/ + export module m9 { +>m9 : typeof m9 + + /** Exported class comment*/ + export class c { +>c : c + } + + /** class d */ + class d { +>d : d + } + + // class e + export class e { +>e : e + } + } +} +new m7.m8.m9.c(); +>new m7.m8.m9.c() : c +>m7.m8.m9.c : typeof c +>m7.m8.m9 : typeof m9 +>m7.m8 : typeof m8 +>m7 : typeof m7 +>m8 : typeof m8 +>m9 : typeof m9 +>c : typeof c + diff --git a/tests/baselines/reference/commentsMultiModuleMultiFile.types b/tests/baselines/reference/commentsMultiModuleMultiFile.types new file mode 100644 index 00000000000..cb3db3961f0 --- /dev/null +++ b/tests/baselines/reference/commentsMultiModuleMultiFile.types @@ -0,0 +1,62 @@ +=== tests/cases/compiler/commentsMultiModuleMultiFile_1.ts === +import m = require('commentsMultiModuleMultiFile_0'); +>m : typeof "tests/cases/compiler/commentsMultiModuleMultiFile_0" + +/** this is multi module 3 comment*/ +export module multiM { +>multiM : typeof multiM + + /** class d comment*/ + export class d { +>d : d + } + + /// class f comment + export class f { +>f : f + } +} +new multiM.d(); +>new multiM.d() : d +>multiM.d : typeof d +>multiM : typeof multiM +>d : typeof d + +=== tests/cases/compiler/commentsMultiModuleMultiFile_0.ts === + +/** this is multi declare module*/ +export module multiM { +>multiM : typeof multiM + + /// class b comment + export class b { +>b : b + } +} +/** thi is multi module 2*/ +export module multiM { +>multiM : typeof multiM + + /** class c comment*/ + export class c { +>c : c + } + + // class e comment + export class e { +>e : e + } +} + +new multiM.b(); +>new multiM.b() : b +>multiM.b : typeof b +>multiM : typeof multiM +>b : typeof b + +new multiM.c(); +>new multiM.c() : c +>multiM.c : typeof c +>multiM : typeof multiM +>c : typeof c + diff --git a/tests/baselines/reference/commentsMultiModuleSingleFile.types b/tests/baselines/reference/commentsMultiModuleSingleFile.types new file mode 100644 index 00000000000..c77d5e972e0 --- /dev/null +++ b/tests/baselines/reference/commentsMultiModuleSingleFile.types @@ -0,0 +1,43 @@ +=== tests/cases/compiler/commentsMultiModuleSingleFile.ts === + +/** this is multi declare module*/ +module multiM { +>multiM : typeof multiM + + /** class b*/ + export class b { +>b : b + } + + // class d + export class d { +>d : d + } +} + +/// this is multi module 2 +module multiM { +>multiM : typeof multiM + + /** class c comment*/ + export class c { +>c : c + } + + /// class e + export class e { +>e : e + } +} +new multiM.b(); +>new multiM.b() : b +>multiM.b : typeof b +>multiM : typeof multiM +>b : typeof b + +new multiM.c(); +>new multiM.c() : c +>multiM.c : typeof c +>multiM : typeof multiM +>c : typeof c + diff --git a/tests/baselines/reference/commentsOnReturnStatement1.types b/tests/baselines/reference/commentsOnReturnStatement1.types new file mode 100644 index 00000000000..0d447b6536f --- /dev/null +++ b/tests/baselines/reference/commentsOnReturnStatement1.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/commentsOnReturnStatement1.ts === +class DebugClass { +>DebugClass : DebugClass + + public static debugFunc() { +>debugFunc : () => boolean + + // Start Debugger Test Code + var i = 0; +>i : number + + // End Debugger Test Code + return true; + } +} diff --git a/tests/baselines/reference/commentsOnStaticMembers.types b/tests/baselines/reference/commentsOnStaticMembers.types new file mode 100644 index 00000000000..5c201c7709a --- /dev/null +++ b/tests/baselines/reference/commentsOnStaticMembers.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/commentsOnStaticMembers.ts === + +class test { +>test : test + + /** + * p1 comment appears in output + */ + public static p1: string = ""; +>p1 : string + + /** + * p2 comment does not appear in output + */ + public static p2: string; +>p2 : string + + /** + * p3 comment appears in output + */ + private static p3: string = ""; +>p3 : string + + /** + * p4 comment does not appear in output + */ + private static p4: string; +>p4 : string +} diff --git a/tests/baselines/reference/commentsOverloads.types b/tests/baselines/reference/commentsOverloads.types new file mode 100644 index 00000000000..9984c1b5b26 --- /dev/null +++ b/tests/baselines/reference/commentsOverloads.types @@ -0,0 +1,436 @@ +=== tests/cases/compiler/commentsOverloads.ts === +/** this is signature 1*/ +function f1(/**param a*/a: number): number; +>f1 : { (a: number): number; (b: string): number; } +>a : number + +function f1(b: string): number; +>f1 : { (a: number): number; (b: string): number; } +>b : string + +function f1(aOrb: any) { +>f1 : { (a: number): number; (b: string): number; } +>aOrb : any + + return 10; +} +f1("hello"); +>f1("hello") : number +>f1 : { (a: number): number; (b: string): number; } + +f1(10); +>f1(10) : number +>f1 : { (a: number): number; (b: string): number; } + +function f2(a: number): number; +>f2 : { (a: number): number; (b: string): number; } +>a : number + +/** this is signature 2*/ +function f2(b: string): number; +>f2 : { (a: number): number; (b: string): number; } +>b : string + +/** this is f2 var comment*/ +function f2(aOrb: any) { +>f2 : { (a: number): number; (b: string): number; } +>aOrb : any + + return 10; +} +f2("hello"); +>f2("hello") : number +>f2 : { (a: number): number; (b: string): number; } + +f2(10); +>f2(10) : number +>f2 : { (a: number): number; (b: string): number; } + +function f3(a: number): number; +>f3 : { (a: number): number; (b: string): number; } +>a : number + +function f3(b: string): number; +>f3 : { (a: number): number; (b: string): number; } +>b : string + +function f3(aOrb: any) { +>f3 : { (a: number): number; (b: string): number; } +>aOrb : any + + return 10; +} +f3("hello"); +>f3("hello") : number +>f3 : { (a: number): number; (b: string): number; } + +f3(10); +>f3(10) : number +>f3 : { (a: number): number; (b: string): number; } + +/** this is signature 4 - with number parameter*/ +function f4(/**param a*/a: number): number; +>f4 : { (a: number): number; (b: string): number; } +>a : number + +/** this is signature 4 - with string parameter*/ +function f4(b: string): number; +>f4 : { (a: number): number; (b: string): number; } +>b : string + +function f4(aOrb: any) { +>f4 : { (a: number): number; (b: string): number; } +>aOrb : any + + return 10; +} +f4("hello"); +>f4("hello") : number +>f4 : { (a: number): number; (b: string): number; } + +f4(10); +>f4(10) : number +>f4 : { (a: number): number; (b: string): number; } + +interface i1 { +>i1 : i1 + + /**this signature 1*/ + (/**param a*/ a: number): number; +>a : number + + /**this is signature 2*/ + (b: string): number; +>b : string + + /** foo 1*/ + foo(a: number): number; +>foo : { (a: number): number; (b: string): number; (arr: number[]): number; (arr: string[]): number; } +>a : number + + /** foo 2*/ + foo(b: string): number; +>foo : { (a: number): number; (b: string): number; (arr: number[]): number; (arr: string[]): number; } +>b : string + + // foo 3 + foo(arr: number[]): number; +>foo : { (a: number): number; (b: string): number; (arr: number[]): number; (arr: string[]): number; } +>arr : number[] + + /** foo 4 */ + foo(arr: string[]): number; +>foo : { (a: number): number; (b: string): number; (arr: number[]): number; (arr: string[]): number; } +>arr : string[] + + foo2(a: number): number; +>foo2 : { (a: number): number; (b: string): number; } +>a : number + + /** foo2 2*/ + foo2(b: string): number; +>foo2 : { (a: number): number; (b: string): number; } +>b : string + + foo3(a: number): number; +>foo3 : { (a: number): number; (b: string): number; } +>a : number + + foo3(b: string): number; +>foo3 : { (a: number): number; (b: string): number; } +>b : string + + /** foo4 1*/ + foo4(a: number): number; +>foo4 : { (a: number): number; (b: string): number; (c: any): any; } +>a : number + + foo4(b: string): number; +>foo4 : { (a: number): number; (b: string): number; (c: any): any; } +>b : string + + /** foo4 any */ + foo4(c: any): any; +>foo4 : { (a: number): number; (b: string): number; (c: any): any; } +>c : any + + /// new 1 + new (a: string); +>a : string + + /** new 1*/ + new (b: number); +>b : number +} +var i1_i: i1; +>i1_i : i1 +>i1 : i1 + +interface i2 { +>i2 : i2 + + new (a: string); +>a : string + + /** new 2*/ + new (b: number); +>b : number + + (a: number): number; +>a : number + + /**this is signature 2*/ + (b: string): number; +>b : string +} +var i2_i: i2; +>i2_i : i2 +>i2 : i2 + +interface i3 { +>i3 : i3 + + /** new 1*/ + new (a: string); +>a : string + + /** new 2*/ + new (b: number); +>b : number + + /**this is signature 1*/ + (a: number): number; +>a : number + + (b: string): number; +>b : string +} +var i3_i: i3; +>i3_i : i3 +>i3 : i3 + +interface i4 { +>i4 : i4 + + new (a: string); +>a : string + + new (b: number); +>b : number + + (a: number): number; +>a : number + + (b: string): number; +>b : string +} +class c { +>c : c + + public prop1(a: number): number; +>prop1 : { (a: number): number; (b: string): number; } +>a : number + + public prop1(b: string): number; +>prop1 : { (a: number): number; (b: string): number; } +>b : string + + public prop1(aorb: any) { +>prop1 : { (a: number): number; (b: string): number; } +>aorb : any + + return 10; + } + /** prop2 1*/ + public prop2(a: number): number; +>prop2 : { (a: number): number; (b: string): number; } +>a : number + + public prop2(b: string): number; +>prop2 : { (a: number): number; (b: string): number; } +>b : string + + public prop2(aorb: any) { +>prop2 : { (a: number): number; (b: string): number; } +>aorb : any + + return 10; + } + public prop3(a: number): number; +>prop3 : { (a: number): number; (b: string): number; } +>a : number + + /** prop3 2*/ + public prop3(b: string): number; +>prop3 : { (a: number): number; (b: string): number; } +>b : string + + public prop3(aorb: any) { +>prop3 : { (a: number): number; (b: string): number; } +>aorb : any + + return 10; + } + /** prop4 1*/ + public prop4(a: number): number; +>prop4 : { (a: number): number; (b: string): number; } +>a : number + + /** prop4 2*/ + public prop4(b: string): number; +>prop4 : { (a: number): number; (b: string): number; } +>b : string + + public prop4(aorb: any) { +>prop4 : { (a: number): number; (b: string): number; } +>aorb : any + + return 10; + } + /** prop5 1*/ + public prop5(a: number): number; +>prop5 : { (a: number): number; (b: string): number; } +>a : number + + /** prop5 2*/ + public prop5(b: string): number; +>prop5 : { (a: number): number; (b: string): number; } +>b : string + + /** Prop5 implementaion*/ + public prop5(aorb: any) { +>prop5 : { (a: number): number; (b: string): number; } +>aorb : any + + return 10; + } +} +class c1 { +>c1 : c1 + + constructor(a: number); +>a : number + + constructor(b: string); +>b : string + + constructor(aorb: any) { +>aorb : any + } +} +class c2 { +>c2 : c2 + + /** c2 1*/ + constructor(a: number); +>a : number + + // c2 2 + constructor(b: string); +>b : string + + constructor(aorb: any) { +>aorb : any + } +} +class c3 { +>c3 : c3 + + constructor(a: number); +>a : number + + /** c3 2*/ + constructor(b: string); +>b : string + + constructor(aorb: any) { +>aorb : any + } +} +class c4 { +>c4 : c4 + + /** c4 1*/ + constructor(a: number); +>a : number + + /** c4 2*/ + constructor(b: string); +>b : string + + /** c4 3 */ + constructor(aorb: any) { +>aorb : any + } +} +class c5 { +>c5 : c5 + + /** c5 1*/ + constructor(a: number); +>a : number + + /** c5 2*/ + constructor(b: string); +>b : string + + /** c5 implementation*/ + constructor(aorb: any) { +>aorb : any + } +} +var c_i = new c(); +>c_i : c +>new c() : c +>c : typeof c + +var c1_i_1 = new c1(10); +>c1_i_1 : c1 +>new c1(10) : c1 +>c1 : typeof c1 + +var c1_i_2 = new c1("hello"); +>c1_i_2 : c1 +>new c1("hello") : c1 +>c1 : typeof c1 + +var c2_i_1 = new c2(10); +>c2_i_1 : c2 +>new c2(10) : c2 +>c2 : typeof c2 + +var c2_i_2 = new c2("hello"); +>c2_i_2 : c2 +>new c2("hello") : c2 +>c2 : typeof c2 + +var c3_i_1 = new c3(10); +>c3_i_1 : c3 +>new c3(10) : c3 +>c3 : typeof c3 + +var c3_i_2 = new c3("hello"); +>c3_i_2 : c3 +>new c3("hello") : c3 +>c3 : typeof c3 + +var c4_i_1 = new c4(10); +>c4_i_1 : c4 +>new c4(10) : c4 +>c4 : typeof c4 + +var c4_i_2 = new c4("hello"); +>c4_i_2 : c4 +>new c4("hello") : c4 +>c4 : typeof c4 + +var c5_i_1 = new c5(10); +>c5_i_1 : c5 +>new c5(10) : c5 +>c5 : typeof c5 + +var c5_i_2 = new c5("hello"); +>c5_i_2 : c5 +>new c5("hello") : c5 +>c5 : typeof c5 + diff --git a/tests/baselines/reference/commentsPropertySignature1.types b/tests/baselines/reference/commentsPropertySignature1.types new file mode 100644 index 00000000000..c2fe276a410 --- /dev/null +++ b/tests/baselines/reference/commentsPropertySignature1.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/commentsPropertySignature1.ts === +var a = { +>a : { x: number; } +>{ + /** own x*/ + x: 0 +} : { x: number; } + + /** own x*/ + x: 0 +>x : number + +}; + diff --git a/tests/baselines/reference/commentsVarDecl.types b/tests/baselines/reference/commentsVarDecl.types new file mode 100644 index 00000000000..5688948414a --- /dev/null +++ b/tests/baselines/reference/commentsVarDecl.types @@ -0,0 +1,74 @@ +=== tests/cases/compiler/commentsVarDecl.ts === + +/** Variable comments*/ +var myVariable = 10; +>myVariable : number + +/** This is another variable comment*/ +var anotherVariable = 30; +>anotherVariable : number + +// shouldn't appear +var aVar = ""; +>aVar : string + +/** this is multiline comment + * All these variables are of number type */ +var anotherAnotherVariable = 70; +>anotherAnotherVariable : number + +/** Triple slash multiline comment*/ +/** another line in the comment*/ +/** comment line 2*/ +var x = 70; +>x : number + +/** Triple slash comment on the assignement shouldnt be in .d.ts file*/ +x = myVariable; +>x = myVariable : number +>x : number +>myVariable : number + +/** triple slash comment1*/ +/** jsdocstyle comment - only this comment should be in .d.ts file*/ +var n = 30; +>n : number + +/** var deckaration with comment on type as well*/ +var y = /** value comment */ 20; +>y : number + +/// var deckaration with comment on type as well +var yy = +>yy : number + + /// value comment + 20; + +/** comment2 */ +var z = /** lambda comment */ (x: number, y: number) => x + y; +>z : (x: number, y: number) => number +>(x: number, y: number) => x + y : (x: number, y: number) => number +>x : number +>y : number +>x + y : number +>x : number +>y : number + +var z2: /** type comment*/ (x: number) => string; +>z2 : (x: number) => string +>x : number + +var x2 = z2; +>x2 : (x: number) => string +>z2 : (x: number) => string + +var n4: (x: number) => string; +>n4 : (x: number) => string +>x : number + +n4 = z2; +>n4 = z2 : (x: number) => string +>n4 : (x: number) => string +>z2 : (x: number) => string + diff --git a/tests/baselines/reference/commentsVariableStatement1.types b/tests/baselines/reference/commentsVariableStatement1.types new file mode 100644 index 00000000000..7717be4a2a1 --- /dev/null +++ b/tests/baselines/reference/commentsVariableStatement1.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/commentsVariableStatement1.ts === + +/** Comment */ +var v = 1; +>v : number + diff --git a/tests/baselines/reference/commentsdoNotEmitComments.types b/tests/baselines/reference/commentsdoNotEmitComments.types new file mode 100644 index 00000000000..8cc0b26028d --- /dev/null +++ b/tests/baselines/reference/commentsdoNotEmitComments.types @@ -0,0 +1,153 @@ +=== tests/cases/compiler/commentsdoNotEmitComments.ts === + +/** Variable comments*/ +var myVariable = 10; +>myVariable : number + +/** function comments*/ +function foo(/** parameter comment*/p: number) { +>foo : (p: number) => void +>p : number +} + +/** variable with function type comment*/ +var fooVar: () => void; +>fooVar : () => void + +foo(50); +>foo(50) : void +>foo : (p: number) => void + +fooVar(); +>fooVar() : void +>fooVar : () => void + +/**class comment*/ +class c { +>c : c + + /** constructor comment*/ + constructor() { + } + + /** property comment */ + public b = 10; +>b : number + + /** function comment */ + public myFoo() { +>myFoo : () => number + + return this.b; +>this.b : number +>this : c +>b : number + } + + /** getter comment*/ + public get prop1() { +>prop1 : number + + return this.b; +>this.b : number +>this : c +>b : number + } + + /** setter comment*/ + public set prop1(val: number) { +>prop1 : number +>val : number + + this.b = val; +>this.b = val : number +>this.b : number +>this : c +>b : number +>val : number + } + + /** overload signature1*/ + public foo1(a: number): string; +>foo1 : { (a: number): string; (b: string): string; } +>a : number + + /** Overload signature 2*/ + public foo1(b: string): string; +>foo1 : { (a: number): string; (b: string): string; } +>b : string + + /** overload implementation signature*/ + public foo1(aOrb) { +>foo1 : { (a: number): string; (b: string): string; } +>aOrb : any + + return aOrb.toString(); +>aOrb.toString() : any +>aOrb.toString : any +>aOrb : any +>toString : any + } +} + +/**instance comment*/ +var i = new c(); +>i : c +>new c() : c +>c : typeof c + +/** interface comments*/ +interface i1 { +>i1 : i1 + + /** caller comments*/ + (a: number): number; +>a : number + + /** new comments*/ + new (b: string); +>b : string + + /**indexer property*/ + [a: number]: string; +>a : number + + /** function property;*/ + myFoo(/*param prop*/a: number): string; +>myFoo : (a: number) => string +>a : number + + /** prop*/ + prop: string; +>prop : string +} + +/**interface instance comments*/ +var i1_i: i1; +>i1_i : i1 +>i1 : i1 + +/** this is module comment*/ +module m1 { +>m1 : typeof m1 + + /** class b */ + export class b { +>b : b + + constructor(public x: number) { +>x : number + + } + } + + /// module m2 + export module m2 { +>m2 : m2 + } +} + +/// this is x +declare var x; +>x : any + diff --git a/tests/baselines/reference/commentsemitComments.types b/tests/baselines/reference/commentsemitComments.types new file mode 100644 index 00000000000..0defb522428 --- /dev/null +++ b/tests/baselines/reference/commentsemitComments.types @@ -0,0 +1,153 @@ +=== tests/cases/compiler/commentsemitComments.ts === + +/** Variable comments*/ +var myVariable = 10; +>myVariable : number + +/** function comments*/ +function foo(/** parameter comment*/p: number) { +>foo : (p: number) => void +>p : number +} + +/** variable with function type comment*/ +var fooVar: () => void; +>fooVar : () => void + +foo(50); +>foo(50) : void +>foo : (p: number) => void + +fooVar(); +>fooVar() : void +>fooVar : () => void + +/**class comment*/ +class c { +>c : c + + /** constructor comment*/ + constructor() { + } + + /** property comment */ + public b = 10; +>b : number + + /** function comment */ + public myFoo() { +>myFoo : () => number + + return this.b; +>this.b : number +>this : c +>b : number + } + + /** getter comment*/ + public get prop1() { +>prop1 : number + + return this.b; +>this.b : number +>this : c +>b : number + } + + /** setter comment*/ + public set prop1(val: number) { +>prop1 : number +>val : number + + this.b = val; +>this.b = val : number +>this.b : number +>this : c +>b : number +>val : number + } + + /** overload signature1*/ + public foo1(a: number): string; +>foo1 : { (a: number): string; (b: string): string; } +>a : number + + /** Overload signature 2*/ + public foo1(b: string): string; +>foo1 : { (a: number): string; (b: string): string; } +>b : string + + /** overload implementation signature*/ + public foo1(aOrb) { +>foo1 : { (a: number): string; (b: string): string; } +>aOrb : any + + return aOrb.toString(); +>aOrb.toString() : any +>aOrb.toString : any +>aOrb : any +>toString : any + } +} + +/**instance comment*/ +var i = new c(); +>i : c +>new c() : c +>c : typeof c + +/** interface comments*/ +interface i1 { +>i1 : i1 + + /** caller comments*/ + (a: number): number; +>a : number + + /** new comments*/ + new (b: string); +>b : string + + /**indexer property*/ + [a: number]: string; +>a : number + + /** function property;*/ + myFoo(/*param prop*/a: number): string; +>myFoo : (a: number) => string +>a : number + + /** prop*/ + prop: string; +>prop : string +} + +/**interface instance comments*/ +var i1_i: i1; +>i1_i : i1 +>i1 : i1 + +/** this is module comment*/ +module m1 { +>m1 : typeof m1 + + /** class b */ + export class b { +>b : b + + constructor(public x: number) { +>x : number + + } + } + + /// module m2 + export module m2 { +>m2 : m2 + } +} + +/// this is x +declare var x; +>x : any + diff --git a/tests/baselines/reference/commonJSImportAsPrimaryExpression.types b/tests/baselines/reference/commonJSImportAsPrimaryExpression.types new file mode 100644 index 00000000000..b1a0a7e49ac --- /dev/null +++ b/tests/baselines/reference/commonJSImportAsPrimaryExpression.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/externalModules/foo_1.ts === +import foo = require("./foo_0"); +>foo : typeof "tests/cases/conformance/externalModules/foo_0" + +if(foo.C1.s1){ +>foo.C1.s1 : boolean +>foo.C1 : typeof C1 +>foo : typeof "tests/cases/conformance/externalModules/foo_0" +>C1 : typeof C1 +>s1 : boolean + + // Should cause runtime import +} + +=== tests/cases/conformance/externalModules/foo_0.ts === +export class C1 { +>C1 : C1 + + m1 = 42; +>m1 : number + + static s1 = true; +>s1 : boolean +} + diff --git a/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.types b/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.types new file mode 100644 index 00000000000..a3d30f3d03c --- /dev/null +++ b/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.types @@ -0,0 +1,82 @@ +=== tests/cases/conformance/externalModules/foo_1.ts === +import foo = require("./foo_0"); +>foo : typeof "tests/cases/conformance/externalModules/foo_0" + +// None of the below should cause a runtime dependency on foo_0 +import f = foo.M1; +>f : f +>foo : foo +>M1 : M1 + +var i: f.I2; +>i : I2 +>f : f +>I2 : I2 + +var x: foo.C1 = <{m1: number}>{}; +>x : C1 +>foo : foo +>C1 : C1 +><{m1: number}>{} : { m1: number; } +>m1 : number +>{} : {} + +var y: typeof foo.C1.s1 = false; +>y : boolean +>foo : typeof "tests/cases/conformance/externalModules/foo_0" +>C1 : typeof C1 +>s1 : boolean + +var z: foo.M1.I2; +>z : I2 +>foo : foo +>M1 : M1 +>I2 : I2 + +var e: number = 0; +>e : number +>0 : E1 +>foo : foo +>E1 : E1 + +=== tests/cases/conformance/externalModules/foo_0.ts === +export class C1 { +>C1 : C1 + + m1 = 42; +>m1 : number + + static s1 = true; +>s1 : boolean +} + +export interface I1 { +>I1 : I1 + + name: string; +>name : string + + age: number; +>age : number +} + +export module M1 { +>M1 : M1 + + export interface I2 { +>I2 : I2 + + foo: string; +>foo : string + } +} + +export enum E1 { +>E1 : E1 + + A,B,C +>A : E1 +>B : E1 +>C : E1 +} + diff --git a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.types b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.types new file mode 100644 index 00000000000..02316f94e54 --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.types @@ -0,0 +1,847 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalObjects.ts === +class A1 { +>A1 : A1 + + public a: string; +>a : string + + public b: number; +>b : number + + public c: boolean; +>c : boolean + + public d: any; +>d : any + + public e: Object; +>e : Object +>Object : Object + + public fn(a: string): string { +>fn : (a: string) => string +>a : string + + return null; + } +} +class B1 { +>B1 : B1 + + public a: string; +>a : string + + public b: number; +>b : number + + public c: boolean; +>c : boolean + + public d: any; +>d : any + + public e: Object; +>e : Object +>Object : Object + + public fn(b: string): string { +>fn : (b: string) => string +>b : string + + return null; + } +} + +class Base { +>Base : Base + + private a: string; +>a : string + + private fn(b: string): string { +>fn : (b: string) => string +>b : string + + return null; + } +} +class A2 extends Base { } +>A2 : A2 +>Base : Base + +class B2 extends Base { } +>B2 : B2 +>Base : Base + +interface A3 { f(a: number): string; } +>A3 : A3 +>f : (a: number) => string +>a : number + +interface B3 { f(a: number): string; } +>B3 : B3 +>f : (a: number) => string +>a : number + +interface A4 { new (a: string): A1; } +>A4 : A4 +>a : string +>A1 : A1 + +interface B4 { new (a: string): B1; } +>B4 : B4 +>a : string +>B1 : B1 + +interface A5 { [x: number]: number; } +>A5 : A5 +>x : number + +interface B5 { [x: number]: number; } +>B5 : B5 +>x : number + +interface A6 { [x: string]: string; } +>A6 : A6 +>x : string + +interface B6 { [x: string]: string; } +>B6 : B6 +>x : string + +var a1: A1; +>a1 : A1 +>A1 : A1 + +var a2: A2; +>a2 : A2 +>A2 : A2 + +var a3: A3; +>a3 : A3 +>A3 : A3 + +var a4: A4; +>a4 : A4 +>A4 : A4 + +var a5: A5; +>a5 : A5 +>A5 : A5 + +var a6: A6; +>a6 : A6 +>A6 : A6 + +var b1: B1; +>b1 : B1 +>B1 : B1 + +var b2: B2; +>b2 : B2 +>B2 : B2 + +var b3: B3; +>b3 : B3 +>B3 : B3 + +var b4: B4; +>b4 : B4 +>B4 : B4 + +var b5: B5; +>b5 : B5 +>B5 : B5 + +var b6: B6; +>b6 : B6 +>B6 : B6 + +var base1: Base; +>base1 : Base +>Base : Base + +var base2: Base; +>base2 : Base +>Base : Base + +// operator < +var r1a1 = a1 < b1; +>r1a1 : boolean +>a1 < b1 : boolean +>a1 : A1 +>b1 : B1 + +var r1a2 = base1 < base2; +>r1a2 : boolean +>base1 < base2 : boolean +>base1 : Base +>base2 : Base + +var r1a3 = a2 < b2; +>r1a3 : boolean +>a2 < b2 : boolean +>a2 : A2 +>b2 : B2 + +var r1a4 = a3 < b3; +>r1a4 : boolean +>a3 < b3 : boolean +>a3 : A3 +>b3 : B3 + +var r1a5 = a4 < b4; +>r1a5 : boolean +>a4 < b4 : boolean +>a4 : A4 +>b4 : B4 + +var r1a6 = a5 < b5; +>r1a6 : boolean +>a5 < b5 : boolean +>a5 : A5 +>b5 : B5 + +var r1a7 = a6 < b6; +>r1a7 : boolean +>a6 < b6 : boolean +>a6 : A6 +>b6 : B6 + +var r1b1 = b1 < a1; +>r1b1 : boolean +>b1 < a1 : boolean +>b1 : B1 +>a1 : A1 + +var r1b2 = base2 < base1; +>r1b2 : boolean +>base2 < base1 : boolean +>base2 : Base +>base1 : Base + +var r1b3 = b2 < a2; +>r1b3 : boolean +>b2 < a2 : boolean +>b2 : B2 +>a2 : A2 + +var r1b4 = b3 < a3; +>r1b4 : boolean +>b3 < a3 : boolean +>b3 : B3 +>a3 : A3 + +var r1b5 = b4 < a4; +>r1b5 : boolean +>b4 < a4 : boolean +>b4 : B4 +>a4 : A4 + +var r1b6 = b5 < a5; +>r1b6 : boolean +>b5 < a5 : boolean +>b5 : B5 +>a5 : A5 + +var r1b7 = b6 < a6; +>r1b7 : boolean +>b6 < a6 : boolean +>b6 : B6 +>a6 : A6 + +// operator > +var r2a1 = a1 > b1; +>r2a1 : boolean +>a1 > b1 : boolean +>a1 : A1 +>b1 : B1 + +var r2a2 = base1 > base2; +>r2a2 : boolean +>base1 > base2 : boolean +>base1 : Base +>base2 : Base + +var r2a3 = a2 > b2; +>r2a3 : boolean +>a2 > b2 : boolean +>a2 : A2 +>b2 : B2 + +var r2a4 = a3 > b3; +>r2a4 : boolean +>a3 > b3 : boolean +>a3 : A3 +>b3 : B3 + +var r2a5 = a4 > b4; +>r2a5 : boolean +>a4 > b4 : boolean +>a4 : A4 +>b4 : B4 + +var r2a6 = a5 > b5; +>r2a6 : boolean +>a5 > b5 : boolean +>a5 : A5 +>b5 : B5 + +var r2a7 = a6 > b6; +>r2a7 : boolean +>a6 > b6 : boolean +>a6 : A6 +>b6 : B6 + +var r2b1 = b1 > a1; +>r2b1 : boolean +>b1 > a1 : boolean +>b1 : B1 +>a1 : A1 + +var r2b2 = base2 > base1; +>r2b2 : boolean +>base2 > base1 : boolean +>base2 : Base +>base1 : Base + +var r2b3 = b2 > a2; +>r2b3 : boolean +>b2 > a2 : boolean +>b2 : B2 +>a2 : A2 + +var r2b4 = b3 > a3; +>r2b4 : boolean +>b3 > a3 : boolean +>b3 : B3 +>a3 : A3 + +var r2b5 = b4 > a4; +>r2b5 : boolean +>b4 > a4 : boolean +>b4 : B4 +>a4 : A4 + +var r2b6 = b5 > a5; +>r2b6 : boolean +>b5 > a5 : boolean +>b5 : B5 +>a5 : A5 + +var r2b7 = b6 > a6; +>r2b7 : boolean +>b6 > a6 : boolean +>b6 : B6 +>a6 : A6 + +// operator <= +var r3a1 = a1 <= b1; +>r3a1 : boolean +>a1 <= b1 : boolean +>a1 : A1 +>b1 : B1 + +var r3a2 = base1 <= base2; +>r3a2 : boolean +>base1 <= base2 : boolean +>base1 : Base +>base2 : Base + +var r3a3 = a2 <= b2; +>r3a3 : boolean +>a2 <= b2 : boolean +>a2 : A2 +>b2 : B2 + +var r3a4 = a3 <= b3; +>r3a4 : boolean +>a3 <= b3 : boolean +>a3 : A3 +>b3 : B3 + +var r3a5 = a4 <= b4; +>r3a5 : boolean +>a4 <= b4 : boolean +>a4 : A4 +>b4 : B4 + +var r3a6 = a5 <= b5; +>r3a6 : boolean +>a5 <= b5 : boolean +>a5 : A5 +>b5 : B5 + +var r3a7 = a6 <= b6; +>r3a7 : boolean +>a6 <= b6 : boolean +>a6 : A6 +>b6 : B6 + +var r3b1 = b1 <= a1; +>r3b1 : boolean +>b1 <= a1 : boolean +>b1 : B1 +>a1 : A1 + +var r3b2 = base2 <= base1; +>r3b2 : boolean +>base2 <= base1 : boolean +>base2 : Base +>base1 : Base + +var r3b3 = b2 <= a2; +>r3b3 : boolean +>b2 <= a2 : boolean +>b2 : B2 +>a2 : A2 + +var r3b4 = b3 <= a3; +>r3b4 : boolean +>b3 <= a3 : boolean +>b3 : B3 +>a3 : A3 + +var r3b5 = b4 <= a4; +>r3b5 : boolean +>b4 <= a4 : boolean +>b4 : B4 +>a4 : A4 + +var r3b6 = b5 <= a5; +>r3b6 : boolean +>b5 <= a5 : boolean +>b5 : B5 +>a5 : A5 + +var r3b7 = b6 <= a6; +>r3b7 : boolean +>b6 <= a6 : boolean +>b6 : B6 +>a6 : A6 + +// operator >= +var r4a1 = a1 >= b1; +>r4a1 : boolean +>a1 >= b1 : boolean +>a1 : A1 +>b1 : B1 + +var r4a2 = base1 >= base2; +>r4a2 : boolean +>base1 >= base2 : boolean +>base1 : Base +>base2 : Base + +var r4a3 = a2 >= b2; +>r4a3 : boolean +>a2 >= b2 : boolean +>a2 : A2 +>b2 : B2 + +var r4a4 = a3 >= b3; +>r4a4 : boolean +>a3 >= b3 : boolean +>a3 : A3 +>b3 : B3 + +var r4a5 = a4 >= b4; +>r4a5 : boolean +>a4 >= b4 : boolean +>a4 : A4 +>b4 : B4 + +var r4a6 = a5 >= b5; +>r4a6 : boolean +>a5 >= b5 : boolean +>a5 : A5 +>b5 : B5 + +var r4a7 = a6 >= b6; +>r4a7 : boolean +>a6 >= b6 : boolean +>a6 : A6 +>b6 : B6 + +var r4b1 = b1 >= a1; +>r4b1 : boolean +>b1 >= a1 : boolean +>b1 : B1 +>a1 : A1 + +var r4b2 = base2 >= base1; +>r4b2 : boolean +>base2 >= base1 : boolean +>base2 : Base +>base1 : Base + +var r4b3 = b2 >= a2; +>r4b3 : boolean +>b2 >= a2 : boolean +>b2 : B2 +>a2 : A2 + +var r4b4 = b3 >= a3; +>r4b4 : boolean +>b3 >= a3 : boolean +>b3 : B3 +>a3 : A3 + +var r4b5 = b4 >= a4; +>r4b5 : boolean +>b4 >= a4 : boolean +>b4 : B4 +>a4 : A4 + +var r4b6 = b5 >= a5; +>r4b6 : boolean +>b5 >= a5 : boolean +>b5 : B5 +>a5 : A5 + +var r4b7 = b6 >= a6; +>r4b7 : boolean +>b6 >= a6 : boolean +>b6 : B6 +>a6 : A6 + +// operator == +var r5a1 = a1 == b1; +>r5a1 : boolean +>a1 == b1 : boolean +>a1 : A1 +>b1 : B1 + +var r5a2 = base1 == base2; +>r5a2 : boolean +>base1 == base2 : boolean +>base1 : Base +>base2 : Base + +var r5a3 = a2 == b2; +>r5a3 : boolean +>a2 == b2 : boolean +>a2 : A2 +>b2 : B2 + +var r5a4 = a3 == b3; +>r5a4 : boolean +>a3 == b3 : boolean +>a3 : A3 +>b3 : B3 + +var r5a5 = a4 == b4; +>r5a5 : boolean +>a4 == b4 : boolean +>a4 : A4 +>b4 : B4 + +var r5a6 = a5 == b5; +>r5a6 : boolean +>a5 == b5 : boolean +>a5 : A5 +>b5 : B5 + +var r5a7 = a6 == b6; +>r5a7 : boolean +>a6 == b6 : boolean +>a6 : A6 +>b6 : B6 + +var r5b1 = b1 == a1; +>r5b1 : boolean +>b1 == a1 : boolean +>b1 : B1 +>a1 : A1 + +var r5b2 = base2 == base1; +>r5b2 : boolean +>base2 == base1 : boolean +>base2 : Base +>base1 : Base + +var r5b3 = b2 == a2; +>r5b3 : boolean +>b2 == a2 : boolean +>b2 : B2 +>a2 : A2 + +var r5b4 = b3 == a3; +>r5b4 : boolean +>b3 == a3 : boolean +>b3 : B3 +>a3 : A3 + +var r5b5 = b4 == a4; +>r5b5 : boolean +>b4 == a4 : boolean +>b4 : B4 +>a4 : A4 + +var r5b6 = b5 == a5; +>r5b6 : boolean +>b5 == a5 : boolean +>b5 : B5 +>a5 : A5 + +var r5b7 = b6 == a6; +>r5b7 : boolean +>b6 == a6 : boolean +>b6 : B6 +>a6 : A6 + +// operator != +var r6a1 = a1 != b1; +>r6a1 : boolean +>a1 != b1 : boolean +>a1 : A1 +>b1 : B1 + +var r6a2 = base1 != base2; +>r6a2 : boolean +>base1 != base2 : boolean +>base1 : Base +>base2 : Base + +var r6a3 = a2 != b2; +>r6a3 : boolean +>a2 != b2 : boolean +>a2 : A2 +>b2 : B2 + +var r6a4 = a3 != b3; +>r6a4 : boolean +>a3 != b3 : boolean +>a3 : A3 +>b3 : B3 + +var r6a5 = a4 != b4; +>r6a5 : boolean +>a4 != b4 : boolean +>a4 : A4 +>b4 : B4 + +var r6a6 = a5 != b5; +>r6a6 : boolean +>a5 != b5 : boolean +>a5 : A5 +>b5 : B5 + +var r6a7 = a6 != b6; +>r6a7 : boolean +>a6 != b6 : boolean +>a6 : A6 +>b6 : B6 + +var r6b1 = b1 != a1; +>r6b1 : boolean +>b1 != a1 : boolean +>b1 : B1 +>a1 : A1 + +var r6b2 = base2 != base1; +>r6b2 : boolean +>base2 != base1 : boolean +>base2 : Base +>base1 : Base + +var r6b3 = b2 != a2; +>r6b3 : boolean +>b2 != a2 : boolean +>b2 : B2 +>a2 : A2 + +var r6b4 = b3 != a3; +>r6b4 : boolean +>b3 != a3 : boolean +>b3 : B3 +>a3 : A3 + +var r6b5 = b4 != a4; +>r6b5 : boolean +>b4 != a4 : boolean +>b4 : B4 +>a4 : A4 + +var r6b6 = b5 != a5; +>r6b6 : boolean +>b5 != a5 : boolean +>b5 : B5 +>a5 : A5 + +var r6b7 = b6 != a6; +>r6b7 : boolean +>b6 != a6 : boolean +>b6 : B6 +>a6 : A6 + +// operator === +var r7a1 = a1 === b1; +>r7a1 : boolean +>a1 === b1 : boolean +>a1 : A1 +>b1 : B1 + +var r7a2 = base1 === base2; +>r7a2 : boolean +>base1 === base2 : boolean +>base1 : Base +>base2 : Base + +var r7a3 = a2 === b2; +>r7a3 : boolean +>a2 === b2 : boolean +>a2 : A2 +>b2 : B2 + +var r7a4 = a3 === b3; +>r7a4 : boolean +>a3 === b3 : boolean +>a3 : A3 +>b3 : B3 + +var r7a5 = a4 === b4; +>r7a5 : boolean +>a4 === b4 : boolean +>a4 : A4 +>b4 : B4 + +var r7a6 = a5 === b5; +>r7a6 : boolean +>a5 === b5 : boolean +>a5 : A5 +>b5 : B5 + +var r7a7 = a6 === b6; +>r7a7 : boolean +>a6 === b6 : boolean +>a6 : A6 +>b6 : B6 + +var r7b1 = b1 === a1; +>r7b1 : boolean +>b1 === a1 : boolean +>b1 : B1 +>a1 : A1 + +var r7b2 = base2 === base1; +>r7b2 : boolean +>base2 === base1 : boolean +>base2 : Base +>base1 : Base + +var r7b3 = b2 === a2; +>r7b3 : boolean +>b2 === a2 : boolean +>b2 : B2 +>a2 : A2 + +var r7b4 = b3 === a3; +>r7b4 : boolean +>b3 === a3 : boolean +>b3 : B3 +>a3 : A3 + +var r7b5 = b4 === a4; +>r7b5 : boolean +>b4 === a4 : boolean +>b4 : B4 +>a4 : A4 + +var r7b6 = b5 === a5; +>r7b6 : boolean +>b5 === a5 : boolean +>b5 : B5 +>a5 : A5 + +var r7b7 = b6 === a6; +>r7b7 : boolean +>b6 === a6 : boolean +>b6 : B6 +>a6 : A6 + +// operator !== +var r8a1 = a1 !== b1; +>r8a1 : boolean +>a1 !== b1 : boolean +>a1 : A1 +>b1 : B1 + +var r8a2 = base1 !== base2; +>r8a2 : boolean +>base1 !== base2 : boolean +>base1 : Base +>base2 : Base + +var r8a3 = a2 !== b2; +>r8a3 : boolean +>a2 !== b2 : boolean +>a2 : A2 +>b2 : B2 + +var r8a4 = a3 !== b3; +>r8a4 : boolean +>a3 !== b3 : boolean +>a3 : A3 +>b3 : B3 + +var r8a5 = a4 !== b4; +>r8a5 : boolean +>a4 !== b4 : boolean +>a4 : A4 +>b4 : B4 + +var r8a6 = a5 !== b5; +>r8a6 : boolean +>a5 !== b5 : boolean +>a5 : A5 +>b5 : B5 + +var r8a7 = a6 !== b6; +>r8a7 : boolean +>a6 !== b6 : boolean +>a6 : A6 +>b6 : B6 + +var r8b1 = b1 !== a1; +>r8b1 : boolean +>b1 !== a1 : boolean +>b1 : B1 +>a1 : A1 + +var r8b2 = base2 !== base1; +>r8b2 : boolean +>base2 !== base1 : boolean +>base2 : Base +>base1 : Base + +var r8b3 = b2 !== a2; +>r8b3 : boolean +>b2 !== a2 : boolean +>b2 : B2 +>a2 : A2 + +var r8b4 = b3 !== a3; +>r8b4 : boolean +>b3 !== a3 : boolean +>b3 : B3 +>a3 : A3 + +var r8b5 = b4 !== a4; +>r8b5 : boolean +>b4 !== a4 : boolean +>b4 : B4 +>a4 : A4 + +var r8b6 = b5 !== a5; +>r8b6 : boolean +>b5 !== a5 : boolean +>b5 : B5 +>a5 : A5 + +var r8b7 = b6 !== a6; +>r8b7 : boolean +>b6 !== a6 : boolean +>b6 : B6 +>a6 : A6 + diff --git a/tests/baselines/reference/comparisonOperatorWithIdenticalPrimitiveType.types b/tests/baselines/reference/comparisonOperatorWithIdenticalPrimitiveType.types new file mode 100644 index 00000000000..8c823072ac3 --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithIdenticalPrimitiveType.types @@ -0,0 +1,351 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts === +enum E { a, b, c } +>E : E +>a : E +>b : E +>c : E + +var a: number; +>a : number + +var b: boolean; +>b : boolean + +var c: string; +>c : string + +var d: void; +>d : void + +var e: E; +>e : E +>E : E + +// operator < +var ra1 = a < a; +>ra1 : boolean +>a < a : boolean +>a : number +>a : number + +var ra2 = b < b; +>ra2 : boolean +>b < b : boolean +>b : boolean +>b : boolean + +var ra3 = c < c; +>ra3 : boolean +>c < c : boolean +>c : string +>c : string + +var ra4 = d < d; +>ra4 : boolean +>d < d : boolean +>d : void +>d : void + +var ra5 = e < e; +>ra5 : boolean +>e < e : boolean +>e : E +>e : E + +var ra6 = null < null; +>ra6 : boolean +>null < null : boolean + +var ra7 = undefined < undefined; +>ra7 : boolean +>undefined < undefined : boolean +>undefined : undefined +>undefined : undefined + +// operator > +var rb1 = a > a; +>rb1 : boolean +>a > a : boolean +>a : number +>a : number + +var rb2 = b > b; +>rb2 : boolean +>b > b : boolean +>b : boolean +>b : boolean + +var rb3 = c > c; +>rb3 : boolean +>c > c : boolean +>c : string +>c : string + +var rb4 = d > d; +>rb4 : boolean +>d > d : boolean +>d : void +>d : void + +var rb5 = e > e; +>rb5 : boolean +>e > e : boolean +>e : E +>e : E + +var rb6 = null > null; +>rb6 : boolean +>null > null : boolean + +var rb7 = undefined > undefined; +>rb7 : boolean +>undefined > undefined : boolean +>undefined : undefined +>undefined : undefined + +// operator <= +var rc1 = a <= a; +>rc1 : boolean +>a <= a : boolean +>a : number +>a : number + +var rc2 = b <= b; +>rc2 : boolean +>b <= b : boolean +>b : boolean +>b : boolean + +var rc3 = c <= c; +>rc3 : boolean +>c <= c : boolean +>c : string +>c : string + +var rc4 = d <= d; +>rc4 : boolean +>d <= d : boolean +>d : void +>d : void + +var rc5 = e <= e; +>rc5 : boolean +>e <= e : boolean +>e : E +>e : E + +var rc6 = null <= null; +>rc6 : boolean +>null <= null : boolean + +var rc7 = undefined <= undefined; +>rc7 : boolean +>undefined <= undefined : boolean +>undefined : undefined +>undefined : undefined + +// operator >= +var rd1 = a >= a; +>rd1 : boolean +>a >= a : boolean +>a : number +>a : number + +var rd2 = b >= b; +>rd2 : boolean +>b >= b : boolean +>b : boolean +>b : boolean + +var rd3 = c >= c; +>rd3 : boolean +>c >= c : boolean +>c : string +>c : string + +var rd4 = d >= d; +>rd4 : boolean +>d >= d : boolean +>d : void +>d : void + +var rd5 = e >= e; +>rd5 : boolean +>e >= e : boolean +>e : E +>e : E + +var rd6 = null >= null; +>rd6 : boolean +>null >= null : boolean + +var rd7 = undefined >= undefined; +>rd7 : boolean +>undefined >= undefined : boolean +>undefined : undefined +>undefined : undefined + +// operator == +var re1 = a == a; +>re1 : boolean +>a == a : boolean +>a : number +>a : number + +var re2 = b == b; +>re2 : boolean +>b == b : boolean +>b : boolean +>b : boolean + +var re3 = c == c; +>re3 : boolean +>c == c : boolean +>c : string +>c : string + +var re4 = d == d; +>re4 : boolean +>d == d : boolean +>d : void +>d : void + +var re5 = e == e; +>re5 : boolean +>e == e : boolean +>e : E +>e : E + +var re6 = null == null; +>re6 : boolean +>null == null : boolean + +var re7 = undefined == undefined; +>re7 : boolean +>undefined == undefined : boolean +>undefined : undefined +>undefined : undefined + +// operator != +var rf1 = a != a; +>rf1 : boolean +>a != a : boolean +>a : number +>a : number + +var rf2 = b != b; +>rf2 : boolean +>b != b : boolean +>b : boolean +>b : boolean + +var rf3 = c != c; +>rf3 : boolean +>c != c : boolean +>c : string +>c : string + +var rf4 = d != d; +>rf4 : boolean +>d != d : boolean +>d : void +>d : void + +var rf5 = e != e; +>rf5 : boolean +>e != e : boolean +>e : E +>e : E + +var rf6 = null != null; +>rf6 : boolean +>null != null : boolean + +var rf7 = undefined != undefined; +>rf7 : boolean +>undefined != undefined : boolean +>undefined : undefined +>undefined : undefined + +// operator === +var rg1 = a === a; +>rg1 : boolean +>a === a : boolean +>a : number +>a : number + +var rg2 = b === b; +>rg2 : boolean +>b === b : boolean +>b : boolean +>b : boolean + +var rg3 = c === c; +>rg3 : boolean +>c === c : boolean +>c : string +>c : string + +var rg4 = d === d; +>rg4 : boolean +>d === d : boolean +>d : void +>d : void + +var rg5 = e === e; +>rg5 : boolean +>e === e : boolean +>e : E +>e : E + +var rg6 = null === null; +>rg6 : boolean +>null === null : boolean + +var rg7 = undefined === undefined; +>rg7 : boolean +>undefined === undefined : boolean +>undefined : undefined +>undefined : undefined + +// operator !== +var rh1 = a !== a; +>rh1 : boolean +>a !== a : boolean +>a : number +>a : number + +var rh2 = b !== b; +>rh2 : boolean +>b !== b : boolean +>b : boolean +>b : boolean + +var rh3 = c !== c; +>rh3 : boolean +>c !== c : boolean +>c : string +>c : string + +var rh4 = d !== d; +>rh4 : boolean +>d !== d : boolean +>d : void +>d : void + +var rh5 = e !== e; +>rh5 : boolean +>e !== e : boolean +>e : E +>e : E + +var rh6 = null !== null; +>rh6 : boolean +>null !== null : boolean + +var rh7 = undefined !== undefined; +>rh7 : boolean +>undefined !== undefined : boolean +>undefined : undefined +>undefined : undefined + diff --git a/tests/baselines/reference/comparisonOperatorWithIdenticalTypeParameter.types b/tests/baselines/reference/comparisonOperatorWithIdenticalTypeParameter.types new file mode 100644 index 00000000000..b545fdc9f1a --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithIdenticalTypeParameter.types @@ -0,0 +1,55 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalTypeParameter.ts === +function foo(t: T) { +>foo : (t: T) => void +>T : T +>t : T +>T : T + + var r1 = t < t; +>r1 : boolean +>t < t : boolean +>t : T +>t : T + + var r2 = t > t; +>r2 : boolean +>t > t : boolean +>t : T +>t : T + + var r3 = t <= t; +>r3 : boolean +>t <= t : boolean +>t : T +>t : T + + var r4 = t >= t; +>r4 : boolean +>t >= t : boolean +>t : T +>t : T + + var r5 = t == t; +>r5 : boolean +>t == t : boolean +>t : T +>t : T + + var r6 = t != t; +>r6 : boolean +>t != t : boolean +>t : T +>t : T + + var r7 = t === t; +>r7 : boolean +>t === t : boolean +>t : T +>t : T + + var r8 = t !== t; +>r8 : boolean +>t !== t : boolean +>t : T +>t : T +} diff --git a/tests/baselines/reference/comparisonOperatorWithOneOperandIsAny.types b/tests/baselines/reference/comparisonOperatorWithOneOperandIsAny.types new file mode 100644 index 00000000000..e132f03cfa3 --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithOneOperandIsAny.types @@ -0,0 +1,815 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny.ts === +var x: any; +>x : any + +enum E { a, b, c } +>E : E +>a : E +>b : E +>c : E + +function foo(t: T) { +>foo : (t: T) => void +>T : T +>t : T +>T : T + + var foo_r1 = t < x; +>foo_r1 : boolean +>t < x : boolean +>t : T +>x : any + + var foo_r2 = t > x; +>foo_r2 : boolean +>t > x : boolean +>t : T +>x : any + + var foo_r3 = t <= x; +>foo_r3 : boolean +>t <= x : boolean +>t : T +>x : any + + var foo_r4 = t >= x; +>foo_r4 : boolean +>t >= x : boolean +>t : T +>x : any + + var foo_r5 = t == x; +>foo_r5 : boolean +>t == x : boolean +>t : T +>x : any + + var foo_r6 = t != x; +>foo_r6 : boolean +>t != x : boolean +>t : T +>x : any + + var foo_r7 = t === x; +>foo_r7 : boolean +>t === x : boolean +>t : T +>x : any + + var foo_r8 = t !== x; +>foo_r8 : boolean +>t !== x : boolean +>t : T +>x : any + + var foo_r1 = x < t; +>foo_r1 : boolean +>x < t : boolean +>x : any +>t : T + + var foo_r2 = x > t; +>foo_r2 : boolean +>x > t : boolean +>x : any +>t : T + + var foo_r3 = x <= t; +>foo_r3 : boolean +>x <= t : boolean +>x : any +>t : T + + var foo_r4 = x >= t; +>foo_r4 : boolean +>x >= t : boolean +>x : any +>t : T + + var foo_r5 = x == t; +>foo_r5 : boolean +>x == t : boolean +>x : any +>t : T + + var foo_r6 = x != t; +>foo_r6 : boolean +>x != t : boolean +>x : any +>t : T + + var foo_r7 = x === t; +>foo_r7 : boolean +>x === t : boolean +>x : any +>t : T + + var foo_r8 = x !== t; +>foo_r8 : boolean +>x !== t : boolean +>x : any +>t : T +} + +var a: boolean; +>a : boolean + +var b: number; +>b : number + +var c: string; +>c : string + +var d: void; +>d : void + +var e: E; +>e : E +>E : E + +var f: {}; +>f : {} + +var g: string[]; +>g : string[] + +// operator < +var r1a1 = x < a; +>r1a1 : boolean +>x < a : boolean +>x : any +>a : boolean + +var r1a2 = x < b; +>r1a2 : boolean +>x < b : boolean +>x : any +>b : number + +var r1a3 = x < c; +>r1a3 : boolean +>x < c : boolean +>x : any +>c : string + +var r1a4 = x < d; +>r1a4 : boolean +>x < d : boolean +>x : any +>d : void + +var r1a5 = x < e; +>r1a5 : boolean +>x < e : boolean +>x : any +>e : E + +var r1a6 = x < f; +>r1a6 : boolean +>x < f : boolean +>x : any +>f : {} + +var r1a7 = x < g; +>r1a7 : boolean +>x < g : boolean +>x : any +>g : string[] + +var r1b1 = a < x; +>r1b1 : boolean +>a < x : boolean +>a : boolean +>x : any + +var r1b2 = b < x; +>r1b2 : boolean +>b < x : boolean +>b : number +>x : any + +var r1b3 = c < x; +>r1b3 : boolean +>c < x : boolean +>c : string +>x : any + +var r1b4 = d < x; +>r1b4 : boolean +>d < x : boolean +>d : void +>x : any + +var r1b5 = e < x; +>r1b5 : boolean +>e < x : boolean +>e : E +>x : any + +var r1b6 = f < x; +>r1b6 : boolean +>f < x : boolean +>f : {} +>x : any + +var r1b7 = g < x; +>r1b7 : boolean +>g < x : boolean +>g : string[] +>x : any + +// operator > +var r2a1 = x > a; +>r2a1 : boolean +>x > a : boolean +>x : any +>a : boolean + +var r2a2 = x > b; +>r2a2 : boolean +>x > b : boolean +>x : any +>b : number + +var r2a3 = x > c; +>r2a3 : boolean +>x > c : boolean +>x : any +>c : string + +var r2a4 = x > d; +>r2a4 : boolean +>x > d : boolean +>x : any +>d : void + +var r2a5 = x > e; +>r2a5 : boolean +>x > e : boolean +>x : any +>e : E + +var r2a6 = x > f; +>r2a6 : boolean +>x > f : boolean +>x : any +>f : {} + +var r2a7 = x > g; +>r2a7 : boolean +>x > g : boolean +>x : any +>g : string[] + +var r2b1 = a > x; +>r2b1 : boolean +>a > x : boolean +>a : boolean +>x : any + +var r2b2 = b > x; +>r2b2 : boolean +>b > x : boolean +>b : number +>x : any + +var r2b3 = c > x; +>r2b3 : boolean +>c > x : boolean +>c : string +>x : any + +var r2b4 = d > x; +>r2b4 : boolean +>d > x : boolean +>d : void +>x : any + +var r2b5 = e > x; +>r2b5 : boolean +>e > x : boolean +>e : E +>x : any + +var r2b6 = f > x; +>r2b6 : boolean +>f > x : boolean +>f : {} +>x : any + +var r2b7 = g > x; +>r2b7 : boolean +>g > x : boolean +>g : string[] +>x : any + +// operator <= +var r3a1 = x <= a; +>r3a1 : boolean +>x <= a : boolean +>x : any +>a : boolean + +var r3a2 = x <= b; +>r3a2 : boolean +>x <= b : boolean +>x : any +>b : number + +var r3a3 = x <= c; +>r3a3 : boolean +>x <= c : boolean +>x : any +>c : string + +var r3a4 = x <= d; +>r3a4 : boolean +>x <= d : boolean +>x : any +>d : void + +var r3a5 = x <= e; +>r3a5 : boolean +>x <= e : boolean +>x : any +>e : E + +var r3a6 = x <= f; +>r3a6 : boolean +>x <= f : boolean +>x : any +>f : {} + +var r3a7 = x <= g; +>r3a7 : boolean +>x <= g : boolean +>x : any +>g : string[] + +var r3b1 = a <= x; +>r3b1 : boolean +>a <= x : boolean +>a : boolean +>x : any + +var r3b2 = b <= x; +>r3b2 : boolean +>b <= x : boolean +>b : number +>x : any + +var r3b3 = c <= x; +>r3b3 : boolean +>c <= x : boolean +>c : string +>x : any + +var r3b4 = d <= x; +>r3b4 : boolean +>d <= x : boolean +>d : void +>x : any + +var r3b5 = e <= x; +>r3b5 : boolean +>e <= x : boolean +>e : E +>x : any + +var r3b6 = f <= x; +>r3b6 : boolean +>f <= x : boolean +>f : {} +>x : any + +var r3b7 = g <= x; +>r3b7 : boolean +>g <= x : boolean +>g : string[] +>x : any + +// operator >= +var r4a1 = x >= a; +>r4a1 : boolean +>x >= a : boolean +>x : any +>a : boolean + +var r4a2 = x >= b; +>r4a2 : boolean +>x >= b : boolean +>x : any +>b : number + +var r4a3 = x >= c; +>r4a3 : boolean +>x >= c : boolean +>x : any +>c : string + +var r4a4 = x >= d; +>r4a4 : boolean +>x >= d : boolean +>x : any +>d : void + +var r4a5 = x >= e; +>r4a5 : boolean +>x >= e : boolean +>x : any +>e : E + +var r4a6 = x >= f; +>r4a6 : boolean +>x >= f : boolean +>x : any +>f : {} + +var r4a7 = x >= g; +>r4a7 : boolean +>x >= g : boolean +>x : any +>g : string[] + +var r4b1 = a >= x; +>r4b1 : boolean +>a >= x : boolean +>a : boolean +>x : any + +var r4b2 = b >= x; +>r4b2 : boolean +>b >= x : boolean +>b : number +>x : any + +var r4b3 = c >= x; +>r4b3 : boolean +>c >= x : boolean +>c : string +>x : any + +var r4b4 = d >= x; +>r4b4 : boolean +>d >= x : boolean +>d : void +>x : any + +var r4b5 = e >= x; +>r4b5 : boolean +>e >= x : boolean +>e : E +>x : any + +var r4b6 = f >= x; +>r4b6 : boolean +>f >= x : boolean +>f : {} +>x : any + +var r4b7 = g >= x; +>r4b7 : boolean +>g >= x : boolean +>g : string[] +>x : any + +// operator == +var r5a1 = x == a; +>r5a1 : boolean +>x == a : boolean +>x : any +>a : boolean + +var r5a2 = x == b; +>r5a2 : boolean +>x == b : boolean +>x : any +>b : number + +var r5a3 = x == c; +>r5a3 : boolean +>x == c : boolean +>x : any +>c : string + +var r5a4 = x == d; +>r5a4 : boolean +>x == d : boolean +>x : any +>d : void + +var r5a5 = x == e; +>r5a5 : boolean +>x == e : boolean +>x : any +>e : E + +var r5a6 = x == f; +>r5a6 : boolean +>x == f : boolean +>x : any +>f : {} + +var r5a7 = x == g; +>r5a7 : boolean +>x == g : boolean +>x : any +>g : string[] + +var r5b1 = a == x; +>r5b1 : boolean +>a == x : boolean +>a : boolean +>x : any + +var r5b2 = b == x; +>r5b2 : boolean +>b == x : boolean +>b : number +>x : any + +var r5b3 = c == x; +>r5b3 : boolean +>c == x : boolean +>c : string +>x : any + +var r5b4 = d == x; +>r5b4 : boolean +>d == x : boolean +>d : void +>x : any + +var r5b5 = e == x; +>r5b5 : boolean +>e == x : boolean +>e : E +>x : any + +var r5b6 = f == x; +>r5b6 : boolean +>f == x : boolean +>f : {} +>x : any + +var r5b7 = g == x; +>r5b7 : boolean +>g == x : boolean +>g : string[] +>x : any + +// operator != +var r6a1 = x != a; +>r6a1 : boolean +>x != a : boolean +>x : any +>a : boolean + +var r6a2 = x != b; +>r6a2 : boolean +>x != b : boolean +>x : any +>b : number + +var r6a3 = x != c; +>r6a3 : boolean +>x != c : boolean +>x : any +>c : string + +var r6a4 = x != d; +>r6a4 : boolean +>x != d : boolean +>x : any +>d : void + +var r6a5 = x != e; +>r6a5 : boolean +>x != e : boolean +>x : any +>e : E + +var r6a6 = x != f; +>r6a6 : boolean +>x != f : boolean +>x : any +>f : {} + +var r6a7 = x != g; +>r6a7 : boolean +>x != g : boolean +>x : any +>g : string[] + +var r6b1 = a != x; +>r6b1 : boolean +>a != x : boolean +>a : boolean +>x : any + +var r6b2 = b != x; +>r6b2 : boolean +>b != x : boolean +>b : number +>x : any + +var r6b3 = c != x; +>r6b3 : boolean +>c != x : boolean +>c : string +>x : any + +var r6b4 = d != x; +>r6b4 : boolean +>d != x : boolean +>d : void +>x : any + +var r6b5 = e != x; +>r6b5 : boolean +>e != x : boolean +>e : E +>x : any + +var r6b6 = f != x; +>r6b6 : boolean +>f != x : boolean +>f : {} +>x : any + +var r6b7 = g != x; +>r6b7 : boolean +>g != x : boolean +>g : string[] +>x : any + +// operator === +var r7a1 = x === a; +>r7a1 : boolean +>x === a : boolean +>x : any +>a : boolean + +var r7a2 = x === b; +>r7a2 : boolean +>x === b : boolean +>x : any +>b : number + +var r7a3 = x === c; +>r7a3 : boolean +>x === c : boolean +>x : any +>c : string + +var r7a4 = x === d; +>r7a4 : boolean +>x === d : boolean +>x : any +>d : void + +var r7a5 = x === e; +>r7a5 : boolean +>x === e : boolean +>x : any +>e : E + +var r7a6 = x === f; +>r7a6 : boolean +>x === f : boolean +>x : any +>f : {} + +var r7a7 = x === g; +>r7a7 : boolean +>x === g : boolean +>x : any +>g : string[] + +var r7b1 = a === x; +>r7b1 : boolean +>a === x : boolean +>a : boolean +>x : any + +var r7b2 = b === x; +>r7b2 : boolean +>b === x : boolean +>b : number +>x : any + +var r7b3 = c === x; +>r7b3 : boolean +>c === x : boolean +>c : string +>x : any + +var r7b4 = d === x; +>r7b4 : boolean +>d === x : boolean +>d : void +>x : any + +var r7b5 = e === x; +>r7b5 : boolean +>e === x : boolean +>e : E +>x : any + +var r7b6 = f === x; +>r7b6 : boolean +>f === x : boolean +>f : {} +>x : any + +var r7b7 = g === x; +>r7b7 : boolean +>g === x : boolean +>g : string[] +>x : any + +// operator !== +var r8a1 = x !== a; +>r8a1 : boolean +>x !== a : boolean +>x : any +>a : boolean + +var r8a2 = x !== b; +>r8a2 : boolean +>x !== b : boolean +>x : any +>b : number + +var r8a3 = x !== c; +>r8a3 : boolean +>x !== c : boolean +>x : any +>c : string + +var r8a4 = x !== d; +>r8a4 : boolean +>x !== d : boolean +>x : any +>d : void + +var r8a5 = x !== e; +>r8a5 : boolean +>x !== e : boolean +>x : any +>e : E + +var r8a6 = x !== f; +>r8a6 : boolean +>x !== f : boolean +>x : any +>f : {} + +var r8a7 = x !== g; +>r8a7 : boolean +>x !== g : boolean +>x : any +>g : string[] + +var r8b1 = a !== x; +>r8b1 : boolean +>a !== x : boolean +>a : boolean +>x : any + +var r8b2 = b !== x; +>r8b2 : boolean +>b !== x : boolean +>b : number +>x : any + +var r8b3 = c !== x; +>r8b3 : boolean +>c !== x : boolean +>c : string +>x : any + +var r8b4 = d !== x; +>r8b4 : boolean +>d !== x : boolean +>d : void +>x : any + +var r8b5 = e !== x; +>r8b5 : boolean +>e !== x : boolean +>e : E +>x : any + +var r8b6 = f !== x; +>r8b6 : boolean +>f !== x : boolean +>f : {} +>x : any + +var r8b7 = g !== x; +>r8b7 : boolean +>g !== x : boolean +>g : string[] +>x : any + diff --git a/tests/baselines/reference/comparisonOperatorWithOneOperandIsNull.types b/tests/baselines/reference/comparisonOperatorWithOneOperandIsNull.types new file mode 100644 index 00000000000..d1b30eb7f6a --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithOneOperandIsNull.types @@ -0,0 +1,684 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts === +enum E { a, b, c } +>E : E +>a : E +>b : E +>c : E + +function foo(t: T) { +>foo : (t: T) => void +>T : T +>t : T +>T : T + + var foo_r1 = t < null; +>foo_r1 : boolean +>t < null : boolean +>t : T + + var foo_r2 = t > null; +>foo_r2 : boolean +>t > null : boolean +>t : T + + var foo_r3 = t <= null; +>foo_r3 : boolean +>t <= null : boolean +>t : T + + var foo_r4 = t >= null; +>foo_r4 : boolean +>t >= null : boolean +>t : T + + var foo_r5 = t == null; +>foo_r5 : boolean +>t == null : boolean +>t : T + + var foo_r6 = t != null; +>foo_r6 : boolean +>t != null : boolean +>t : T + + var foo_r7 = t === null; +>foo_r7 : boolean +>t === null : boolean +>t : T + + var foo_r8 = t !== null; +>foo_r8 : boolean +>t !== null : boolean +>t : T + + var foo_r1 = null < t; +>foo_r1 : boolean +>null < t : boolean +>t : T + + var foo_r2 = null > t; +>foo_r2 : boolean +>null > t : boolean +>t : T + + var foo_r3 = null <= t; +>foo_r3 : boolean +>null <= t : boolean +>t : T + + var foo_r4 = null >= t; +>foo_r4 : boolean +>null >= t : boolean +>t : T + + var foo_r5 = null == t; +>foo_r5 : boolean +>null == t : boolean +>t : T + + var foo_r6 = null != t; +>foo_r6 : boolean +>null != t : boolean +>t : T + + var foo_r7 = null === t; +>foo_r7 : boolean +>null === t : boolean +>t : T + + var foo_r8 = null !== t; +>foo_r8 : boolean +>null !== t : boolean +>t : T +} + +var a: boolean; +>a : boolean + +var b: number; +>b : number + +var c: string; +>c : string + +var d: void; +>d : void + +var e: E; +>e : E +>E : E + +var f: {}; +>f : {} + +var g: string[]; +>g : string[] + +// operator < +var r1a1 = null < a; +>r1a1 : boolean +>null < a : boolean +>a : boolean + +var r1a2 = null < b; +>r1a2 : boolean +>null < b : boolean +>b : number + +var r1a3 = null < c; +>r1a3 : boolean +>null < c : boolean +>c : string + +var r1a4 = null < d; +>r1a4 : boolean +>null < d : boolean +>d : void + +var r1a5 = null < e; +>r1a5 : boolean +>null < e : boolean +>e : E + +var r1a6 = null < f; +>r1a6 : boolean +>null < f : boolean +>f : {} + +var r1a7 = null < g; +>r1a7 : boolean +>null < g : boolean +>g : string[] + +var r1b1 = a < null; +>r1b1 : boolean +>a < null : boolean +>a : boolean + +var r1b2 = b < null; +>r1b2 : boolean +>b < null : boolean +>b : number + +var r1b3 = c < null; +>r1b3 : boolean +>c < null : boolean +>c : string + +var r1b4 = d < null; +>r1b4 : boolean +>d < null : boolean +>d : void + +var r1b5 = e < null; +>r1b5 : boolean +>e < null : boolean +>e : E + +var r1b6 = f < null; +>r1b6 : boolean +>f < null : boolean +>f : {} + +var r1b7 = g < null; +>r1b7 : boolean +>g < null : boolean +>g : string[] + +// operator > +var r2a1 = null > a; +>r2a1 : boolean +>null > a : boolean +>a : boolean + +var r2a2 = null > b; +>r2a2 : boolean +>null > b : boolean +>b : number + +var r2a3 = null > c; +>r2a3 : boolean +>null > c : boolean +>c : string + +var r2a4 = null > d; +>r2a4 : boolean +>null > d : boolean +>d : void + +var r2a5 = null > e; +>r2a5 : boolean +>null > e : boolean +>e : E + +var r2a6 = null > f; +>r2a6 : boolean +>null > f : boolean +>f : {} + +var r2a7 = null > g; +>r2a7 : boolean +>null > g : boolean +>g : string[] + +var r2b1 = a > null; +>r2b1 : boolean +>a > null : boolean +>a : boolean + +var r2b2 = b > null; +>r2b2 : boolean +>b > null : boolean +>b : number + +var r2b3 = c > null; +>r2b3 : boolean +>c > null : boolean +>c : string + +var r2b4 = d > null; +>r2b4 : boolean +>d > null : boolean +>d : void + +var r2b5 = e > null; +>r2b5 : boolean +>e > null : boolean +>e : E + +var r2b6 = f > null; +>r2b6 : boolean +>f > null : boolean +>f : {} + +var r2b7 = g > null; +>r2b7 : boolean +>g > null : boolean +>g : string[] + +// operator <= +var r3a1 = null <= a; +>r3a1 : boolean +>null <= a : boolean +>a : boolean + +var r3a2 = null <= b; +>r3a2 : boolean +>null <= b : boolean +>b : number + +var r3a3 = null <= c; +>r3a3 : boolean +>null <= c : boolean +>c : string + +var r3a4 = null <= d; +>r3a4 : boolean +>null <= d : boolean +>d : void + +var r3a5 = null <= e; +>r3a5 : boolean +>null <= e : boolean +>e : E + +var r3a6 = null <= f; +>r3a6 : boolean +>null <= f : boolean +>f : {} + +var r3a7 = null <= g; +>r3a7 : boolean +>null <= g : boolean +>g : string[] + +var r3b1 = a <= null; +>r3b1 : boolean +>a <= null : boolean +>a : boolean + +var r3b2 = b <= null; +>r3b2 : boolean +>b <= null : boolean +>b : number + +var r3b3 = c <= null; +>r3b3 : boolean +>c <= null : boolean +>c : string + +var r3b4 = d <= null; +>r3b4 : boolean +>d <= null : boolean +>d : void + +var r3b5 = e <= null; +>r3b5 : boolean +>e <= null : boolean +>e : E + +var r3b6 = f <= null; +>r3b6 : boolean +>f <= null : boolean +>f : {} + +var r3b7 = g <= null; +>r3b7 : boolean +>g <= null : boolean +>g : string[] + +// operator >= +var r4a1 = null >= a; +>r4a1 : boolean +>null >= a : boolean +>a : boolean + +var r4a2 = null >= b; +>r4a2 : boolean +>null >= b : boolean +>b : number + +var r4a3 = null >= c; +>r4a3 : boolean +>null >= c : boolean +>c : string + +var r4a4 = null >= d; +>r4a4 : boolean +>null >= d : boolean +>d : void + +var r4a5 = null >= e; +>r4a5 : boolean +>null >= e : boolean +>e : E + +var r4a6 = null >= f; +>r4a6 : boolean +>null >= f : boolean +>f : {} + +var r4a7 = null >= g; +>r4a7 : boolean +>null >= g : boolean +>g : string[] + +var r4b1 = a >= null; +>r4b1 : boolean +>a >= null : boolean +>a : boolean + +var r4b2 = b >= null; +>r4b2 : boolean +>b >= null : boolean +>b : number + +var r4b3 = c >= null; +>r4b3 : boolean +>c >= null : boolean +>c : string + +var r4b4 = d >= null; +>r4b4 : boolean +>d >= null : boolean +>d : void + +var r4b5 = e >= null; +>r4b5 : boolean +>e >= null : boolean +>e : E + +var r4b6 = f >= null; +>r4b6 : boolean +>f >= null : boolean +>f : {} + +var r4b7 = g >= null; +>r4b7 : boolean +>g >= null : boolean +>g : string[] + +// operator == +var r5a1 = null == a; +>r5a1 : boolean +>null == a : boolean +>a : boolean + +var r5a2 = null == b; +>r5a2 : boolean +>null == b : boolean +>b : number + +var r5a3 = null == c; +>r5a3 : boolean +>null == c : boolean +>c : string + +var r5a4 = null == d; +>r5a4 : boolean +>null == d : boolean +>d : void + +var r5a5 = null == e; +>r5a5 : boolean +>null == e : boolean +>e : E + +var r5a6 = null == f; +>r5a6 : boolean +>null == f : boolean +>f : {} + +var r5a7 = null == g; +>r5a7 : boolean +>null == g : boolean +>g : string[] + +var r5b1 = a == null; +>r5b1 : boolean +>a == null : boolean +>a : boolean + +var r5b2 = b == null; +>r5b2 : boolean +>b == null : boolean +>b : number + +var r5b3 = c == null; +>r5b3 : boolean +>c == null : boolean +>c : string + +var r5b4 = d == null; +>r5b4 : boolean +>d == null : boolean +>d : void + +var r5b5 = e == null; +>r5b5 : boolean +>e == null : boolean +>e : E + +var r5b6 = f == null; +>r5b6 : boolean +>f == null : boolean +>f : {} + +var r5b7 = g == null; +>r5b7 : boolean +>g == null : boolean +>g : string[] + +// operator != +var r6a1 = null != a; +>r6a1 : boolean +>null != a : boolean +>a : boolean + +var r6a2 = null != b; +>r6a2 : boolean +>null != b : boolean +>b : number + +var r6a3 = null != c; +>r6a3 : boolean +>null != c : boolean +>c : string + +var r6a4 = null != d; +>r6a4 : boolean +>null != d : boolean +>d : void + +var r6a5 = null != e; +>r6a5 : boolean +>null != e : boolean +>e : E + +var r6a6 = null != f; +>r6a6 : boolean +>null != f : boolean +>f : {} + +var r6a7 = null != g; +>r6a7 : boolean +>null != g : boolean +>g : string[] + +var r6b1 = a != null; +>r6b1 : boolean +>a != null : boolean +>a : boolean + +var r6b2 = b != null; +>r6b2 : boolean +>b != null : boolean +>b : number + +var r6b3 = c != null; +>r6b3 : boolean +>c != null : boolean +>c : string + +var r6b4 = d != null; +>r6b4 : boolean +>d != null : boolean +>d : void + +var r6b5 = e != null; +>r6b5 : boolean +>e != null : boolean +>e : E + +var r6b6 = f != null; +>r6b6 : boolean +>f != null : boolean +>f : {} + +var r6b7 = g != null; +>r6b7 : boolean +>g != null : boolean +>g : string[] + +// operator === +var r7a1 = null === a; +>r7a1 : boolean +>null === a : boolean +>a : boolean + +var r7a2 = null === b; +>r7a2 : boolean +>null === b : boolean +>b : number + +var r7a3 = null === c; +>r7a3 : boolean +>null === c : boolean +>c : string + +var r7a4 = null === d; +>r7a4 : boolean +>null === d : boolean +>d : void + +var r7a5 = null === e; +>r7a5 : boolean +>null === e : boolean +>e : E + +var r7a6 = null === f; +>r7a6 : boolean +>null === f : boolean +>f : {} + +var r7a7 = null === g; +>r7a7 : boolean +>null === g : boolean +>g : string[] + +var r7b1 = a === null; +>r7b1 : boolean +>a === null : boolean +>a : boolean + +var r7b2 = b === null; +>r7b2 : boolean +>b === null : boolean +>b : number + +var r7b3 = c === null; +>r7b3 : boolean +>c === null : boolean +>c : string + +var r7b4 = d === null; +>r7b4 : boolean +>d === null : boolean +>d : void + +var r7b5 = e === null; +>r7b5 : boolean +>e === null : boolean +>e : E + +var r7b6 = f === null; +>r7b6 : boolean +>f === null : boolean +>f : {} + +var r7b7 = g === null; +>r7b7 : boolean +>g === null : boolean +>g : string[] + +// operator !== +var r8a1 = null !== a; +>r8a1 : boolean +>null !== a : boolean +>a : boolean + +var r8a2 = null !== b; +>r8a2 : boolean +>null !== b : boolean +>b : number + +var r8a3 = null !== c; +>r8a3 : boolean +>null !== c : boolean +>c : string + +var r8a4 = null !== d; +>r8a4 : boolean +>null !== d : boolean +>d : void + +var r8a5 = null !== e; +>r8a5 : boolean +>null !== e : boolean +>e : E + +var r8a6 = null !== f; +>r8a6 : boolean +>null !== f : boolean +>f : {} + +var r8a7 = null !== g; +>r8a7 : boolean +>null !== g : boolean +>g : string[] + +var r8b1 = a !== null; +>r8b1 : boolean +>a !== null : boolean +>a : boolean + +var r8b2 = b !== null; +>r8b2 : boolean +>b !== null : boolean +>b : number + +var r8b3 = c !== null; +>r8b3 : boolean +>c !== null : boolean +>c : string + +var r8b4 = d !== null; +>r8b4 : boolean +>d !== null : boolean +>d : void + +var r8b5 = e !== null; +>r8b5 : boolean +>e !== null : boolean +>e : E + +var r8b6 = f !== null; +>r8b6 : boolean +>f !== null : boolean +>f : {} + +var r8b7 = g !== null; +>r8b7 : boolean +>g !== null : boolean +>g : string[] + diff --git a/tests/baselines/reference/comparisonOperatorWithOneOperandIsUndefined.types b/tests/baselines/reference/comparisonOperatorWithOneOperandIsUndefined.types new file mode 100644 index 00000000000..b4a70c3e3d6 --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithOneOperandIsUndefined.types @@ -0,0 +1,816 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined.ts === +var x: typeof undefined; +>x : any +>undefined : undefined + +enum E { a, b, c } +>E : E +>a : E +>b : E +>c : E + +function foo(t: T) { +>foo : (t: T) => void +>T : T +>t : T +>T : T + + var foo_r1 = t < x; +>foo_r1 : boolean +>t < x : boolean +>t : T +>x : any + + var foo_r2 = t > x; +>foo_r2 : boolean +>t > x : boolean +>t : T +>x : any + + var foo_r3 = t <= x; +>foo_r3 : boolean +>t <= x : boolean +>t : T +>x : any + + var foo_r4 = t >= x; +>foo_r4 : boolean +>t >= x : boolean +>t : T +>x : any + + var foo_r5 = t == x; +>foo_r5 : boolean +>t == x : boolean +>t : T +>x : any + + var foo_r6 = t != x; +>foo_r6 : boolean +>t != x : boolean +>t : T +>x : any + + var foo_r7 = t === x; +>foo_r7 : boolean +>t === x : boolean +>t : T +>x : any + + var foo_r8 = t !== x; +>foo_r8 : boolean +>t !== x : boolean +>t : T +>x : any + + var foo_r1 = x < t; +>foo_r1 : boolean +>x < t : boolean +>x : any +>t : T + + var foo_r2 = x > t; +>foo_r2 : boolean +>x > t : boolean +>x : any +>t : T + + var foo_r3 = x <= t; +>foo_r3 : boolean +>x <= t : boolean +>x : any +>t : T + + var foo_r4 = x >= t; +>foo_r4 : boolean +>x >= t : boolean +>x : any +>t : T + + var foo_r5 = x == t; +>foo_r5 : boolean +>x == t : boolean +>x : any +>t : T + + var foo_r6 = x != t; +>foo_r6 : boolean +>x != t : boolean +>x : any +>t : T + + var foo_r7 = x === t; +>foo_r7 : boolean +>x === t : boolean +>x : any +>t : T + + var foo_r8 = x !== t; +>foo_r8 : boolean +>x !== t : boolean +>x : any +>t : T +} + +var a: boolean; +>a : boolean + +var b: number; +>b : number + +var c: string; +>c : string + +var d: void; +>d : void + +var e: E; +>e : E +>E : E + +var f: {}; +>f : {} + +var g: string[]; +>g : string[] + +// operator < +var r1a1 = x < a; +>r1a1 : boolean +>x < a : boolean +>x : any +>a : boolean + +var r1a2 = x < b; +>r1a2 : boolean +>x < b : boolean +>x : any +>b : number + +var r1a3 = x < c; +>r1a3 : boolean +>x < c : boolean +>x : any +>c : string + +var r1a4 = x < d; +>r1a4 : boolean +>x < d : boolean +>x : any +>d : void + +var r1a5 = x < e; +>r1a5 : boolean +>x < e : boolean +>x : any +>e : E + +var r1a6 = x < f; +>r1a6 : boolean +>x < f : boolean +>x : any +>f : {} + +var r1a7 = x < g; +>r1a7 : boolean +>x < g : boolean +>x : any +>g : string[] + +var r1b1 = a < x; +>r1b1 : boolean +>a < x : boolean +>a : boolean +>x : any + +var r1b2 = b < x; +>r1b2 : boolean +>b < x : boolean +>b : number +>x : any + +var r1b3 = c < x; +>r1b3 : boolean +>c < x : boolean +>c : string +>x : any + +var r1b4 = d < x; +>r1b4 : boolean +>d < x : boolean +>d : void +>x : any + +var r1b5 = e < x; +>r1b5 : boolean +>e < x : boolean +>e : E +>x : any + +var r1b6 = f < x; +>r1b6 : boolean +>f < x : boolean +>f : {} +>x : any + +var r1b7 = g < x; +>r1b7 : boolean +>g < x : boolean +>g : string[] +>x : any + +// operator > +var r2a1 = x > a; +>r2a1 : boolean +>x > a : boolean +>x : any +>a : boolean + +var r2a2 = x > b; +>r2a2 : boolean +>x > b : boolean +>x : any +>b : number + +var r2a3 = x > c; +>r2a3 : boolean +>x > c : boolean +>x : any +>c : string + +var r2a4 = x > d; +>r2a4 : boolean +>x > d : boolean +>x : any +>d : void + +var r2a5 = x > e; +>r2a5 : boolean +>x > e : boolean +>x : any +>e : E + +var r2a6 = x > f; +>r2a6 : boolean +>x > f : boolean +>x : any +>f : {} + +var r2a7 = x > g; +>r2a7 : boolean +>x > g : boolean +>x : any +>g : string[] + +var r2b1 = a > x; +>r2b1 : boolean +>a > x : boolean +>a : boolean +>x : any + +var r2b2 = b > x; +>r2b2 : boolean +>b > x : boolean +>b : number +>x : any + +var r2b3 = c > x; +>r2b3 : boolean +>c > x : boolean +>c : string +>x : any + +var r2b4 = d > x; +>r2b4 : boolean +>d > x : boolean +>d : void +>x : any + +var r2b5 = e > x; +>r2b5 : boolean +>e > x : boolean +>e : E +>x : any + +var r2b6 = f > x; +>r2b6 : boolean +>f > x : boolean +>f : {} +>x : any + +var r2b7 = g > x; +>r2b7 : boolean +>g > x : boolean +>g : string[] +>x : any + +// operator <= +var r3a1 = x <= a; +>r3a1 : boolean +>x <= a : boolean +>x : any +>a : boolean + +var r3a2 = x <= b; +>r3a2 : boolean +>x <= b : boolean +>x : any +>b : number + +var r3a3 = x <= c; +>r3a3 : boolean +>x <= c : boolean +>x : any +>c : string + +var r3a4 = x <= d; +>r3a4 : boolean +>x <= d : boolean +>x : any +>d : void + +var r3a5 = x <= e; +>r3a5 : boolean +>x <= e : boolean +>x : any +>e : E + +var r3a6 = x <= f; +>r3a6 : boolean +>x <= f : boolean +>x : any +>f : {} + +var r3a7 = x <= g; +>r3a7 : boolean +>x <= g : boolean +>x : any +>g : string[] + +var r3b1 = a <= x; +>r3b1 : boolean +>a <= x : boolean +>a : boolean +>x : any + +var r3b2 = b <= x; +>r3b2 : boolean +>b <= x : boolean +>b : number +>x : any + +var r3b3 = c <= x; +>r3b3 : boolean +>c <= x : boolean +>c : string +>x : any + +var r3b4 = d <= x; +>r3b4 : boolean +>d <= x : boolean +>d : void +>x : any + +var r3b5 = e <= x; +>r3b5 : boolean +>e <= x : boolean +>e : E +>x : any + +var r3b6 = f <= x; +>r3b6 : boolean +>f <= x : boolean +>f : {} +>x : any + +var r3b7 = g <= x; +>r3b7 : boolean +>g <= x : boolean +>g : string[] +>x : any + +// operator >= +var r4a1 = x >= a; +>r4a1 : boolean +>x >= a : boolean +>x : any +>a : boolean + +var r4a2 = x >= b; +>r4a2 : boolean +>x >= b : boolean +>x : any +>b : number + +var r4a3 = x >= c; +>r4a3 : boolean +>x >= c : boolean +>x : any +>c : string + +var r4a4 = x >= d; +>r4a4 : boolean +>x >= d : boolean +>x : any +>d : void + +var r4a5 = x >= e; +>r4a5 : boolean +>x >= e : boolean +>x : any +>e : E + +var r4a6 = x >= f; +>r4a6 : boolean +>x >= f : boolean +>x : any +>f : {} + +var r4a7 = x >= g; +>r4a7 : boolean +>x >= g : boolean +>x : any +>g : string[] + +var r4b1 = a >= x; +>r4b1 : boolean +>a >= x : boolean +>a : boolean +>x : any + +var r4b2 = b >= x; +>r4b2 : boolean +>b >= x : boolean +>b : number +>x : any + +var r4b3 = c >= x; +>r4b3 : boolean +>c >= x : boolean +>c : string +>x : any + +var r4b4 = d >= x; +>r4b4 : boolean +>d >= x : boolean +>d : void +>x : any + +var r4b5 = e >= x; +>r4b5 : boolean +>e >= x : boolean +>e : E +>x : any + +var r4b6 = f >= x; +>r4b6 : boolean +>f >= x : boolean +>f : {} +>x : any + +var r4b7 = g >= x; +>r4b7 : boolean +>g >= x : boolean +>g : string[] +>x : any + +// operator == +var r5a1 = x == a; +>r5a1 : boolean +>x == a : boolean +>x : any +>a : boolean + +var r5a2 = x == b; +>r5a2 : boolean +>x == b : boolean +>x : any +>b : number + +var r5a3 = x == c; +>r5a3 : boolean +>x == c : boolean +>x : any +>c : string + +var r5a4 = x == d; +>r5a4 : boolean +>x == d : boolean +>x : any +>d : void + +var r5a5 = x == e; +>r5a5 : boolean +>x == e : boolean +>x : any +>e : E + +var r5a6 = x == f; +>r5a6 : boolean +>x == f : boolean +>x : any +>f : {} + +var r5a7 = x == g; +>r5a7 : boolean +>x == g : boolean +>x : any +>g : string[] + +var r5b1 = a == x; +>r5b1 : boolean +>a == x : boolean +>a : boolean +>x : any + +var r5b2 = b == x; +>r5b2 : boolean +>b == x : boolean +>b : number +>x : any + +var r5b3 = c == x; +>r5b3 : boolean +>c == x : boolean +>c : string +>x : any + +var r5b4 = d == x; +>r5b4 : boolean +>d == x : boolean +>d : void +>x : any + +var r5b5 = e == x; +>r5b5 : boolean +>e == x : boolean +>e : E +>x : any + +var r5b6 = f == x; +>r5b6 : boolean +>f == x : boolean +>f : {} +>x : any + +var r5b7 = g == x; +>r5b7 : boolean +>g == x : boolean +>g : string[] +>x : any + +// operator != +var r6a1 = x != a; +>r6a1 : boolean +>x != a : boolean +>x : any +>a : boolean + +var r6a2 = x != b; +>r6a2 : boolean +>x != b : boolean +>x : any +>b : number + +var r6a3 = x != c; +>r6a3 : boolean +>x != c : boolean +>x : any +>c : string + +var r6a4 = x != d; +>r6a4 : boolean +>x != d : boolean +>x : any +>d : void + +var r6a5 = x != e; +>r6a5 : boolean +>x != e : boolean +>x : any +>e : E + +var r6a6 = x != f; +>r6a6 : boolean +>x != f : boolean +>x : any +>f : {} + +var r6a7 = x != g; +>r6a7 : boolean +>x != g : boolean +>x : any +>g : string[] + +var r6b1 = a != x; +>r6b1 : boolean +>a != x : boolean +>a : boolean +>x : any + +var r6b2 = b != x; +>r6b2 : boolean +>b != x : boolean +>b : number +>x : any + +var r6b3 = c != x; +>r6b3 : boolean +>c != x : boolean +>c : string +>x : any + +var r6b4 = d != x; +>r6b4 : boolean +>d != x : boolean +>d : void +>x : any + +var r6b5 = e != x; +>r6b5 : boolean +>e != x : boolean +>e : E +>x : any + +var r6b6 = f != x; +>r6b6 : boolean +>f != x : boolean +>f : {} +>x : any + +var r6b7 = g != x; +>r6b7 : boolean +>g != x : boolean +>g : string[] +>x : any + +// operator === +var r7a1 = x === a; +>r7a1 : boolean +>x === a : boolean +>x : any +>a : boolean + +var r7a2 = x === b; +>r7a2 : boolean +>x === b : boolean +>x : any +>b : number + +var r7a3 = x === c; +>r7a3 : boolean +>x === c : boolean +>x : any +>c : string + +var r7a4 = x === d; +>r7a4 : boolean +>x === d : boolean +>x : any +>d : void + +var r7a5 = x === e; +>r7a5 : boolean +>x === e : boolean +>x : any +>e : E + +var r7a6 = x === f; +>r7a6 : boolean +>x === f : boolean +>x : any +>f : {} + +var r7a7 = x === g; +>r7a7 : boolean +>x === g : boolean +>x : any +>g : string[] + +var r7b1 = a === x; +>r7b1 : boolean +>a === x : boolean +>a : boolean +>x : any + +var r7b2 = b === x; +>r7b2 : boolean +>b === x : boolean +>b : number +>x : any + +var r7b3 = c === x; +>r7b3 : boolean +>c === x : boolean +>c : string +>x : any + +var r7b4 = d === x; +>r7b4 : boolean +>d === x : boolean +>d : void +>x : any + +var r7b5 = e === x; +>r7b5 : boolean +>e === x : boolean +>e : E +>x : any + +var r7b6 = f === x; +>r7b6 : boolean +>f === x : boolean +>f : {} +>x : any + +var r7b7 = g === x; +>r7b7 : boolean +>g === x : boolean +>g : string[] +>x : any + +// operator !== +var r8a1 = x !== a; +>r8a1 : boolean +>x !== a : boolean +>x : any +>a : boolean + +var r8a2 = x !== b; +>r8a2 : boolean +>x !== b : boolean +>x : any +>b : number + +var r8a3 = x !== c; +>r8a3 : boolean +>x !== c : boolean +>x : any +>c : string + +var r8a4 = x !== d; +>r8a4 : boolean +>x !== d : boolean +>x : any +>d : void + +var r8a5 = x !== e; +>r8a5 : boolean +>x !== e : boolean +>x : any +>e : E + +var r8a6 = x !== f; +>r8a6 : boolean +>x !== f : boolean +>x : any +>f : {} + +var r8a7 = x !== g; +>r8a7 : boolean +>x !== g : boolean +>x : any +>g : string[] + +var r8b1 = a !== x; +>r8b1 : boolean +>a !== x : boolean +>a : boolean +>x : any + +var r8b2 = b !== x; +>r8b2 : boolean +>b !== x : boolean +>b : number +>x : any + +var r8b3 = c !== x; +>r8b3 : boolean +>c !== x : boolean +>c : string +>x : any + +var r8b4 = d !== x; +>r8b4 : boolean +>d !== x : boolean +>d : void +>x : any + +var r8b5 = e !== x; +>r8b5 : boolean +>e !== x : boolean +>e : E +>x : any + +var r8b6 = f !== x; +>r8b6 : boolean +>f !== x : boolean +>f : {} +>x : any + +var r8b7 = g !== x; +>r8b7 : boolean +>g !== x : boolean +>g : string[] +>x : any + diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeEnumAndNumber.types b/tests/baselines/reference/comparisonOperatorWithSubtypeEnumAndNumber.types new file mode 100644 index 00000000000..2dfe5913a24 --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeEnumAndNumber.types @@ -0,0 +1,358 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber.ts === +enum E { a, b, c } +>E : E +>a : E +>b : E +>c : E + +var a: E; +>a : E +>E : E + +var b: number; +>b : number + +// operator < +var ra1 = a < b; +>ra1 : boolean +>a < b : boolean +>a : E +>b : number + +var ra2 = b < a; +>ra2 : boolean +>b < a : boolean +>b : number +>a : E + +var ra3 = E.a < b; +>ra3 : boolean +>E.a < b : boolean +>E.a : E +>E : typeof E +>a : E +>b : number + +var ra4 = b < E.a; +>ra4 : boolean +>b < E.a : boolean +>b : number +>E.a : E +>E : typeof E +>a : E + +var ra5 = E.a < 0; +>ra5 : boolean +>E.a < 0 : boolean +>E.a : E +>E : typeof E +>a : E + +var ra6 = 0 < E.a; +>ra6 : boolean +>0 < E.a : boolean +>E.a : E +>E : typeof E +>a : E + +// operator > +var rb1 = a > b; +>rb1 : boolean +>a > b : boolean +>a : E +>b : number + +var rb2 = b > a; +>rb2 : boolean +>b > a : boolean +>b : number +>a : E + +var rb3 = E.a > b; +>rb3 : boolean +>E.a > b : boolean +>E.a : E +>E : typeof E +>a : E +>b : number + +var rb4 = b > E.a; +>rb4 : boolean +>b > E.a : boolean +>b : number +>E.a : E +>E : typeof E +>a : E + +var rb5 = E.a > 0; +>rb5 : boolean +>E.a > 0 : boolean +>E.a : E +>E : typeof E +>a : E + +var rb6 = 0 > E.a; +>rb6 : boolean +>0 > E.a : boolean +>E.a : E +>E : typeof E +>a : E + +// operator <= +var rc1 = a <= b; +>rc1 : boolean +>a <= b : boolean +>a : E +>b : number + +var rc2 = b <= a; +>rc2 : boolean +>b <= a : boolean +>b : number +>a : E + +var rc3 = E.a <= b; +>rc3 : boolean +>E.a <= b : boolean +>E.a : E +>E : typeof E +>a : E +>b : number + +var rc4 = b <= E.a; +>rc4 : boolean +>b <= E.a : boolean +>b : number +>E.a : E +>E : typeof E +>a : E + +var rc5 = E.a <= 0; +>rc5 : boolean +>E.a <= 0 : boolean +>E.a : E +>E : typeof E +>a : E + +var rc6 = 0 <= E.a; +>rc6 : boolean +>0 <= E.a : boolean +>E.a : E +>E : typeof E +>a : E + +// operator >= +var rd1 = a >= b; +>rd1 : boolean +>a >= b : boolean +>a : E +>b : number + +var rd2 = b >= a; +>rd2 : boolean +>b >= a : boolean +>b : number +>a : E + +var rd3 = E.a >= b; +>rd3 : boolean +>E.a >= b : boolean +>E.a : E +>E : typeof E +>a : E +>b : number + +var rd4 = b >= E.a; +>rd4 : boolean +>b >= E.a : boolean +>b : number +>E.a : E +>E : typeof E +>a : E + +var rd5 = E.a >= 0; +>rd5 : boolean +>E.a >= 0 : boolean +>E.a : E +>E : typeof E +>a : E + +var rd6 = 0 >= E.a; +>rd6 : boolean +>0 >= E.a : boolean +>E.a : E +>E : typeof E +>a : E + +// operator == +var re1 = a == b; +>re1 : boolean +>a == b : boolean +>a : E +>b : number + +var re2 = b == a; +>re2 : boolean +>b == a : boolean +>b : number +>a : E + +var re3 = E.a == b; +>re3 : boolean +>E.a == b : boolean +>E.a : E +>E : typeof E +>a : E +>b : number + +var re4 = b == E.a; +>re4 : boolean +>b == E.a : boolean +>b : number +>E.a : E +>E : typeof E +>a : E + +var re5 = E.a == 0; +>re5 : boolean +>E.a == 0 : boolean +>E.a : E +>E : typeof E +>a : E + +var re6 = 0 == E.a; +>re6 : boolean +>0 == E.a : boolean +>E.a : E +>E : typeof E +>a : E + +// operator != +var rf1 = a != b; +>rf1 : boolean +>a != b : boolean +>a : E +>b : number + +var rf2 = b != a; +>rf2 : boolean +>b != a : boolean +>b : number +>a : E + +var rf3 = E.a != b; +>rf3 : boolean +>E.a != b : boolean +>E.a : E +>E : typeof E +>a : E +>b : number + +var rf4 = b != E.a; +>rf4 : boolean +>b != E.a : boolean +>b : number +>E.a : E +>E : typeof E +>a : E + +var rf5 = E.a != 0; +>rf5 : boolean +>E.a != 0 : boolean +>E.a : E +>E : typeof E +>a : E + +var rf6 = 0 != E.a; +>rf6 : boolean +>0 != E.a : boolean +>E.a : E +>E : typeof E +>a : E + +// operator === +var rg1 = a === b; +>rg1 : boolean +>a === b : boolean +>a : E +>b : number + +var rg2 = b === a; +>rg2 : boolean +>b === a : boolean +>b : number +>a : E + +var rg3 = E.a === b; +>rg3 : boolean +>E.a === b : boolean +>E.a : E +>E : typeof E +>a : E +>b : number + +var rg4 = b === E.a; +>rg4 : boolean +>b === E.a : boolean +>b : number +>E.a : E +>E : typeof E +>a : E + +var rg5 = E.a === 0; +>rg5 : boolean +>E.a === 0 : boolean +>E.a : E +>E : typeof E +>a : E + +var rg6 = 0 === E.a; +>rg6 : boolean +>0 === E.a : boolean +>E.a : E +>E : typeof E +>a : E + +// operator !== +var rh1 = a !== b; +>rh1 : boolean +>a !== b : boolean +>a : E +>b : number + +var rh2 = b !== a; +>rh2 : boolean +>b !== a : boolean +>b : number +>a : E + +var rh3 = E.a !== b; +>rh3 : boolean +>E.a !== b : boolean +>E.a : E +>E : typeof E +>a : E +>b : number + +var rh4 = b !== E.a; +>rh4 : boolean +>b !== E.a : boolean +>b : number +>E.a : E +>E : typeof E +>a : E + +var rh5 = E.a !== 0; +>rh5 : boolean +>E.a !== 0 : boolean +>E.a : E +>E : typeof E +>a : E + +var rh6 = 0 !== E.a; +>rh6 : boolean +>0 !== E.a : boolean +>E.a : E +>E : typeof E +>a : E + diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.types b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.types new file mode 100644 index 00000000000..b3a972958b3 --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.types @@ -0,0 +1,1236 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnCallSignature.ts === +class Base { +>Base : Base + + public a: string; +>a : string +} + +class Derived extends Base { +>Derived : Derived +>Base : Base + + public b: string; +>b : string +} + +var a1: { fn(): void }; +>a1 : { fn(): void; } +>fn : () => void + +var b1: { fn(): void }; +>b1 : { fn(): void; } +>fn : () => void + +var a2: { fn(a: number, b: string): void }; +>a2 : { fn(a: number, b: string): void; } +>fn : (a: number, b: string) => void +>a : number +>b : string + +var b2: { fn(a: number, b: string): void }; +>b2 : { fn(a: number, b: string): void; } +>fn : (a: number, b: string) => void +>a : number +>b : string + +var a3: { fn(a: number, b: string): void }; +>a3 : { fn(a: number, b: string): void; } +>fn : (a: number, b: string) => void +>a : number +>b : string + +var b3: { fn(a: number): void }; +>b3 : { fn(a: number): void; } +>fn : (a: number) => void +>a : number + +var a4: { fn(a: number, b: string): void }; +>a4 : { fn(a: number, b: string): void; } +>fn : (a: number, b: string) => void +>a : number +>b : string + +var b4: { fn(): void }; +>b4 : { fn(): void; } +>fn : () => void + +var a5: { fn(a: Base): void }; +>a5 : { fn(a: Base): void; } +>fn : (a: Base) => void +>a : Base +>Base : Base + +var b5: { fn(a: Derived): void }; +>b5 : { fn(a: Derived): void; } +>fn : (a: Derived) => void +>a : Derived +>Derived : Derived + +var a6: { fn(a: Derived, b: Base): void }; +>a6 : { fn(a: Derived, b: Base): void; } +>fn : (a: Derived, b: Base) => void +>a : Derived +>Derived : Derived +>b : Base +>Base : Base + +var b6: { fn(a: Base, b: Derived): void }; +>b6 : { fn(a: Base, b: Derived): void; } +>fn : (a: Base, b: Derived) => void +>a : Base +>Base : Base +>b : Derived +>Derived : Derived + +var a7: { fn(): void }; +>a7 : { fn(): void; } +>fn : () => void + +var b7: { fn(): Base }; +>b7 : { fn(): Base; } +>fn : () => Base +>Base : Base + +var a8: { fn(): Base }; +>a8 : { fn(): Base; } +>fn : () => Base +>Base : Base + +var b8: { fn(): Base }; +>b8 : { fn(): Base; } +>fn : () => Base +>Base : Base + +var a9: { fn(): Base }; +>a9 : { fn(): Base; } +>fn : () => Base +>Base : Base + +var b9: { fn(): Derived }; +>b9 : { fn(): Derived; } +>fn : () => Derived +>Derived : Derived + +var a10: { fn(a?: Base): void }; +>a10 : { fn(a?: Base): void; } +>fn : (a?: Base) => void +>a : Base +>Base : Base + +var b10: { fn(a?: Derived): void }; +>b10 : { fn(a?: Derived): void; } +>fn : (a?: Derived) => void +>a : Derived +>Derived : Derived + +var a11: { fn(...a: Base[]): void }; +>a11 : { fn(...a: Base[]): void; } +>fn : (...a: Base[]) => void +>a : Base[] +>Base : Base + +var b11: { fn(...a: Derived[]): void }; +>b11 : { fn(...a: Derived[]): void; } +>fn : (...a: Derived[]) => void +>a : Derived[] +>Derived : Derived + +//var a12: { fn(t: T, u: U): T[] }; +//var b12: { fn(a: A, b: B): A[] }; + +// operator < +var r1a1 = a1 < b1; +>r1a1 : boolean +>a1 < b1 : boolean +>a1 : { fn(): void; } +>b1 : { fn(): void; } + +var r1a2 = a2 < b2; +>r1a2 : boolean +>a2 < b2 : boolean +>a2 : { fn(a: number, b: string): void; } +>b2 : { fn(a: number, b: string): void; } + +var r1a3 = a3 < b3; +>r1a3 : boolean +>a3 < b3 : boolean +>a3 : { fn(a: number, b: string): void; } +>b3 : { fn(a: number): void; } + +var r1a4 = a4 < b4; +>r1a4 : boolean +>a4 < b4 : boolean +>a4 : { fn(a: number, b: string): void; } +>b4 : { fn(): void; } + +var r1a5 = a5 < b5; +>r1a5 : boolean +>a5 < b5 : boolean +>a5 : { fn(a: Base): void; } +>b5 : { fn(a: Derived): void; } + +var r1a6 = a6 < b6; +>r1a6 : boolean +>a6 < b6 : boolean +>a6 : { fn(a: Derived, b: Base): void; } +>b6 : { fn(a: Base, b: Derived): void; } + +var r1a7 = a7 < b7; +>r1a7 : boolean +>a7 < b7 : boolean +>a7 : { fn(): void; } +>b7 : { fn(): Base; } + +var r1a8 = a8 < b8; +>r1a8 : boolean +>a8 < b8 : boolean +>a8 : { fn(): Base; } +>b8 : { fn(): Base; } + +var r1a9 = a9 < b9; +>r1a9 : boolean +>a9 < b9 : boolean +>a9 : { fn(): Base; } +>b9 : { fn(): Derived; } + +var r1a10 = a10 < b10; +>r1a10 : boolean +>a10 < b10 : boolean +>a10 : { fn(a?: Base): void; } +>b10 : { fn(a?: Derived): void; } + +var r1a11 = a11 < b11; +>r1a11 : boolean +>a11 < b11 : boolean +>a11 : { fn(...a: Base[]): void; } +>b11 : { fn(...a: Derived[]): void; } + +//var r1a12 = a12 < b12; + +var r1b1 = b1 < a1; +>r1b1 : boolean +>b1 < a1 : boolean +>b1 : { fn(): void; } +>a1 : { fn(): void; } + +var r1b2 = b2 < a2; +>r1b2 : boolean +>b2 < a2 : boolean +>b2 : { fn(a: number, b: string): void; } +>a2 : { fn(a: number, b: string): void; } + +var r1b3 = b3 < a3; +>r1b3 : boolean +>b3 < a3 : boolean +>b3 : { fn(a: number): void; } +>a3 : { fn(a: number, b: string): void; } + +var r1b4 = b4 < a4; +>r1b4 : boolean +>b4 < a4 : boolean +>b4 : { fn(): void; } +>a4 : { fn(a: number, b: string): void; } + +var r1b5 = b5 < a5; +>r1b5 : boolean +>b5 < a5 : boolean +>b5 : { fn(a: Derived): void; } +>a5 : { fn(a: Base): void; } + +var r1b6 = b6 < a6; +>r1b6 : boolean +>b6 < a6 : boolean +>b6 : { fn(a: Base, b: Derived): void; } +>a6 : { fn(a: Derived, b: Base): void; } + +var r1b7 = b7 < a7; +>r1b7 : boolean +>b7 < a7 : boolean +>b7 : { fn(): Base; } +>a7 : { fn(): void; } + +var r1b8 = b8 < a8; +>r1b8 : boolean +>b8 < a8 : boolean +>b8 : { fn(): Base; } +>a8 : { fn(): Base; } + +var r1b9 = b9 < a9; +>r1b9 : boolean +>b9 < a9 : boolean +>b9 : { fn(): Derived; } +>a9 : { fn(): Base; } + +var r1b10 = b10 < a10; +>r1b10 : boolean +>b10 < a10 : boolean +>b10 : { fn(a?: Derived): void; } +>a10 : { fn(a?: Base): void; } + +var r1b11 = b11 < a11; +>r1b11 : boolean +>b11 < a11 : boolean +>b11 : { fn(...a: Derived[]): void; } +>a11 : { fn(...a: Base[]): void; } + +//var r1b12 = b12 < a12; + +// operator > +var r2a1 = a1 > b1; +>r2a1 : boolean +>a1 > b1 : boolean +>a1 : { fn(): void; } +>b1 : { fn(): void; } + +var r2a2 = a2 > b2; +>r2a2 : boolean +>a2 > b2 : boolean +>a2 : { fn(a: number, b: string): void; } +>b2 : { fn(a: number, b: string): void; } + +var r2a3 = a3 > b3; +>r2a3 : boolean +>a3 > b3 : boolean +>a3 : { fn(a: number, b: string): void; } +>b3 : { fn(a: number): void; } + +var r2a4 = a4 > b4; +>r2a4 : boolean +>a4 > b4 : boolean +>a4 : { fn(a: number, b: string): void; } +>b4 : { fn(): void; } + +var r2a5 = a5 > b5; +>r2a5 : boolean +>a5 > b5 : boolean +>a5 : { fn(a: Base): void; } +>b5 : { fn(a: Derived): void; } + +var r2a6 = a6 > b6; +>r2a6 : boolean +>a6 > b6 : boolean +>a6 : { fn(a: Derived, b: Base): void; } +>b6 : { fn(a: Base, b: Derived): void; } + +var r2a7 = a7 > b7; +>r2a7 : boolean +>a7 > b7 : boolean +>a7 : { fn(): void; } +>b7 : { fn(): Base; } + +var r2a8 = a8 > b8; +>r2a8 : boolean +>a8 > b8 : boolean +>a8 : { fn(): Base; } +>b8 : { fn(): Base; } + +var r2a9 = a9 > b9; +>r2a9 : boolean +>a9 > b9 : boolean +>a9 : { fn(): Base; } +>b9 : { fn(): Derived; } + +var r2a10 = a10 > b10; +>r2a10 : boolean +>a10 > b10 : boolean +>a10 : { fn(a?: Base): void; } +>b10 : { fn(a?: Derived): void; } + +var r2a11 = a11 > b11; +>r2a11 : boolean +>a11 > b11 : boolean +>a11 : { fn(...a: Base[]): void; } +>b11 : { fn(...a: Derived[]): void; } + +//var r2a12 = a12 > b12; + +var r2b1 = b1 > a1; +>r2b1 : boolean +>b1 > a1 : boolean +>b1 : { fn(): void; } +>a1 : { fn(): void; } + +var r2b2 = b2 > a2; +>r2b2 : boolean +>b2 > a2 : boolean +>b2 : { fn(a: number, b: string): void; } +>a2 : { fn(a: number, b: string): void; } + +var r2b3 = b3 > a3; +>r2b3 : boolean +>b3 > a3 : boolean +>b3 : { fn(a: number): void; } +>a3 : { fn(a: number, b: string): void; } + +var r2b4 = b4 > a4; +>r2b4 : boolean +>b4 > a4 : boolean +>b4 : { fn(): void; } +>a4 : { fn(a: number, b: string): void; } + +var r2b5 = b5 > a5; +>r2b5 : boolean +>b5 > a5 : boolean +>b5 : { fn(a: Derived): void; } +>a5 : { fn(a: Base): void; } + +var r2b6 = b6 > a6; +>r2b6 : boolean +>b6 > a6 : boolean +>b6 : { fn(a: Base, b: Derived): void; } +>a6 : { fn(a: Derived, b: Base): void; } + +var r2b7 = b7 > a7; +>r2b7 : boolean +>b7 > a7 : boolean +>b7 : { fn(): Base; } +>a7 : { fn(): void; } + +var r2b8 = b8 > a8; +>r2b8 : boolean +>b8 > a8 : boolean +>b8 : { fn(): Base; } +>a8 : { fn(): Base; } + +var r2b9 = b9 > a9; +>r2b9 : boolean +>b9 > a9 : boolean +>b9 : { fn(): Derived; } +>a9 : { fn(): Base; } + +var r2b10 = b10 > a10; +>r2b10 : boolean +>b10 > a10 : boolean +>b10 : { fn(a?: Derived): void; } +>a10 : { fn(a?: Base): void; } + +var r2b11 = b11 > a11; +>r2b11 : boolean +>b11 > a11 : boolean +>b11 : { fn(...a: Derived[]): void; } +>a11 : { fn(...a: Base[]): void; } + +//var r2b12 = b12 > a12; + +// operator <= +var r3a1 = a1 <= b1; +>r3a1 : boolean +>a1 <= b1 : boolean +>a1 : { fn(): void; } +>b1 : { fn(): void; } + +var r3a2 = a2 <= b2; +>r3a2 : boolean +>a2 <= b2 : boolean +>a2 : { fn(a: number, b: string): void; } +>b2 : { fn(a: number, b: string): void; } + +var r3a3 = a3 <= b3; +>r3a3 : boolean +>a3 <= b3 : boolean +>a3 : { fn(a: number, b: string): void; } +>b3 : { fn(a: number): void; } + +var r3a4 = a4 <= b4; +>r3a4 : boolean +>a4 <= b4 : boolean +>a4 : { fn(a: number, b: string): void; } +>b4 : { fn(): void; } + +var r3a5 = a5 <= b5; +>r3a5 : boolean +>a5 <= b5 : boolean +>a5 : { fn(a: Base): void; } +>b5 : { fn(a: Derived): void; } + +var r3a6 = a6 <= b6; +>r3a6 : boolean +>a6 <= b6 : boolean +>a6 : { fn(a: Derived, b: Base): void; } +>b6 : { fn(a: Base, b: Derived): void; } + +var r3a7 = a7 <= b7; +>r3a7 : boolean +>a7 <= b7 : boolean +>a7 : { fn(): void; } +>b7 : { fn(): Base; } + +var r3a8 = a8 <= b8; +>r3a8 : boolean +>a8 <= b8 : boolean +>a8 : { fn(): Base; } +>b8 : { fn(): Base; } + +var r3a9 = a9 <= b9; +>r3a9 : boolean +>a9 <= b9 : boolean +>a9 : { fn(): Base; } +>b9 : { fn(): Derived; } + +var r3a10 = a10 <= b10; +>r3a10 : boolean +>a10 <= b10 : boolean +>a10 : { fn(a?: Base): void; } +>b10 : { fn(a?: Derived): void; } + +var r3a11 = a11 <= b11; +>r3a11 : boolean +>a11 <= b11 : boolean +>a11 : { fn(...a: Base[]): void; } +>b11 : { fn(...a: Derived[]): void; } + +//var r3a12 = a12 <= b12; + +var r3b1 = b1 <= a1; +>r3b1 : boolean +>b1 <= a1 : boolean +>b1 : { fn(): void; } +>a1 : { fn(): void; } + +var r3b2 = b2 <= a2; +>r3b2 : boolean +>b2 <= a2 : boolean +>b2 : { fn(a: number, b: string): void; } +>a2 : { fn(a: number, b: string): void; } + +var r3b3 = b3 <= a3; +>r3b3 : boolean +>b3 <= a3 : boolean +>b3 : { fn(a: number): void; } +>a3 : { fn(a: number, b: string): void; } + +var r3b4 = b4 <= a4; +>r3b4 : boolean +>b4 <= a4 : boolean +>b4 : { fn(): void; } +>a4 : { fn(a: number, b: string): void; } + +var r3b5 = b5 <= a5; +>r3b5 : boolean +>b5 <= a5 : boolean +>b5 : { fn(a: Derived): void; } +>a5 : { fn(a: Base): void; } + +var r3b6 = b6 <= a6; +>r3b6 : boolean +>b6 <= a6 : boolean +>b6 : { fn(a: Base, b: Derived): void; } +>a6 : { fn(a: Derived, b: Base): void; } + +var r3b7 = b7 <= a7; +>r3b7 : boolean +>b7 <= a7 : boolean +>b7 : { fn(): Base; } +>a7 : { fn(): void; } + +var r3b8 = b8 <= a8; +>r3b8 : boolean +>b8 <= a8 : boolean +>b8 : { fn(): Base; } +>a8 : { fn(): Base; } + +var r3b9 = b9 <= a9; +>r3b9 : boolean +>b9 <= a9 : boolean +>b9 : { fn(): Derived; } +>a9 : { fn(): Base; } + +var r3b10 = b10 <= a10; +>r3b10 : boolean +>b10 <= a10 : boolean +>b10 : { fn(a?: Derived): void; } +>a10 : { fn(a?: Base): void; } + +var r3b11 = b11 <= a11; +>r3b11 : boolean +>b11 <= a11 : boolean +>b11 : { fn(...a: Derived[]): void; } +>a11 : { fn(...a: Base[]): void; } + +//var r3b12 = b12 <= a12; + +// operator >= +var r4a1 = a1 >= b1; +>r4a1 : boolean +>a1 >= b1 : boolean +>a1 : { fn(): void; } +>b1 : { fn(): void; } + +var r4a2 = a2 >= b2; +>r4a2 : boolean +>a2 >= b2 : boolean +>a2 : { fn(a: number, b: string): void; } +>b2 : { fn(a: number, b: string): void; } + +var r4a3 = a3 >= b3; +>r4a3 : boolean +>a3 >= b3 : boolean +>a3 : { fn(a: number, b: string): void; } +>b3 : { fn(a: number): void; } + +var r4a4 = a4 >= b4; +>r4a4 : boolean +>a4 >= b4 : boolean +>a4 : { fn(a: number, b: string): void; } +>b4 : { fn(): void; } + +var r4a5 = a5 >= b5; +>r4a5 : boolean +>a5 >= b5 : boolean +>a5 : { fn(a: Base): void; } +>b5 : { fn(a: Derived): void; } + +var r4a6 = a6 >= b6; +>r4a6 : boolean +>a6 >= b6 : boolean +>a6 : { fn(a: Derived, b: Base): void; } +>b6 : { fn(a: Base, b: Derived): void; } + +var r4a7 = a7 >= b7; +>r4a7 : boolean +>a7 >= b7 : boolean +>a7 : { fn(): void; } +>b7 : { fn(): Base; } + +var r4a8 = a8 >= b8; +>r4a8 : boolean +>a8 >= b8 : boolean +>a8 : { fn(): Base; } +>b8 : { fn(): Base; } + +var r4a9 = a9 >= b9; +>r4a9 : boolean +>a9 >= b9 : boolean +>a9 : { fn(): Base; } +>b9 : { fn(): Derived; } + +var r4a10 = a10 >= b10; +>r4a10 : boolean +>a10 >= b10 : boolean +>a10 : { fn(a?: Base): void; } +>b10 : { fn(a?: Derived): void; } + +var r4a11 = a11 >= b11; +>r4a11 : boolean +>a11 >= b11 : boolean +>a11 : { fn(...a: Base[]): void; } +>b11 : { fn(...a: Derived[]): void; } + +//var r4a12 = a12 >= b12; + +var r4b1 = b1 >= a1; +>r4b1 : boolean +>b1 >= a1 : boolean +>b1 : { fn(): void; } +>a1 : { fn(): void; } + +var r4b2 = b2 >= a2; +>r4b2 : boolean +>b2 >= a2 : boolean +>b2 : { fn(a: number, b: string): void; } +>a2 : { fn(a: number, b: string): void; } + +var r4b3 = b3 >= a3; +>r4b3 : boolean +>b3 >= a3 : boolean +>b3 : { fn(a: number): void; } +>a3 : { fn(a: number, b: string): void; } + +var r4b4 = b4 >= a4; +>r4b4 : boolean +>b4 >= a4 : boolean +>b4 : { fn(): void; } +>a4 : { fn(a: number, b: string): void; } + +var r4b5 = b5 >= a5; +>r4b5 : boolean +>b5 >= a5 : boolean +>b5 : { fn(a: Derived): void; } +>a5 : { fn(a: Base): void; } + +var r4b6 = b6 >= a6; +>r4b6 : boolean +>b6 >= a6 : boolean +>b6 : { fn(a: Base, b: Derived): void; } +>a6 : { fn(a: Derived, b: Base): void; } + +var r4b7 = b7 >= a7; +>r4b7 : boolean +>b7 >= a7 : boolean +>b7 : { fn(): Base; } +>a7 : { fn(): void; } + +var r4b8 = b8 >= a8; +>r4b8 : boolean +>b8 >= a8 : boolean +>b8 : { fn(): Base; } +>a8 : { fn(): Base; } + +var r4b9 = b9 >= a9; +>r4b9 : boolean +>b9 >= a9 : boolean +>b9 : { fn(): Derived; } +>a9 : { fn(): Base; } + +var r4b10 = b10 >= a10; +>r4b10 : boolean +>b10 >= a10 : boolean +>b10 : { fn(a?: Derived): void; } +>a10 : { fn(a?: Base): void; } + +var r4b11 = b11 >= a11; +>r4b11 : boolean +>b11 >= a11 : boolean +>b11 : { fn(...a: Derived[]): void; } +>a11 : { fn(...a: Base[]): void; } + +//var r4b12 = b12 >= a12; + +// operator == +var r5a1 = a1 == b1; +>r5a1 : boolean +>a1 == b1 : boolean +>a1 : { fn(): void; } +>b1 : { fn(): void; } + +var r5a2 = a2 == b2; +>r5a2 : boolean +>a2 == b2 : boolean +>a2 : { fn(a: number, b: string): void; } +>b2 : { fn(a: number, b: string): void; } + +var r5a3 = a3 == b3; +>r5a3 : boolean +>a3 == b3 : boolean +>a3 : { fn(a: number, b: string): void; } +>b3 : { fn(a: number): void; } + +var r5a4 = a4 == b4; +>r5a4 : boolean +>a4 == b4 : boolean +>a4 : { fn(a: number, b: string): void; } +>b4 : { fn(): void; } + +var r5a5 = a5 == b5; +>r5a5 : boolean +>a5 == b5 : boolean +>a5 : { fn(a: Base): void; } +>b5 : { fn(a: Derived): void; } + +var r5a6 = a6 == b6; +>r5a6 : boolean +>a6 == b6 : boolean +>a6 : { fn(a: Derived, b: Base): void; } +>b6 : { fn(a: Base, b: Derived): void; } + +var r5a7 = a7 == b7; +>r5a7 : boolean +>a7 == b7 : boolean +>a7 : { fn(): void; } +>b7 : { fn(): Base; } + +var r5a8 = a8 == b8; +>r5a8 : boolean +>a8 == b8 : boolean +>a8 : { fn(): Base; } +>b8 : { fn(): Base; } + +var r5a9 = a9 == b9; +>r5a9 : boolean +>a9 == b9 : boolean +>a9 : { fn(): Base; } +>b9 : { fn(): Derived; } + +var r5a10 = a10 == b10; +>r5a10 : boolean +>a10 == b10 : boolean +>a10 : { fn(a?: Base): void; } +>b10 : { fn(a?: Derived): void; } + +var r5a11 = a11 == b11; +>r5a11 : boolean +>a11 == b11 : boolean +>a11 : { fn(...a: Base[]): void; } +>b11 : { fn(...a: Derived[]): void; } + +//var r5a12 = a12 == b12; + +var r5b1 = b1 == a1; +>r5b1 : boolean +>b1 == a1 : boolean +>b1 : { fn(): void; } +>a1 : { fn(): void; } + +var r5b2 = b2 == a2; +>r5b2 : boolean +>b2 == a2 : boolean +>b2 : { fn(a: number, b: string): void; } +>a2 : { fn(a: number, b: string): void; } + +var r5b3 = b3 == a3; +>r5b3 : boolean +>b3 == a3 : boolean +>b3 : { fn(a: number): void; } +>a3 : { fn(a: number, b: string): void; } + +var r5b4 = b4 == a4; +>r5b4 : boolean +>b4 == a4 : boolean +>b4 : { fn(): void; } +>a4 : { fn(a: number, b: string): void; } + +var r5b5 = b5 == a5; +>r5b5 : boolean +>b5 == a5 : boolean +>b5 : { fn(a: Derived): void; } +>a5 : { fn(a: Base): void; } + +var r5b6 = b6 == a6; +>r5b6 : boolean +>b6 == a6 : boolean +>b6 : { fn(a: Base, b: Derived): void; } +>a6 : { fn(a: Derived, b: Base): void; } + +var r5b7 = b7 == a7; +>r5b7 : boolean +>b7 == a7 : boolean +>b7 : { fn(): Base; } +>a7 : { fn(): void; } + +var r5b8 = b8 == a8; +>r5b8 : boolean +>b8 == a8 : boolean +>b8 : { fn(): Base; } +>a8 : { fn(): Base; } + +var r5b9 = b9 == a9; +>r5b9 : boolean +>b9 == a9 : boolean +>b9 : { fn(): Derived; } +>a9 : { fn(): Base; } + +var r5b10 = b10 == a10; +>r5b10 : boolean +>b10 == a10 : boolean +>b10 : { fn(a?: Derived): void; } +>a10 : { fn(a?: Base): void; } + +var r5b11 = b11 == a11; +>r5b11 : boolean +>b11 == a11 : boolean +>b11 : { fn(...a: Derived[]): void; } +>a11 : { fn(...a: Base[]): void; } + +//var r5b12 = b12 == a12; + +// operator != +var r6a1 = a1 != b1; +>r6a1 : boolean +>a1 != b1 : boolean +>a1 : { fn(): void; } +>b1 : { fn(): void; } + +var r6a2 = a2 != b2; +>r6a2 : boolean +>a2 != b2 : boolean +>a2 : { fn(a: number, b: string): void; } +>b2 : { fn(a: number, b: string): void; } + +var r6a3 = a3 != b3; +>r6a3 : boolean +>a3 != b3 : boolean +>a3 : { fn(a: number, b: string): void; } +>b3 : { fn(a: number): void; } + +var r6a4 = a4 != b4; +>r6a4 : boolean +>a4 != b4 : boolean +>a4 : { fn(a: number, b: string): void; } +>b4 : { fn(): void; } + +var r6a5 = a5 != b5; +>r6a5 : boolean +>a5 != b5 : boolean +>a5 : { fn(a: Base): void; } +>b5 : { fn(a: Derived): void; } + +var r6a6 = a6 != b6; +>r6a6 : boolean +>a6 != b6 : boolean +>a6 : { fn(a: Derived, b: Base): void; } +>b6 : { fn(a: Base, b: Derived): void; } + +var r6a7 = a7 != b7; +>r6a7 : boolean +>a7 != b7 : boolean +>a7 : { fn(): void; } +>b7 : { fn(): Base; } + +var r6a8 = a8 != b8; +>r6a8 : boolean +>a8 != b8 : boolean +>a8 : { fn(): Base; } +>b8 : { fn(): Base; } + +var r6a9 = a9 != b9; +>r6a9 : boolean +>a9 != b9 : boolean +>a9 : { fn(): Base; } +>b9 : { fn(): Derived; } + +var r6a10 = a10 != b10; +>r6a10 : boolean +>a10 != b10 : boolean +>a10 : { fn(a?: Base): void; } +>b10 : { fn(a?: Derived): void; } + +var r6a11 = a11 != b11; +>r6a11 : boolean +>a11 != b11 : boolean +>a11 : { fn(...a: Base[]): void; } +>b11 : { fn(...a: Derived[]): void; } + +//var r6a12 = a12 != b12; + +var r6b1 = b1 != a1; +>r6b1 : boolean +>b1 != a1 : boolean +>b1 : { fn(): void; } +>a1 : { fn(): void; } + +var r6b2 = b2 != a2; +>r6b2 : boolean +>b2 != a2 : boolean +>b2 : { fn(a: number, b: string): void; } +>a2 : { fn(a: number, b: string): void; } + +var r6b3 = b3 != a3; +>r6b3 : boolean +>b3 != a3 : boolean +>b3 : { fn(a: number): void; } +>a3 : { fn(a: number, b: string): void; } + +var r6b4 = b4 != a4; +>r6b4 : boolean +>b4 != a4 : boolean +>b4 : { fn(): void; } +>a4 : { fn(a: number, b: string): void; } + +var r6b5 = b5 != a5; +>r6b5 : boolean +>b5 != a5 : boolean +>b5 : { fn(a: Derived): void; } +>a5 : { fn(a: Base): void; } + +var r6b6 = b6 != a6; +>r6b6 : boolean +>b6 != a6 : boolean +>b6 : { fn(a: Base, b: Derived): void; } +>a6 : { fn(a: Derived, b: Base): void; } + +var r6b7 = b7 != a7; +>r6b7 : boolean +>b7 != a7 : boolean +>b7 : { fn(): Base; } +>a7 : { fn(): void; } + +var r6b8 = b8 != a8; +>r6b8 : boolean +>b8 != a8 : boolean +>b8 : { fn(): Base; } +>a8 : { fn(): Base; } + +var r6b9 = b9 != a9; +>r6b9 : boolean +>b9 != a9 : boolean +>b9 : { fn(): Derived; } +>a9 : { fn(): Base; } + +var r6b10 = b10 != a10; +>r6b10 : boolean +>b10 != a10 : boolean +>b10 : { fn(a?: Derived): void; } +>a10 : { fn(a?: Base): void; } + +var r6b11 = b11 != a11; +>r6b11 : boolean +>b11 != a11 : boolean +>b11 : { fn(...a: Derived[]): void; } +>a11 : { fn(...a: Base[]): void; } + +//var r6b12 = b12 != a12; + +// operator === +var r7a1 = a1 === b1; +>r7a1 : boolean +>a1 === b1 : boolean +>a1 : { fn(): void; } +>b1 : { fn(): void; } + +var r7a2 = a2 === b2; +>r7a2 : boolean +>a2 === b2 : boolean +>a2 : { fn(a: number, b: string): void; } +>b2 : { fn(a: number, b: string): void; } + +var r7a3 = a3 === b3; +>r7a3 : boolean +>a3 === b3 : boolean +>a3 : { fn(a: number, b: string): void; } +>b3 : { fn(a: number): void; } + +var r7a4 = a4 === b4; +>r7a4 : boolean +>a4 === b4 : boolean +>a4 : { fn(a: number, b: string): void; } +>b4 : { fn(): void; } + +var r7a5 = a5 === b5; +>r7a5 : boolean +>a5 === b5 : boolean +>a5 : { fn(a: Base): void; } +>b5 : { fn(a: Derived): void; } + +var r7a6 = a6 === b6; +>r7a6 : boolean +>a6 === b6 : boolean +>a6 : { fn(a: Derived, b: Base): void; } +>b6 : { fn(a: Base, b: Derived): void; } + +var r7a7 = a7 === b7; +>r7a7 : boolean +>a7 === b7 : boolean +>a7 : { fn(): void; } +>b7 : { fn(): Base; } + +var r7a8 = a8 === b8; +>r7a8 : boolean +>a8 === b8 : boolean +>a8 : { fn(): Base; } +>b8 : { fn(): Base; } + +var r7a9 = a9 === b9; +>r7a9 : boolean +>a9 === b9 : boolean +>a9 : { fn(): Base; } +>b9 : { fn(): Derived; } + +var r7a10 = a10 === b10; +>r7a10 : boolean +>a10 === b10 : boolean +>a10 : { fn(a?: Base): void; } +>b10 : { fn(a?: Derived): void; } + +var r7a11 = a11 === b11; +>r7a11 : boolean +>a11 === b11 : boolean +>a11 : { fn(...a: Base[]): void; } +>b11 : { fn(...a: Derived[]): void; } + +//var r7a12 = a12 === b12; + +var r7b1 = b1 === a1; +>r7b1 : boolean +>b1 === a1 : boolean +>b1 : { fn(): void; } +>a1 : { fn(): void; } + +var r7b2 = b2 === a2; +>r7b2 : boolean +>b2 === a2 : boolean +>b2 : { fn(a: number, b: string): void; } +>a2 : { fn(a: number, b: string): void; } + +var r7b3 = b3 === a3; +>r7b3 : boolean +>b3 === a3 : boolean +>b3 : { fn(a: number): void; } +>a3 : { fn(a: number, b: string): void; } + +var r7b4 = b4 === a4; +>r7b4 : boolean +>b4 === a4 : boolean +>b4 : { fn(): void; } +>a4 : { fn(a: number, b: string): void; } + +var r7b5 = b5 === a5; +>r7b5 : boolean +>b5 === a5 : boolean +>b5 : { fn(a: Derived): void; } +>a5 : { fn(a: Base): void; } + +var r7b6 = b6 === a6; +>r7b6 : boolean +>b6 === a6 : boolean +>b6 : { fn(a: Base, b: Derived): void; } +>a6 : { fn(a: Derived, b: Base): void; } + +var r7b7 = b7 === a7; +>r7b7 : boolean +>b7 === a7 : boolean +>b7 : { fn(): Base; } +>a7 : { fn(): void; } + +var r7b8 = b8 === a8; +>r7b8 : boolean +>b8 === a8 : boolean +>b8 : { fn(): Base; } +>a8 : { fn(): Base; } + +var r7b9 = b9 === a9; +>r7b9 : boolean +>b9 === a9 : boolean +>b9 : { fn(): Derived; } +>a9 : { fn(): Base; } + +var r7b10 = b10 === a10; +>r7b10 : boolean +>b10 === a10 : boolean +>b10 : { fn(a?: Derived): void; } +>a10 : { fn(a?: Base): void; } + +var r7b11 = b11 === a11; +>r7b11 : boolean +>b11 === a11 : boolean +>b11 : { fn(...a: Derived[]): void; } +>a11 : { fn(...a: Base[]): void; } + +//var r7b12 = b12 === a12; + +// operator !== +var r8a1 = a1 !== b1; +>r8a1 : boolean +>a1 !== b1 : boolean +>a1 : { fn(): void; } +>b1 : { fn(): void; } + +var r8a2 = a2 !== b2; +>r8a2 : boolean +>a2 !== b2 : boolean +>a2 : { fn(a: number, b: string): void; } +>b2 : { fn(a: number, b: string): void; } + +var r8a3 = a3 !== b3; +>r8a3 : boolean +>a3 !== b3 : boolean +>a3 : { fn(a: number, b: string): void; } +>b3 : { fn(a: number): void; } + +var r8a4 = a4 !== b4; +>r8a4 : boolean +>a4 !== b4 : boolean +>a4 : { fn(a: number, b: string): void; } +>b4 : { fn(): void; } + +var r8a5 = a5 !== b5; +>r8a5 : boolean +>a5 !== b5 : boolean +>a5 : { fn(a: Base): void; } +>b5 : { fn(a: Derived): void; } + +var r8a6 = a6 !== b6; +>r8a6 : boolean +>a6 !== b6 : boolean +>a6 : { fn(a: Derived, b: Base): void; } +>b6 : { fn(a: Base, b: Derived): void; } + +var r8a7 = a7 !== b7; +>r8a7 : boolean +>a7 !== b7 : boolean +>a7 : { fn(): void; } +>b7 : { fn(): Base; } + +var r8a8 = a8 !== b8; +>r8a8 : boolean +>a8 !== b8 : boolean +>a8 : { fn(): Base; } +>b8 : { fn(): Base; } + +var r8a9 = a9 !== b9; +>r8a9 : boolean +>a9 !== b9 : boolean +>a9 : { fn(): Base; } +>b9 : { fn(): Derived; } + +var r8a10 = a10 !== b10; +>r8a10 : boolean +>a10 !== b10 : boolean +>a10 : { fn(a?: Base): void; } +>b10 : { fn(a?: Derived): void; } + +var r8a11 = a11 !== b11; +>r8a11 : boolean +>a11 !== b11 : boolean +>a11 : { fn(...a: Base[]): void; } +>b11 : { fn(...a: Derived[]): void; } + +//var r8a12 = a12 !== b12; + +var r8b1 = b1 !== a1; +>r8b1 : boolean +>b1 !== a1 : boolean +>b1 : { fn(): void; } +>a1 : { fn(): void; } + +var r8b2 = b2 !== a2; +>r8b2 : boolean +>b2 !== a2 : boolean +>b2 : { fn(a: number, b: string): void; } +>a2 : { fn(a: number, b: string): void; } + +var r8b3 = b3 !== a3; +>r8b3 : boolean +>b3 !== a3 : boolean +>b3 : { fn(a: number): void; } +>a3 : { fn(a: number, b: string): void; } + +var r8b4 = b4 !== a4; +>r8b4 : boolean +>b4 !== a4 : boolean +>b4 : { fn(): void; } +>a4 : { fn(a: number, b: string): void; } + +var r8b5 = b5 !== a5; +>r8b5 : boolean +>b5 !== a5 : boolean +>b5 : { fn(a: Derived): void; } +>a5 : { fn(a: Base): void; } + +var r8b6 = b6 !== a6; +>r8b6 : boolean +>b6 !== a6 : boolean +>b6 : { fn(a: Base, b: Derived): void; } +>a6 : { fn(a: Derived, b: Base): void; } + +var r8b7 = b7 !== a7; +>r8b7 : boolean +>b7 !== a7 : boolean +>b7 : { fn(): Base; } +>a7 : { fn(): void; } + +var r8b8 = b8 !== a8; +>r8b8 : boolean +>b8 !== a8 : boolean +>b8 : { fn(): Base; } +>a8 : { fn(): Base; } + +var r8b9 = b9 !== a9; +>r8b9 : boolean +>b9 !== a9 : boolean +>b9 : { fn(): Derived; } +>a9 : { fn(): Base; } + +var r8b10 = b10 !== a10; +>r8b10 : boolean +>b10 !== a10 : boolean +>b10 : { fn(a?: Derived): void; } +>a10 : { fn(a?: Base): void; } + +var r8b11 = b11 !== a11; +>r8b11 : boolean +>b11 !== a11 : boolean +>b11 : { fn(...a: Derived[]): void; } +>a11 : { fn(...a: Base[]): void; } + +//var r8b12 = b12 !== a12; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.types b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.types new file mode 100644 index 00000000000..737c13f183c --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.types @@ -0,0 +1,1023 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnConstructorSignature.ts === +class Base { +>Base : Base + + public a: string; +>a : string +} + +class Derived extends Base { +>Derived : Derived +>Base : Base + + public b: string; +>b : string +} + +var a1: { new (): Base }; +>a1 : new () => Base +>Base : Base + +var b1: { new (): Base }; +>b1 : new () => Base +>Base : Base + +var a2: { new (a: number, b: string): Base }; +>a2 : new (a: number, b: string) => Base +>a : number +>b : string +>Base : Base + +var b2: { new (a: number, b: string): Base }; +>b2 : new (a: number, b: string) => Base +>a : number +>b : string +>Base : Base + +var a3: { new (a: number, b: string): Base }; +>a3 : new (a: number, b: string) => Base +>a : number +>b : string +>Base : Base + +var b3: { new (a: number): Base }; +>b3 : new (a: number) => Base +>a : number +>Base : Base + +var a4: { new (a: number, b: string): Base }; +>a4 : new (a: number, b: string) => Base +>a : number +>b : string +>Base : Base + +var b4: { new (): Base }; +>b4 : new () => Base +>Base : Base + +var a5: { new (a: Base): Base }; +>a5 : new (a: Base) => Base +>a : Base +>Base : Base +>Base : Base + +var b5: { new (a: Derived): Base }; +>b5 : new (a: Derived) => Base +>a : Derived +>Derived : Derived +>Base : Base + +var a6: { new (a: Derived, b: Base): Base }; +>a6 : new (a: Derived, b: Base) => Base +>a : Derived +>Derived : Derived +>b : Base +>Base : Base +>Base : Base + +var b6: { new (a: Base, b: Derived): Base }; +>b6 : new (a: Base, b: Derived) => Base +>a : Base +>Base : Base +>b : Derived +>Derived : Derived +>Base : Base + +var a7: { new (): Base }; +>a7 : new () => Base +>Base : Base + +var b7: { new (): Derived }; +>b7 : new () => Derived +>Derived : Derived + +var a8: { new (a?: Base): Base }; +>a8 : new (a?: Base) => Base +>a : Base +>Base : Base +>Base : Base + +var b8: { new (a?: Derived): Base }; +>b8 : new (a?: Derived) => Base +>a : Derived +>Derived : Derived +>Base : Base + +var a9: { new (...a: Base[]): Base }; +>a9 : new (...a: Base[]) => Base +>a : Base[] +>Base : Base +>Base : Base + +var b9: { new (...a: Derived[]): Base }; +>b9 : new (...a: Derived[]) => Base +>a : Derived[] +>Derived : Derived +>Base : Base + +//var a10: { (t: T, u: U): T[] }; +//var b10: { (a: A, b: B): A[] }; + +// operator < +var r1a1 = a1 < b1; +>r1a1 : boolean +>a1 < b1 : boolean +>a1 : new () => Base +>b1 : new () => Base + +var r1a2 = a2 < b2; +>r1a2 : boolean +>a2 < b2 : boolean +>a2 : new (a: number, b: string) => Base +>b2 : new (a: number, b: string) => Base + +var r1a3 = a3 < b3; +>r1a3 : boolean +>a3 < b3 : boolean +>a3 : new (a: number, b: string) => Base +>b3 : new (a: number) => Base + +var r1a4 = a4 < b4; +>r1a4 : boolean +>a4 < b4 : boolean +>a4 : new (a: number, b: string) => Base +>b4 : new () => Base + +var r1a5 = a5 < b5; +>r1a5 : boolean +>a5 < b5 : boolean +>a5 : new (a: Base) => Base +>b5 : new (a: Derived) => Base + +var r1a6 = a6 < b6; +>r1a6 : boolean +>a6 < b6 : boolean +>a6 : new (a: Derived, b: Base) => Base +>b6 : new (a: Base, b: Derived) => Base + +var r1a7 = a7 < b7; +>r1a7 : boolean +>a7 < b7 : boolean +>a7 : new () => Base +>b7 : new () => Derived + +var r1a8 = a8 < b8; +>r1a8 : boolean +>a8 < b8 : boolean +>a8 : new (a?: Base) => Base +>b8 : new (a?: Derived) => Base + +var r1a9 = a9 < b9; +>r1a9 : boolean +>a9 < b9 : boolean +>a9 : new (...a: Base[]) => Base +>b9 : new (...a: Derived[]) => Base + +//var r1a10 = a10 < b10; + +var r1b1 = b1 < a1; +>r1b1 : boolean +>b1 < a1 : boolean +>b1 : new () => Base +>a1 : new () => Base + +var r1b2 = b2 < a2; +>r1b2 : boolean +>b2 < a2 : boolean +>b2 : new (a: number, b: string) => Base +>a2 : new (a: number, b: string) => Base + +var r1b3 = b3 < a3; +>r1b3 : boolean +>b3 < a3 : boolean +>b3 : new (a: number) => Base +>a3 : new (a: number, b: string) => Base + +var r1b4 = b4 < a4; +>r1b4 : boolean +>b4 < a4 : boolean +>b4 : new () => Base +>a4 : new (a: number, b: string) => Base + +var r1b5 = b5 < a5; +>r1b5 : boolean +>b5 < a5 : boolean +>b5 : new (a: Derived) => Base +>a5 : new (a: Base) => Base + +var r1b6 = b6 < a6; +>r1b6 : boolean +>b6 < a6 : boolean +>b6 : new (a: Base, b: Derived) => Base +>a6 : new (a: Derived, b: Base) => Base + +var r1b7 = b7 < a7; +>r1b7 : boolean +>b7 < a7 : boolean +>b7 : new () => Derived +>a7 : new () => Base + +var r1b8 = b8 < a8; +>r1b8 : boolean +>b8 < a8 : boolean +>b8 : new (a?: Derived) => Base +>a8 : new (a?: Base) => Base + +var r1b9 = b9 < a9; +>r1b9 : boolean +>b9 < a9 : boolean +>b9 : new (...a: Derived[]) => Base +>a9 : new (...a: Base[]) => Base + +//var r1b10 = b10 < a10; + +// operator > +var r2a1 = a1 > b1; +>r2a1 : boolean +>a1 > b1 : boolean +>a1 : new () => Base +>b1 : new () => Base + +var r2a2 = a2 > b2; +>r2a2 : boolean +>a2 > b2 : boolean +>a2 : new (a: number, b: string) => Base +>b2 : new (a: number, b: string) => Base + +var r2a3 = a3 > b3; +>r2a3 : boolean +>a3 > b3 : boolean +>a3 : new (a: number, b: string) => Base +>b3 : new (a: number) => Base + +var r2a4 = a4 > b4; +>r2a4 : boolean +>a4 > b4 : boolean +>a4 : new (a: number, b: string) => Base +>b4 : new () => Base + +var r2a5 = a5 > b5; +>r2a5 : boolean +>a5 > b5 : boolean +>a5 : new (a: Base) => Base +>b5 : new (a: Derived) => Base + +var r2a6 = a6 > b6; +>r2a6 : boolean +>a6 > b6 : boolean +>a6 : new (a: Derived, b: Base) => Base +>b6 : new (a: Base, b: Derived) => Base + +var r2a7 = a7 > b7; +>r2a7 : boolean +>a7 > b7 : boolean +>a7 : new () => Base +>b7 : new () => Derived + +var r2a8 = a8 > b8; +>r2a8 : boolean +>a8 > b8 : boolean +>a8 : new (a?: Base) => Base +>b8 : new (a?: Derived) => Base + +var r2a9 = a9 > b9; +>r2a9 : boolean +>a9 > b9 : boolean +>a9 : new (...a: Base[]) => Base +>b9 : new (...a: Derived[]) => Base + +//var r2a10 = a10 > b10; + +var r2b1 = b1 > a1; +>r2b1 : boolean +>b1 > a1 : boolean +>b1 : new () => Base +>a1 : new () => Base + +var r2b2 = b2 > a2; +>r2b2 : boolean +>b2 > a2 : boolean +>b2 : new (a: number, b: string) => Base +>a2 : new (a: number, b: string) => Base + +var r2b3 = b3 > a3; +>r2b3 : boolean +>b3 > a3 : boolean +>b3 : new (a: number) => Base +>a3 : new (a: number, b: string) => Base + +var r2b4 = b4 > a4; +>r2b4 : boolean +>b4 > a4 : boolean +>b4 : new () => Base +>a4 : new (a: number, b: string) => Base + +var r2b5 = b5 > a5; +>r2b5 : boolean +>b5 > a5 : boolean +>b5 : new (a: Derived) => Base +>a5 : new (a: Base) => Base + +var r2b6 = b6 > a6; +>r2b6 : boolean +>b6 > a6 : boolean +>b6 : new (a: Base, b: Derived) => Base +>a6 : new (a: Derived, b: Base) => Base + +var r2b7 = b7 > a7; +>r2b7 : boolean +>b7 > a7 : boolean +>b7 : new () => Derived +>a7 : new () => Base + +var r2b8 = b8 > a8; +>r2b8 : boolean +>b8 > a8 : boolean +>b8 : new (a?: Derived) => Base +>a8 : new (a?: Base) => Base + +var r2b9 = b9 > a9; +>r2b9 : boolean +>b9 > a9 : boolean +>b9 : new (...a: Derived[]) => Base +>a9 : new (...a: Base[]) => Base + +//var r2b10 = b10 > a10; + +// operator <= +var r3a1 = a1 <= b1; +>r3a1 : boolean +>a1 <= b1 : boolean +>a1 : new () => Base +>b1 : new () => Base + +var r3a2 = a2 <= b2; +>r3a2 : boolean +>a2 <= b2 : boolean +>a2 : new (a: number, b: string) => Base +>b2 : new (a: number, b: string) => Base + +var r3a3 = a3 <= b3; +>r3a3 : boolean +>a3 <= b3 : boolean +>a3 : new (a: number, b: string) => Base +>b3 : new (a: number) => Base + +var r3a4 = a4 <= b4; +>r3a4 : boolean +>a4 <= b4 : boolean +>a4 : new (a: number, b: string) => Base +>b4 : new () => Base + +var r3a5 = a5 <= b5; +>r3a5 : boolean +>a5 <= b5 : boolean +>a5 : new (a: Base) => Base +>b5 : new (a: Derived) => Base + +var r3a6 = a6 <= b6; +>r3a6 : boolean +>a6 <= b6 : boolean +>a6 : new (a: Derived, b: Base) => Base +>b6 : new (a: Base, b: Derived) => Base + +var r3a7 = a7 <= b7; +>r3a7 : boolean +>a7 <= b7 : boolean +>a7 : new () => Base +>b7 : new () => Derived + +var r3a8 = a8 <= b8; +>r3a8 : boolean +>a8 <= b8 : boolean +>a8 : new (a?: Base) => Base +>b8 : new (a?: Derived) => Base + +var r3a9 = a9 <= b9; +>r3a9 : boolean +>a9 <= b9 : boolean +>a9 : new (...a: Base[]) => Base +>b9 : new (...a: Derived[]) => Base + +//var r3a10 = a10 <= b10; + +var r3b1 = b1 <= a1; +>r3b1 : boolean +>b1 <= a1 : boolean +>b1 : new () => Base +>a1 : new () => Base + +var r3b2 = b2 <= a2; +>r3b2 : boolean +>b2 <= a2 : boolean +>b2 : new (a: number, b: string) => Base +>a2 : new (a: number, b: string) => Base + +var r3b3 = b3 <= a3; +>r3b3 : boolean +>b3 <= a3 : boolean +>b3 : new (a: number) => Base +>a3 : new (a: number, b: string) => Base + +var r3b4 = b4 <= a4; +>r3b4 : boolean +>b4 <= a4 : boolean +>b4 : new () => Base +>a4 : new (a: number, b: string) => Base + +var r3b5 = b5 <= a5; +>r3b5 : boolean +>b5 <= a5 : boolean +>b5 : new (a: Derived) => Base +>a5 : new (a: Base) => Base + +var r3b6 = b6 <= a6; +>r3b6 : boolean +>b6 <= a6 : boolean +>b6 : new (a: Base, b: Derived) => Base +>a6 : new (a: Derived, b: Base) => Base + +var r3b7 = b7 <= a7; +>r3b7 : boolean +>b7 <= a7 : boolean +>b7 : new () => Derived +>a7 : new () => Base + +var r3b8 = b8 <= a8; +>r3b8 : boolean +>b8 <= a8 : boolean +>b8 : new (a?: Derived) => Base +>a8 : new (a?: Base) => Base + +var r3b9 = b9 <= a9; +>r3b9 : boolean +>b9 <= a9 : boolean +>b9 : new (...a: Derived[]) => Base +>a9 : new (...a: Base[]) => Base + +//var r3b10 = b10 <= a10; + +// operator >= +var r4a1 = a1 >= b1; +>r4a1 : boolean +>a1 >= b1 : boolean +>a1 : new () => Base +>b1 : new () => Base + +var r4a2 = a2 >= b2; +>r4a2 : boolean +>a2 >= b2 : boolean +>a2 : new (a: number, b: string) => Base +>b2 : new (a: number, b: string) => Base + +var r4a3 = a3 >= b3; +>r4a3 : boolean +>a3 >= b3 : boolean +>a3 : new (a: number, b: string) => Base +>b3 : new (a: number) => Base + +var r4a4 = a4 >= b4; +>r4a4 : boolean +>a4 >= b4 : boolean +>a4 : new (a: number, b: string) => Base +>b4 : new () => Base + +var r4a5 = a5 >= b5; +>r4a5 : boolean +>a5 >= b5 : boolean +>a5 : new (a: Base) => Base +>b5 : new (a: Derived) => Base + +var r4a6 = a6 >= b6; +>r4a6 : boolean +>a6 >= b6 : boolean +>a6 : new (a: Derived, b: Base) => Base +>b6 : new (a: Base, b: Derived) => Base + +var r4a7 = a7 >= b7; +>r4a7 : boolean +>a7 >= b7 : boolean +>a7 : new () => Base +>b7 : new () => Derived + +var r4a8 = a8 >= b8; +>r4a8 : boolean +>a8 >= b8 : boolean +>a8 : new (a?: Base) => Base +>b8 : new (a?: Derived) => Base + +var r4a9 = a9 >= b9; +>r4a9 : boolean +>a9 >= b9 : boolean +>a9 : new (...a: Base[]) => Base +>b9 : new (...a: Derived[]) => Base + +//var r4a10 = a10 >= b10; + +var r4b1 = b1 >= a1; +>r4b1 : boolean +>b1 >= a1 : boolean +>b1 : new () => Base +>a1 : new () => Base + +var r4b2 = b2 >= a2; +>r4b2 : boolean +>b2 >= a2 : boolean +>b2 : new (a: number, b: string) => Base +>a2 : new (a: number, b: string) => Base + +var r4b3 = b3 >= a3; +>r4b3 : boolean +>b3 >= a3 : boolean +>b3 : new (a: number) => Base +>a3 : new (a: number, b: string) => Base + +var r4b4 = b4 >= a4; +>r4b4 : boolean +>b4 >= a4 : boolean +>b4 : new () => Base +>a4 : new (a: number, b: string) => Base + +var r4b5 = b5 >= a5; +>r4b5 : boolean +>b5 >= a5 : boolean +>b5 : new (a: Derived) => Base +>a5 : new (a: Base) => Base + +var r4b6 = b6 >= a6; +>r4b6 : boolean +>b6 >= a6 : boolean +>b6 : new (a: Base, b: Derived) => Base +>a6 : new (a: Derived, b: Base) => Base + +var r4b7 = b7 >= a7; +>r4b7 : boolean +>b7 >= a7 : boolean +>b7 : new () => Derived +>a7 : new () => Base + +var r4b8 = b8 >= a8; +>r4b8 : boolean +>b8 >= a8 : boolean +>b8 : new (a?: Derived) => Base +>a8 : new (a?: Base) => Base + +var r4b9 = b9 >= a9; +>r4b9 : boolean +>b9 >= a9 : boolean +>b9 : new (...a: Derived[]) => Base +>a9 : new (...a: Base[]) => Base + +//var r4b10 = b10 >= a10; + +// operator == +var r5a1 = a1 == b1; +>r5a1 : boolean +>a1 == b1 : boolean +>a1 : new () => Base +>b1 : new () => Base + +var r5a2 = a2 == b2; +>r5a2 : boolean +>a2 == b2 : boolean +>a2 : new (a: number, b: string) => Base +>b2 : new (a: number, b: string) => Base + +var r5a3 = a3 == b3; +>r5a3 : boolean +>a3 == b3 : boolean +>a3 : new (a: number, b: string) => Base +>b3 : new (a: number) => Base + +var r5a4 = a4 == b4; +>r5a4 : boolean +>a4 == b4 : boolean +>a4 : new (a: number, b: string) => Base +>b4 : new () => Base + +var r5a5 = a5 == b5; +>r5a5 : boolean +>a5 == b5 : boolean +>a5 : new (a: Base) => Base +>b5 : new (a: Derived) => Base + +var r5a6 = a6 == b6; +>r5a6 : boolean +>a6 == b6 : boolean +>a6 : new (a: Derived, b: Base) => Base +>b6 : new (a: Base, b: Derived) => Base + +var r5a7 = a7 == b7; +>r5a7 : boolean +>a7 == b7 : boolean +>a7 : new () => Base +>b7 : new () => Derived + +var r5a8 = a8 == b8; +>r5a8 : boolean +>a8 == b8 : boolean +>a8 : new (a?: Base) => Base +>b8 : new (a?: Derived) => Base + +var r5a9 = a9 == b9; +>r5a9 : boolean +>a9 == b9 : boolean +>a9 : new (...a: Base[]) => Base +>b9 : new (...a: Derived[]) => Base + +//var r5a10 = a10 == b10; + +var r5b1 = b1 == a1; +>r5b1 : boolean +>b1 == a1 : boolean +>b1 : new () => Base +>a1 : new () => Base + +var r5b2 = b2 == a2; +>r5b2 : boolean +>b2 == a2 : boolean +>b2 : new (a: number, b: string) => Base +>a2 : new (a: number, b: string) => Base + +var r5b3 = b3 == a3; +>r5b3 : boolean +>b3 == a3 : boolean +>b3 : new (a: number) => Base +>a3 : new (a: number, b: string) => Base + +var r5b4 = b4 == a4; +>r5b4 : boolean +>b4 == a4 : boolean +>b4 : new () => Base +>a4 : new (a: number, b: string) => Base + +var r5b5 = b5 == a5; +>r5b5 : boolean +>b5 == a5 : boolean +>b5 : new (a: Derived) => Base +>a5 : new (a: Base) => Base + +var r5b6 = b6 == a6; +>r5b6 : boolean +>b6 == a6 : boolean +>b6 : new (a: Base, b: Derived) => Base +>a6 : new (a: Derived, b: Base) => Base + +var r5b7 = b7 == a7; +>r5b7 : boolean +>b7 == a7 : boolean +>b7 : new () => Derived +>a7 : new () => Base + +var r5b8 = b8 == a8; +>r5b8 : boolean +>b8 == a8 : boolean +>b8 : new (a?: Derived) => Base +>a8 : new (a?: Base) => Base + +var r5b9 = b9 == a9; +>r5b9 : boolean +>b9 == a9 : boolean +>b9 : new (...a: Derived[]) => Base +>a9 : new (...a: Base[]) => Base + +//var r5b10 = b10 == a10; + +// operator != +var r6a1 = a1 != b1; +>r6a1 : boolean +>a1 != b1 : boolean +>a1 : new () => Base +>b1 : new () => Base + +var r6a2 = a2 != b2; +>r6a2 : boolean +>a2 != b2 : boolean +>a2 : new (a: number, b: string) => Base +>b2 : new (a: number, b: string) => Base + +var r6a3 = a3 != b3; +>r6a3 : boolean +>a3 != b3 : boolean +>a3 : new (a: number, b: string) => Base +>b3 : new (a: number) => Base + +var r6a4 = a4 != b4; +>r6a4 : boolean +>a4 != b4 : boolean +>a4 : new (a: number, b: string) => Base +>b4 : new () => Base + +var r6a5 = a5 != b5; +>r6a5 : boolean +>a5 != b5 : boolean +>a5 : new (a: Base) => Base +>b5 : new (a: Derived) => Base + +var r6a6 = a6 != b6; +>r6a6 : boolean +>a6 != b6 : boolean +>a6 : new (a: Derived, b: Base) => Base +>b6 : new (a: Base, b: Derived) => Base + +var r6a7 = a7 != b7; +>r6a7 : boolean +>a7 != b7 : boolean +>a7 : new () => Base +>b7 : new () => Derived + +var r6a8 = a8 != b8; +>r6a8 : boolean +>a8 != b8 : boolean +>a8 : new (a?: Base) => Base +>b8 : new (a?: Derived) => Base + +var r6a9 = a9 != b9; +>r6a9 : boolean +>a9 != b9 : boolean +>a9 : new (...a: Base[]) => Base +>b9 : new (...a: Derived[]) => Base + +//var r6a10 = a10 != b10; + +var r6b1 = b1 != a1; +>r6b1 : boolean +>b1 != a1 : boolean +>b1 : new () => Base +>a1 : new () => Base + +var r6b2 = b2 != a2; +>r6b2 : boolean +>b2 != a2 : boolean +>b2 : new (a: number, b: string) => Base +>a2 : new (a: number, b: string) => Base + +var r6b3 = b3 != a3; +>r6b3 : boolean +>b3 != a3 : boolean +>b3 : new (a: number) => Base +>a3 : new (a: number, b: string) => Base + +var r6b4 = b4 != a4; +>r6b4 : boolean +>b4 != a4 : boolean +>b4 : new () => Base +>a4 : new (a: number, b: string) => Base + +var r6b5 = b5 != a5; +>r6b5 : boolean +>b5 != a5 : boolean +>b5 : new (a: Derived) => Base +>a5 : new (a: Base) => Base + +var r6b6 = b6 != a6; +>r6b6 : boolean +>b6 != a6 : boolean +>b6 : new (a: Base, b: Derived) => Base +>a6 : new (a: Derived, b: Base) => Base + +var r6b7 = b7 != a7; +>r6b7 : boolean +>b7 != a7 : boolean +>b7 : new () => Derived +>a7 : new () => Base + +var r6b8 = b8 != a8; +>r6b8 : boolean +>b8 != a8 : boolean +>b8 : new (a?: Derived) => Base +>a8 : new (a?: Base) => Base + +var r6b9 = b9 != a9; +>r6b9 : boolean +>b9 != a9 : boolean +>b9 : new (...a: Derived[]) => Base +>a9 : new (...a: Base[]) => Base + +//var r6b10 = b10 != a10; + +// operator === +var r7a1 = a1 === b1; +>r7a1 : boolean +>a1 === b1 : boolean +>a1 : new () => Base +>b1 : new () => Base + +var r7a2 = a2 === b2; +>r7a2 : boolean +>a2 === b2 : boolean +>a2 : new (a: number, b: string) => Base +>b2 : new (a: number, b: string) => Base + +var r7a3 = a3 === b3; +>r7a3 : boolean +>a3 === b3 : boolean +>a3 : new (a: number, b: string) => Base +>b3 : new (a: number) => Base + +var r7a4 = a4 === b4; +>r7a4 : boolean +>a4 === b4 : boolean +>a4 : new (a: number, b: string) => Base +>b4 : new () => Base + +var r7a5 = a5 === b5; +>r7a5 : boolean +>a5 === b5 : boolean +>a5 : new (a: Base) => Base +>b5 : new (a: Derived) => Base + +var r7a6 = a6 === b6; +>r7a6 : boolean +>a6 === b6 : boolean +>a6 : new (a: Derived, b: Base) => Base +>b6 : new (a: Base, b: Derived) => Base + +var r7a7 = a7 === b7; +>r7a7 : boolean +>a7 === b7 : boolean +>a7 : new () => Base +>b7 : new () => Derived + +var r7a8 = a8 === b8; +>r7a8 : boolean +>a8 === b8 : boolean +>a8 : new (a?: Base) => Base +>b8 : new (a?: Derived) => Base + +var r7a9 = a9 === b9; +>r7a9 : boolean +>a9 === b9 : boolean +>a9 : new (...a: Base[]) => Base +>b9 : new (...a: Derived[]) => Base + +//var r7a10 = a10 === b10; + +var r7b1 = b1 === a1; +>r7b1 : boolean +>b1 === a1 : boolean +>b1 : new () => Base +>a1 : new () => Base + +var r7b2 = b2 === a2; +>r7b2 : boolean +>b2 === a2 : boolean +>b2 : new (a: number, b: string) => Base +>a2 : new (a: number, b: string) => Base + +var r7b3 = b3 === a3; +>r7b3 : boolean +>b3 === a3 : boolean +>b3 : new (a: number) => Base +>a3 : new (a: number, b: string) => Base + +var r7b4 = b4 === a4; +>r7b4 : boolean +>b4 === a4 : boolean +>b4 : new () => Base +>a4 : new (a: number, b: string) => Base + +var r7b5 = b5 === a5; +>r7b5 : boolean +>b5 === a5 : boolean +>b5 : new (a: Derived) => Base +>a5 : new (a: Base) => Base + +var r7b6 = b6 === a6; +>r7b6 : boolean +>b6 === a6 : boolean +>b6 : new (a: Base, b: Derived) => Base +>a6 : new (a: Derived, b: Base) => Base + +var r7b7 = b7 === a7; +>r7b7 : boolean +>b7 === a7 : boolean +>b7 : new () => Derived +>a7 : new () => Base + +var r7b8 = b8 === a8; +>r7b8 : boolean +>b8 === a8 : boolean +>b8 : new (a?: Derived) => Base +>a8 : new (a?: Base) => Base + +var r7b9 = b9 === a9; +>r7b9 : boolean +>b9 === a9 : boolean +>b9 : new (...a: Derived[]) => Base +>a9 : new (...a: Base[]) => Base + +//var r7b10 = b10 === a10; + +// operator !== +var r8a1 = a1 !== b1; +>r8a1 : boolean +>a1 !== b1 : boolean +>a1 : new () => Base +>b1 : new () => Base + +var r8a2 = a2 !== b2; +>r8a2 : boolean +>a2 !== b2 : boolean +>a2 : new (a: number, b: string) => Base +>b2 : new (a: number, b: string) => Base + +var r8a3 = a3 !== b3; +>r8a3 : boolean +>a3 !== b3 : boolean +>a3 : new (a: number, b: string) => Base +>b3 : new (a: number) => Base + +var r8a4 = a4 !== b4; +>r8a4 : boolean +>a4 !== b4 : boolean +>a4 : new (a: number, b: string) => Base +>b4 : new () => Base + +var r8a5 = a5 !== b5; +>r8a5 : boolean +>a5 !== b5 : boolean +>a5 : new (a: Base) => Base +>b5 : new (a: Derived) => Base + +var r8a6 = a6 !== b6; +>r8a6 : boolean +>a6 !== b6 : boolean +>a6 : new (a: Derived, b: Base) => Base +>b6 : new (a: Base, b: Derived) => Base + +var r8a7 = a7 !== b7; +>r8a7 : boolean +>a7 !== b7 : boolean +>a7 : new () => Base +>b7 : new () => Derived + +var r8a8 = a8 !== b8; +>r8a8 : boolean +>a8 !== b8 : boolean +>a8 : new (a?: Base) => Base +>b8 : new (a?: Derived) => Base + +var r8a9 = a9 !== b9; +>r8a9 : boolean +>a9 !== b9 : boolean +>a9 : new (...a: Base[]) => Base +>b9 : new (...a: Derived[]) => Base + +//var r8a10 = a10 !== b10; + +var r8b1 = b1 !== a1; +>r8b1 : boolean +>b1 !== a1 : boolean +>b1 : new () => Base +>a1 : new () => Base + +var r8b2 = b2 !== a2; +>r8b2 : boolean +>b2 !== a2 : boolean +>b2 : new (a: number, b: string) => Base +>a2 : new (a: number, b: string) => Base + +var r8b3 = b3 !== a3; +>r8b3 : boolean +>b3 !== a3 : boolean +>b3 : new (a: number) => Base +>a3 : new (a: number, b: string) => Base + +var r8b4 = b4 !== a4; +>r8b4 : boolean +>b4 !== a4 : boolean +>b4 : new () => Base +>a4 : new (a: number, b: string) => Base + +var r8b5 = b5 !== a5; +>r8b5 : boolean +>b5 !== a5 : boolean +>b5 : new (a: Derived) => Base +>a5 : new (a: Base) => Base + +var r8b6 = b6 !== a6; +>r8b6 : boolean +>b6 !== a6 : boolean +>b6 : new (a: Base, b: Derived) => Base +>a6 : new (a: Derived, b: Base) => Base + +var r8b7 = b7 !== a7; +>r8b7 : boolean +>b7 !== a7 : boolean +>b7 : new () => Derived +>a7 : new () => Base + +var r8b8 = b8 !== a8; +>r8b8 : boolean +>b8 !== a8 : boolean +>b8 : new (a?: Derived) => Base +>a8 : new (a?: Base) => Base + +var r8b9 = b9 !== a9; +>r8b9 : boolean +>b9 !== a9 : boolean +>b9 : new (...a: Derived[]) => Base +>a9 : new (...a: Base[]) => Base + +//var r8b10 = b10 !== a10; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.types b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.types new file mode 100644 index 00000000000..755df0be1dc --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.types @@ -0,0 +1,444 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnIndexSignature.ts === +class Base { +>Base : Base + + public a: string; +>a : string +} + +class Derived extends Base { +>Derived : Derived +>Base : Base + + public b: string; +>b : string +} + +var a1: { [a: string]: string }; +>a1 : { [x: string]: string; } +>a : string + +var b1: { [b: string]: string }; +>b1 : { [x: string]: string; } +>b : string + +var a2: { [index: string]: Base }; +>a2 : { [x: string]: Base; } +>index : string +>Base : Base + +var b2: { [index: string]: Derived }; +>b2 : { [x: string]: Derived; } +>index : string +>Derived : Derived + +var a3: { [index: number]: string }; +>a3 : { [x: number]: string; } +>index : number + +var b3: { [index: number]: string }; +>b3 : { [x: number]: string; } +>index : number + +var a4: { [index: number]: Base }; +>a4 : { [x: number]: Base; } +>index : number +>Base : Base + +var b4: { [index: string]: Derived }; +>b4 : { [x: string]: Derived; } +>index : string +>Derived : Derived + +// operator < +var r1a1 = a1 < b1; +>r1a1 : boolean +>a1 < b1 : boolean +>a1 : { [x: string]: string; } +>b1 : { [x: string]: string; } + +var r1a1 = a2 < b2; +>r1a1 : boolean +>a2 < b2 : boolean +>a2 : { [x: string]: Base; } +>b2 : { [x: string]: Derived; } + +var r1a1 = a3 < b3; +>r1a1 : boolean +>a3 < b3 : boolean +>a3 : { [x: number]: string; } +>b3 : { [x: number]: string; } + +var r1a1 = a4 < b4; +>r1a1 : boolean +>a4 < b4 : boolean +>a4 : { [x: number]: Base; } +>b4 : { [x: string]: Derived; } + +var r1b1 = b1 < a1; +>r1b1 : boolean +>b1 < a1 : boolean +>b1 : { [x: string]: string; } +>a1 : { [x: string]: string; } + +var r1b1 = b2 < a2; +>r1b1 : boolean +>b2 < a2 : boolean +>b2 : { [x: string]: Derived; } +>a2 : { [x: string]: Base; } + +var r1b1 = b3 < a3; +>r1b1 : boolean +>b3 < a3 : boolean +>b3 : { [x: number]: string; } +>a3 : { [x: number]: string; } + +var r1b1 = b4 < a4; +>r1b1 : boolean +>b4 < a4 : boolean +>b4 : { [x: string]: Derived; } +>a4 : { [x: number]: Base; } + +// operator > +var r2a1 = a1 > b1; +>r2a1 : boolean +>a1 > b1 : boolean +>a1 : { [x: string]: string; } +>b1 : { [x: string]: string; } + +var r2a1 = a2 > b2; +>r2a1 : boolean +>a2 > b2 : boolean +>a2 : { [x: string]: Base; } +>b2 : { [x: string]: Derived; } + +var r2a1 = a3 > b3; +>r2a1 : boolean +>a3 > b3 : boolean +>a3 : { [x: number]: string; } +>b3 : { [x: number]: string; } + +var r2a1 = a4 > b4; +>r2a1 : boolean +>a4 > b4 : boolean +>a4 : { [x: number]: Base; } +>b4 : { [x: string]: Derived; } + +var r2b1 = b1 > a1; +>r2b1 : boolean +>b1 > a1 : boolean +>b1 : { [x: string]: string; } +>a1 : { [x: string]: string; } + +var r2b1 = b2 > a2; +>r2b1 : boolean +>b2 > a2 : boolean +>b2 : { [x: string]: Derived; } +>a2 : { [x: string]: Base; } + +var r2b1 = b3 > a3; +>r2b1 : boolean +>b3 > a3 : boolean +>b3 : { [x: number]: string; } +>a3 : { [x: number]: string; } + +var r2b1 = b4 > a4; +>r2b1 : boolean +>b4 > a4 : boolean +>b4 : { [x: string]: Derived; } +>a4 : { [x: number]: Base; } + +// operator <= +var r3a1 = a1 <= b1; +>r3a1 : boolean +>a1 <= b1 : boolean +>a1 : { [x: string]: string; } +>b1 : { [x: string]: string; } + +var r3a1 = a2 <= b2; +>r3a1 : boolean +>a2 <= b2 : boolean +>a2 : { [x: string]: Base; } +>b2 : { [x: string]: Derived; } + +var r3a1 = a3 <= b3; +>r3a1 : boolean +>a3 <= b3 : boolean +>a3 : { [x: number]: string; } +>b3 : { [x: number]: string; } + +var r3a1 = a4 <= b4; +>r3a1 : boolean +>a4 <= b4 : boolean +>a4 : { [x: number]: Base; } +>b4 : { [x: string]: Derived; } + +var r3b1 = b1 <= a1; +>r3b1 : boolean +>b1 <= a1 : boolean +>b1 : { [x: string]: string; } +>a1 : { [x: string]: string; } + +var r3b1 = b2 <= a2; +>r3b1 : boolean +>b2 <= a2 : boolean +>b2 : { [x: string]: Derived; } +>a2 : { [x: string]: Base; } + +var r3b1 = b3 <= a3; +>r3b1 : boolean +>b3 <= a3 : boolean +>b3 : { [x: number]: string; } +>a3 : { [x: number]: string; } + +var r3b1 = b4 <= a4; +>r3b1 : boolean +>b4 <= a4 : boolean +>b4 : { [x: string]: Derived; } +>a4 : { [x: number]: Base; } + +// operator >= +var r4a1 = a1 >= b1; +>r4a1 : boolean +>a1 >= b1 : boolean +>a1 : { [x: string]: string; } +>b1 : { [x: string]: string; } + +var r4a1 = a2 >= b2; +>r4a1 : boolean +>a2 >= b2 : boolean +>a2 : { [x: string]: Base; } +>b2 : { [x: string]: Derived; } + +var r4a1 = a3 >= b3; +>r4a1 : boolean +>a3 >= b3 : boolean +>a3 : { [x: number]: string; } +>b3 : { [x: number]: string; } + +var r4a1 = a4 >= b4; +>r4a1 : boolean +>a4 >= b4 : boolean +>a4 : { [x: number]: Base; } +>b4 : { [x: string]: Derived; } + +var r4b1 = b1 >= a1; +>r4b1 : boolean +>b1 >= a1 : boolean +>b1 : { [x: string]: string; } +>a1 : { [x: string]: string; } + +var r4b1 = b2 >= a2; +>r4b1 : boolean +>b2 >= a2 : boolean +>b2 : { [x: string]: Derived; } +>a2 : { [x: string]: Base; } + +var r4b1 = b3 >= a3; +>r4b1 : boolean +>b3 >= a3 : boolean +>b3 : { [x: number]: string; } +>a3 : { [x: number]: string; } + +var r4b1 = b4 >= a4; +>r4b1 : boolean +>b4 >= a4 : boolean +>b4 : { [x: string]: Derived; } +>a4 : { [x: number]: Base; } + +// operator == +var r5a1 = a1 == b1; +>r5a1 : boolean +>a1 == b1 : boolean +>a1 : { [x: string]: string; } +>b1 : { [x: string]: string; } + +var r5a1 = a2 == b2; +>r5a1 : boolean +>a2 == b2 : boolean +>a2 : { [x: string]: Base; } +>b2 : { [x: string]: Derived; } + +var r5a1 = a3 == b3; +>r5a1 : boolean +>a3 == b3 : boolean +>a3 : { [x: number]: string; } +>b3 : { [x: number]: string; } + +var r5a1 = a4 == b4; +>r5a1 : boolean +>a4 == b4 : boolean +>a4 : { [x: number]: Base; } +>b4 : { [x: string]: Derived; } + +var r5b1 = b1 == a1; +>r5b1 : boolean +>b1 == a1 : boolean +>b1 : { [x: string]: string; } +>a1 : { [x: string]: string; } + +var r5b1 = b2 == a2; +>r5b1 : boolean +>b2 == a2 : boolean +>b2 : { [x: string]: Derived; } +>a2 : { [x: string]: Base; } + +var r5b1 = b3 == a3; +>r5b1 : boolean +>b3 == a3 : boolean +>b3 : { [x: number]: string; } +>a3 : { [x: number]: string; } + +var r5b1 = b4 == a4; +>r5b1 : boolean +>b4 == a4 : boolean +>b4 : { [x: string]: Derived; } +>a4 : { [x: number]: Base; } + +// operator != +var r6a1 = a1 != b1; +>r6a1 : boolean +>a1 != b1 : boolean +>a1 : { [x: string]: string; } +>b1 : { [x: string]: string; } + +var r6a1 = a2 != b2; +>r6a1 : boolean +>a2 != b2 : boolean +>a2 : { [x: string]: Base; } +>b2 : { [x: string]: Derived; } + +var r6a1 = a3 != b3; +>r6a1 : boolean +>a3 != b3 : boolean +>a3 : { [x: number]: string; } +>b3 : { [x: number]: string; } + +var r6a1 = a4 != b4; +>r6a1 : boolean +>a4 != b4 : boolean +>a4 : { [x: number]: Base; } +>b4 : { [x: string]: Derived; } + +var r6b1 = b1 != a1; +>r6b1 : boolean +>b1 != a1 : boolean +>b1 : { [x: string]: string; } +>a1 : { [x: string]: string; } + +var r6b1 = b2 != a2; +>r6b1 : boolean +>b2 != a2 : boolean +>b2 : { [x: string]: Derived; } +>a2 : { [x: string]: Base; } + +var r6b1 = b3 != a3; +>r6b1 : boolean +>b3 != a3 : boolean +>b3 : { [x: number]: string; } +>a3 : { [x: number]: string; } + +var r6b1 = b4 != a4; +>r6b1 : boolean +>b4 != a4 : boolean +>b4 : { [x: string]: Derived; } +>a4 : { [x: number]: Base; } + +// operator === +var r7a1 = a1 === b1; +>r7a1 : boolean +>a1 === b1 : boolean +>a1 : { [x: string]: string; } +>b1 : { [x: string]: string; } + +var r7a1 = a2 === b2; +>r7a1 : boolean +>a2 === b2 : boolean +>a2 : { [x: string]: Base; } +>b2 : { [x: string]: Derived; } + +var r7a1 = a3 === b3; +>r7a1 : boolean +>a3 === b3 : boolean +>a3 : { [x: number]: string; } +>b3 : { [x: number]: string; } + +var r7a1 = a4 === b4; +>r7a1 : boolean +>a4 === b4 : boolean +>a4 : { [x: number]: Base; } +>b4 : { [x: string]: Derived; } + +var r7b1 = b1 === a1; +>r7b1 : boolean +>b1 === a1 : boolean +>b1 : { [x: string]: string; } +>a1 : { [x: string]: string; } + +var r7b1 = b2 === a2; +>r7b1 : boolean +>b2 === a2 : boolean +>b2 : { [x: string]: Derived; } +>a2 : { [x: string]: Base; } + +var r7b1 = b3 === a3; +>r7b1 : boolean +>b3 === a3 : boolean +>b3 : { [x: number]: string; } +>a3 : { [x: number]: string; } + +var r7b1 = b4 === a4; +>r7b1 : boolean +>b4 === a4 : boolean +>b4 : { [x: string]: Derived; } +>a4 : { [x: number]: Base; } + +// operator !== +var r8a1 = a1 !== b1; +>r8a1 : boolean +>a1 !== b1 : boolean +>a1 : { [x: string]: string; } +>b1 : { [x: string]: string; } + +var r8a1 = a2 !== b2; +>r8a1 : boolean +>a2 !== b2 : boolean +>a2 : { [x: string]: Base; } +>b2 : { [x: string]: Derived; } + +var r8a1 = a3 !== b3; +>r8a1 : boolean +>a3 !== b3 : boolean +>a3 : { [x: number]: string; } +>b3 : { [x: number]: string; } + +var r8a1 = a4 !== b4; +>r8a1 : boolean +>a4 !== b4 : boolean +>a4 : { [x: number]: Base; } +>b4 : { [x: string]: Derived; } + +var r8b1 = b1 !== a1; +>r8b1 : boolean +>b1 !== a1 : boolean +>b1 : { [x: string]: string; } +>a1 : { [x: string]: string; } + +var r8b1 = b2 !== a2; +>r8b1 : boolean +>b2 !== a2 : boolean +>b2 : { [x: string]: Derived; } +>a2 : { [x: string]: Base; } + +var r8b1 = b3 !== a3; +>r8b1 : boolean +>b3 !== a3 : boolean +>b3 : { [x: number]: string; } +>a3 : { [x: number]: string; } + +var r8b1 = b4 !== a4; +>r8b1 : boolean +>b4 !== a4 : boolean +>b4 : { [x: string]: Derived; } +>a4 : { [x: number]: Base; } + diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnOptionalProperty.types b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnOptionalProperty.types new file mode 100644 index 00000000000..e94ef495a55 --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnOptionalProperty.types @@ -0,0 +1,130 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnOptionalProperty.ts === +interface I { +>I : I + + a: string; +>a : string + + b?: number; +>b : number +} + +interface J { +>J : J + + a: string; +>a : string +} + +var a: I; +>a : I +>I : I + +var b: J; +>b : J +>J : J + +// operator < +var ra1 = a < b; +>ra1 : boolean +>a < b : boolean +>a : I +>b : J + +var ra2 = b < a; +>ra2 : boolean +>b < a : boolean +>b : J +>a : I + +// operator > +var rb1 = a > b; +>rb1 : boolean +>a > b : boolean +>a : I +>b : J + +var rb2 = b > a; +>rb2 : boolean +>b > a : boolean +>b : J +>a : I + +// operator <= +var rc1 = a <= b; +>rc1 : boolean +>a <= b : boolean +>a : I +>b : J + +var rc2 = b <= a; +>rc2 : boolean +>b <= a : boolean +>b : J +>a : I + +// operator >= +var rd1 = a >= b; +>rd1 : boolean +>a >= b : boolean +>a : I +>b : J + +var rd2 = b >= a; +>rd2 : boolean +>b >= a : boolean +>b : J +>a : I + +// operator == +var re1 = a == b; +>re1 : boolean +>a == b : boolean +>a : I +>b : J + +var re2 = b == a; +>re2 : boolean +>b == a : boolean +>b : J +>a : I + +// operator != +var rf1 = a != b; +>rf1 : boolean +>a != b : boolean +>a : I +>b : J + +var rf2 = b != a; +>rf2 : boolean +>b != a : boolean +>b : J +>a : I + +// operator === +var rg1 = a === b; +>rg1 : boolean +>a === b : boolean +>a : I +>b : J + +var rg2 = b === a; +>rg2 : boolean +>b === a : boolean +>b : J +>a : I + +// operator !== +var rh1 = a !== b; +>rh1 : boolean +>a !== b : boolean +>a : I +>b : J + +var rh2 = b !== a; +>rh2 : boolean +>b !== a : boolean +>b : J +>a : I + diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.types b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.types new file mode 100644 index 00000000000..d604115e161 --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.types @@ -0,0 +1,271 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnProperty.ts === +class Base { +>Base : Base + + public a: string; +>a : string +} + +class Derived extends Base { +>Derived : Derived +>Base : Base + + public b: string; +>b : string +} + +class A1 { +>A1 : A1 + + public a: Base; +>a : Base +>Base : Base + + public b: Base; +>b : Base +>Base : Base +} + +class B1 { +>B1 : B1 + + public a: Base; +>a : Base +>Base : Base + + public b: Derived; +>b : Derived +>Derived : Derived +} + +class A2 { +>A2 : A2 + + private a; +>a : any +} + +class B2 extends A2 { +>B2 : B2 +>A2 : A2 + + private b; +>b : any +} + +var a1: A1; +>a1 : A1 +>A1 : A1 + +var a2: A2; +>a2 : A2 +>A2 : A2 + +var b1: B1; +>b1 : B1 +>B1 : B1 + +var b2: B2; +>b2 : B2 +>B2 : B2 + +// operator < +var ra1 = a1 < b1; +>ra1 : boolean +>a1 < b1 : boolean +>a1 : A1 +>b1 : B1 + +var ra2 = a2 < b2; +>ra2 : boolean +>a2 < b2 : boolean +>a2 : A2 +>b2 : B2 + +var ra3 = b1 < a1; +>ra3 : boolean +>b1 < a1 : boolean +>b1 : B1 +>a1 : A1 + +var ra4 = b2 < a2; +>ra4 : boolean +>b2 < a2 : boolean +>b2 : B2 +>a2 : A2 + +// operator > +var rb1 = a1 > b1; +>rb1 : boolean +>a1 > b1 : boolean +>a1 : A1 +>b1 : B1 + +var rb2 = a2 > b2; +>rb2 : boolean +>a2 > b2 : boolean +>a2 : A2 +>b2 : B2 + +var rb3 = b1 > a1; +>rb3 : boolean +>b1 > a1 : boolean +>b1 : B1 +>a1 : A1 + +var rb4 = b2 > a2; +>rb4 : boolean +>b2 > a2 : boolean +>b2 : B2 +>a2 : A2 + +// operator <= +var rc1 = a1 <= b1; +>rc1 : boolean +>a1 <= b1 : boolean +>a1 : A1 +>b1 : B1 + +var rc2 = a2 <= b2; +>rc2 : boolean +>a2 <= b2 : boolean +>a2 : A2 +>b2 : B2 + +var rc3 = b1 <= a1; +>rc3 : boolean +>b1 <= a1 : boolean +>b1 : B1 +>a1 : A1 + +var rc4 = b2 <= a2; +>rc4 : boolean +>b2 <= a2 : boolean +>b2 : B2 +>a2 : A2 + +// operator >= +var rd1 = a1 >= b1; +>rd1 : boolean +>a1 >= b1 : boolean +>a1 : A1 +>b1 : B1 + +var rd2 = a2 >= b2; +>rd2 : boolean +>a2 >= b2 : boolean +>a2 : A2 +>b2 : B2 + +var rd3 = b1 >= a1; +>rd3 : boolean +>b1 >= a1 : boolean +>b1 : B1 +>a1 : A1 + +var rd4 = b2 >= a2; +>rd4 : boolean +>b2 >= a2 : boolean +>b2 : B2 +>a2 : A2 + +// operator == +var re1 = a1 == b1; +>re1 : boolean +>a1 == b1 : boolean +>a1 : A1 +>b1 : B1 + +var re2 = a2 == b2; +>re2 : boolean +>a2 == b2 : boolean +>a2 : A2 +>b2 : B2 + +var re3 = b1 == a1; +>re3 : boolean +>b1 == a1 : boolean +>b1 : B1 +>a1 : A1 + +var re4 = b2 == a2; +>re4 : boolean +>b2 == a2 : boolean +>b2 : B2 +>a2 : A2 + +// operator != +var rf1 = a1 != b1; +>rf1 : boolean +>a1 != b1 : boolean +>a1 : A1 +>b1 : B1 + +var rf2 = a2 != b2; +>rf2 : boolean +>a2 != b2 : boolean +>a2 : A2 +>b2 : B2 + +var rf3 = b1 != a1; +>rf3 : boolean +>b1 != a1 : boolean +>b1 : B1 +>a1 : A1 + +var rf4 = b2 != a2; +>rf4 : boolean +>b2 != a2 : boolean +>b2 : B2 +>a2 : A2 + +// operator === +var rg1 = a1 === b1; +>rg1 : boolean +>a1 === b1 : boolean +>a1 : A1 +>b1 : B1 + +var rg2 = a2 === b2; +>rg2 : boolean +>a2 === b2 : boolean +>a2 : A2 +>b2 : B2 + +var rg3 = b1 === a1; +>rg3 : boolean +>b1 === a1 : boolean +>b1 : B1 +>a1 : A1 + +var rg4 = b2 === a2; +>rg4 : boolean +>b2 === a2 : boolean +>b2 : B2 +>a2 : A2 + +// operator !== +var rh1 = a1 !== b1; +>rh1 : boolean +>a1 !== b1 : boolean +>a1 : A1 +>b1 : B1 + +var rh2 = a2 !== b2; +>rh2 : boolean +>a2 !== b2 : boolean +>a2 : A2 +>b2 : B2 + +var rh3 = b1 !== a1; +>rh3 : boolean +>b1 !== a1 : boolean +>b1 : B1 +>a1 : A1 + +var rh4 = b2 !== a2; +>rh4 : boolean +>b2 !== a2 : boolean +>b2 : B2 +>a2 : A2 + diff --git a/tests/baselines/reference/comparisonOperatorWithTwoOperandsAreAny.types b/tests/baselines/reference/comparisonOperatorWithTwoOperandsAreAny.types new file mode 100644 index 00000000000..7ddcb5da177 --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithTwoOperandsAreAny.types @@ -0,0 +1,52 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTwoOperandsAreAny.ts === +var a: any; +>a : any + +var r1 = a < a; +>r1 : boolean +>a < a : boolean +>a : any +>a : any + +var r2 = a > a; +>r2 : boolean +>a > a : boolean +>a : any +>a : any + +var r3 = a <= a; +>r3 : boolean +>a <= a : boolean +>a : any +>a : any + +var r4 = a >= a; +>r4 : boolean +>a >= a : boolean +>a : any +>a : any + +var r5 = a == a; +>r5 : boolean +>a == a : boolean +>a : any +>a : any + +var r6 = a != a; +>r6 : boolean +>a != a : boolean +>a : any +>a : any + +var r7 = a === a; +>r7 : boolean +>a === a : boolean +>a : any +>a : any + +var r8 = a !== a; +>r8 : boolean +>a !== a : boolean +>a : any +>a : any + diff --git a/tests/baselines/reference/complexClassRelationships.types b/tests/baselines/reference/complexClassRelationships.types new file mode 100644 index 00000000000..850ae5fa1d7 --- /dev/null +++ b/tests/baselines/reference/complexClassRelationships.types @@ -0,0 +1,122 @@ +=== tests/cases/compiler/complexClassRelationships.ts === +// There should be no errors in this file +class Derived extends Base { +>Derived : Derived +>Base : Base + + public static createEmpty(): Derived { +>createEmpty : () => Derived +>Derived : Derived + + var item = new Derived(); +>item : Derived +>new Derived() : Derived +>Derived : typeof Derived + + return item; +>item : Derived + } +} +class BaseCollection { +>BaseCollection : BaseCollection +>T : T +>Base : Base + + constructor(f: () => T) { +>f : () => T +>T : T + + (item: Thing) => { return [item.Components]; }; +>(item: Thing) => { return [item.Components]; } : (item: Thing) => ComponentCollection[] +>item : Thing +>Thing : Thing +>[item.Components] : ComponentCollection[] +>item.Components : ComponentCollection +>item : Thing +>Components : ComponentCollection + } +} +class Base { +>Base : Base + + ownerCollection: BaseCollection; +>ownerCollection : BaseCollection +>BaseCollection : BaseCollection +>Base : Base +} + +class Thing { +>Thing : Thing + + public get Components(): ComponentCollection { return null } +>Components : ComponentCollection +>ComponentCollection : ComponentCollection +} + +class ComponentCollection { +>ComponentCollection : ComponentCollection +>T : T + + private static sortComponents(p: Foo) { +>sortComponents : (p: Foo) => GenericType +>p : Foo +>Foo : Foo + + return p.prop1; +>p.prop1 : GenericType +>p : Foo +>prop1 : GenericType + } +} + +class Foo { +>Foo : Foo + + public get prop1() { +>prop1 : GenericType + + return new GenericType(this); +>new GenericType(this) : GenericType +>GenericType : typeof GenericType +>this : Foo + } + public populate() { +>populate : () => void + + this.prop2; +>this.prop2 : BaseCollection +>this : Foo +>prop2 : BaseCollection + } + public get prop2(): BaseCollection { +>prop2 : BaseCollection +>BaseCollection : BaseCollection +>Derived : Derived + + return new BaseCollection(Derived.createEmpty); +>new BaseCollection(Derived.createEmpty) : BaseCollection +>BaseCollection : typeof BaseCollection +>Derived : Derived +>Derived.createEmpty : () => Derived +>Derived : typeof Derived +>createEmpty : () => Derived + } +} + +class GenericType { +>GenericType : GenericType +>T : T + + constructor(parent: FooBase) { } +>parent : FooBase +>FooBase : FooBase +} + +class FooBase { +>FooBase : FooBase + + public populate() { +>populate : () => void + + } +} diff --git a/tests/baselines/reference/compositeGenericFunction.types b/tests/baselines/reference/compositeGenericFunction.types new file mode 100644 index 00000000000..421b7bbe514 --- /dev/null +++ b/tests/baselines/reference/compositeGenericFunction.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/compositeGenericFunction.ts === +function f(value: T) { return value; }; +>f : (value: T) => T +>T : T +>value : T +>T : T +>value : T + +function h(func: (x: number) => R): R { return null; } +>h : (func: (x: number) => R) => R +>R : R +>func : (x: number) => R +>x : number +>R : R +>R : R + +var z: number = h(f); +>z : number +>h(f) : number +>h : (func: (x: number) => R) => R +>f : (value: T) => T + +var z: number = h(f); +>z : number +>h(f) : number +>h : (func: (x: number) => R) => R +>f : (value: T) => T + diff --git a/tests/baselines/reference/compoundAdditionAssignmentLHSCanBeAssigned.types b/tests/baselines/reference/compoundAdditionAssignmentLHSCanBeAssigned.types new file mode 100644 index 00000000000..7b776389335 --- /dev/null +++ b/tests/baselines/reference/compoundAdditionAssignmentLHSCanBeAssigned.types @@ -0,0 +1,189 @@ +=== tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned.ts === +enum E { a, b } +>E : E +>a : E +>b : E + +var a: any; +>a : any + +var b: void; +>b : void + +var x1: any; +>x1 : any + +x1 += a; +>x1 += a : any +>x1 : any +>a : any + +x1 += b; +>x1 += b : any +>x1 : any +>b : void + +x1 += true; +>x1 += true : any +>x1 : any + +x1 += 0; +>x1 += 0 : any +>x1 : any + +x1 += ''; +>x1 += '' : string +>x1 : any + +x1 += E.a; +>x1 += E.a : any +>x1 : any +>E.a : E +>E : typeof E +>a : E + +x1 += {}; +>x1 += {} : any +>x1 : any +>{} : {} + +x1 += null; +>x1 += null : any +>x1 : any + +x1 += undefined; +>x1 += undefined : any +>x1 : any +>undefined : undefined + +var x2: string; +>x2 : string + +x2 += a; +>x2 += a : string +>x2 : string +>a : any + +x2 += b; +>x2 += b : string +>x2 : string +>b : void + +x2 += true; +>x2 += true : string +>x2 : string + +x2 += 0; +>x2 += 0 : string +>x2 : string + +x2 += ''; +>x2 += '' : string +>x2 : string + +x2 += E.a; +>x2 += E.a : string +>x2 : string +>E.a : E +>E : typeof E +>a : E + +x2 += {}; +>x2 += {} : string +>x2 : string +>{} : {} + +x2 += null; +>x2 += null : string +>x2 : string + +x2 += undefined; +>x2 += undefined : string +>x2 : string +>undefined : undefined + +var x3: number; +>x3 : number + +x3 += a; +>x3 += a : any +>x3 : number +>a : any + +x3 += 0; +>x3 += 0 : number +>x3 : number + +x3 += E.a; +>x3 += E.a : number +>x3 : number +>E.a : E +>E : typeof E +>a : E + +x3 += null; +>x3 += null : number +>x3 : number + +x3 += undefined; +>x3 += undefined : number +>x3 : number +>undefined : undefined + +var x4: E; +>x4 : E +>E : E + +x4 += a; +>x4 += a : any +>x4 : E +>a : any + +x4 += 0; +>x4 += 0 : number +>x4 : E + +x4 += E.a; +>x4 += E.a : number +>x4 : E +>E.a : E +>E : typeof E +>a : E + +x4 += null; +>x4 += null : number +>x4 : E + +x4 += undefined; +>x4 += undefined : number +>x4 : E +>undefined : undefined + +var x5: boolean; +>x5 : boolean + +x5 += a; +>x5 += a : any +>x5 : boolean +>a : any + +var x6: {}; +>x6 : {} + +x6 += a; +>x6 += a : any +>x6 : {} +>a : any + +x6 += ''; +>x6 += '' : string +>x6 : {} + +var x7: void; +>x7 : void + +x7 += a; +>x7 += a : any +>x7 : void +>a : any + diff --git a/tests/baselines/reference/compoundArithmeticAssignmentLHSCanBeAssigned.types b/tests/baselines/reference/compoundArithmeticAssignmentLHSCanBeAssigned.types new file mode 100644 index 00000000000..c4345b97413 --- /dev/null +++ b/tests/baselines/reference/compoundArithmeticAssignmentLHSCanBeAssigned.types @@ -0,0 +1,99 @@ +=== tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned.ts === +enum E { a, b, c } +>E : E +>a : E +>b : E +>c : E + +var a: any; +>a : any + +var b: number; +>b : number + +var c: E; +>c : E +>E : E + +var x1: any; +>x1 : any + +x1 *= a; +>x1 *= a : number +>x1 : any +>a : any + +x1 *= b; +>x1 *= b : number +>x1 : any +>b : number + +x1 *= c; +>x1 *= c : number +>x1 : any +>c : E + +x1 *= null; +>x1 *= null : number +>x1 : any + +x1 *= undefined; +>x1 *= undefined : number +>x1 : any +>undefined : undefined + +var x2: number; +>x2 : number + +x2 *= a; +>x2 *= a : number +>x2 : number +>a : any + +x2 *= b; +>x2 *= b : number +>x2 : number +>b : number + +x2 *= c; +>x2 *= c : number +>x2 : number +>c : E + +x2 *= null; +>x2 *= null : number +>x2 : number + +x2 *= undefined; +>x2 *= undefined : number +>x2 : number +>undefined : undefined + +var x3: E; +>x3 : E +>E : E + +x3 *= a; +>x3 *= a : number +>x3 : E +>a : any + +x3 *= b; +>x3 *= b : number +>x3 : E +>b : number + +x3 *= c; +>x3 *= c : number +>x3 : E +>c : E + +x3 *= null; +>x3 *= null : number +>x3 : E + +x3 *= undefined; +>x3 *= undefined : number +>x3 : E +>undefined : undefined + diff --git a/tests/baselines/reference/compoundAssignmentLHSIsReference.types b/tests/baselines/reference/compoundAssignmentLHSIsReference.types new file mode 100644 index 00000000000..e30cf19f3e3 --- /dev/null +++ b/tests/baselines/reference/compoundAssignmentLHSIsReference.types @@ -0,0 +1,124 @@ +=== tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsReference.ts === +var value; +>value : any + +// identifiers: variable and parameter +var x1: number; +>x1 : number + +x1 *= value; +>x1 *= value : number +>x1 : number +>value : any + +x1 += value; +>x1 += value : any +>x1 : number +>value : any + +function fn1(x2: number) { +>fn1 : (x2: number) => void +>x2 : number + + x2 *= value; +>x2 *= value : number +>x2 : number +>value : any + + x2 += value; +>x2 += value : any +>x2 : number +>value : any +} + +// property accesses +var x3: { a: number }; +>x3 : { a: number; } +>a : number + +x3.a *= value; +>x3.a *= value : number +>x3.a : number +>x3 : { a: number; } +>a : number +>value : any + +x3.a += value; +>x3.a += value : any +>x3.a : number +>x3 : { a: number; } +>a : number +>value : any + +x3['a'] *= value; +>x3['a'] *= value : number +>x3['a'] : number +>x3 : { a: number; } +>value : any + +x3['a'] += value; +>x3['a'] += value : any +>x3['a'] : number +>x3 : { a: number; } +>value : any + +// parentheses, the contained expression is reference +(x1) *= value; +>(x1) *= value : number +>(x1) : number +>x1 : number +>value : any + +(x1) += value; +>(x1) += value : any +>(x1) : number +>x1 : number +>value : any + +function fn2(x4: number) { +>fn2 : (x4: number) => void +>x4 : number + + (x4) *= value; +>(x4) *= value : number +>(x4) : number +>x4 : number +>value : any + + (x4) += value; +>(x4) += value : any +>(x4) : number +>x4 : number +>value : any +} + +(x3.a) *= value; +>(x3.a) *= value : number +>(x3.a) : number +>x3.a : number +>x3 : { a: number; } +>a : number +>value : any + +(x3.a) += value; +>(x3.a) += value : any +>(x3.a) : number +>x3.a : number +>x3 : { a: number; } +>a : number +>value : any + +(x3['a']) *= value; +>(x3['a']) *= value : number +>(x3['a']) : number +>x3['a'] : number +>x3 : { a: number; } +>value : any + +(x3['a']) += value; +>(x3['a']) += value : any +>(x3['a']) : number +>x3['a'] : number +>x3 : { a: number; } +>value : any + diff --git a/tests/baselines/reference/compoundVarDecl1.types b/tests/baselines/reference/compoundVarDecl1.types new file mode 100644 index 00000000000..e9a04bff9b2 --- /dev/null +++ b/tests/baselines/reference/compoundVarDecl1.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/compoundVarDecl1.ts === +module Foo { var a = 1, b = 1; a = b + 2; } +>Foo : typeof Foo +>a : number +>b : number +>a = b + 2 : number +>a : number +>b + 2 : number +>b : number + +var foo = 4, bar = 5; +>foo : number +>bar : number + diff --git a/tests/baselines/reference/concatError.types b/tests/baselines/reference/concatError.types new file mode 100644 index 00000000000..46d74cfb6ec --- /dev/null +++ b/tests/baselines/reference/concatError.types @@ -0,0 +1,50 @@ +=== tests/cases/compiler/concatError.ts === + +var n1: number[]; +>n1 : number[] + +/* +interface Array { + concat(...items: T[][]): T[]; // Note: This overload needs to be picked for arrays of arrays, even though both are applicable + concat(...items: T[]): T[]; +} +*/ +var fa: number[]; +>fa : number[] + +fa = fa.concat([0]); +>fa = fa.concat([0]) : number[] +>fa : number[] +>fa.concat([0]) : number[] +>fa.concat : { (...items: U[]): number[]; (...items: number[]): number[]; } +>fa : number[] +>concat : { (...items: U[]): number[]; (...items: number[]): number[]; } +>[0] : number[] + +fa = fa.concat(0); +>fa = fa.concat(0) : number[] +>fa : number[] +>fa.concat(0) : number[] +>fa.concat : { (...items: U[]): number[]; (...items: number[]): number[]; } +>fa : number[] +>concat : { (...items: U[]): number[]; (...items: number[]): number[]; } + + + + + +/* + + + + +declare class C { + public m(p1: C>): C; + //public p: T; +} + +var c: C; +var cc: C>; + +c = c.m(cc); +*/ diff --git a/tests/baselines/reference/conditionalExpressions2.types b/tests/baselines/reference/conditionalExpressions2.types new file mode 100644 index 00000000000..7fa483ad348 --- /dev/null +++ b/tests/baselines/reference/conditionalExpressions2.types @@ -0,0 +1,44 @@ +=== tests/cases/compiler/conditionalExpressions2.ts === +var a = false ? 1 : null; +>a : number +>false ? 1 : null : number + +var b = false ? undefined : 0; +>b : number +>false ? undefined : 0 : number +>undefined : undefined + +var c = false ? 1 : 0; +>c : number +>false ? 1 : 0 : number + +var d = false ? false : true; +>d : boolean +>false ? false : true : boolean + +var e = false ? "foo" : "bar"; +>e : string +>false ? "foo" : "bar" : string + +var f = false ? null : undefined; +>f : any +>false ? null : undefined : null +>undefined : undefined + +var g = true ? {g:5} : null; +>g : { g: number; } +>true ? {g:5} : null : { g: number; } +>{g:5} : { g: number; } +>g : number + +var h = [{h:5}, null]; +>h : { h: number; }[] +>[{h:5}, null] : { h: number; }[] +>{h:5} : { h: number; } +>h : number + +function i() { if (true) { return { x: 5 }; } else { return null; } } +>i : () => { x: number; } +>{ x: 5 } : { x: number; } +>x : number + diff --git a/tests/baselines/reference/conditionalOperatorConditionIsBooleanType.types b/tests/baselines/reference/conditionalOperatorConditionIsBooleanType.types new file mode 100644 index 00000000000..b3ca65219cb --- /dev/null +++ b/tests/baselines/reference/conditionalOperatorConditionIsBooleanType.types @@ -0,0 +1,230 @@ +=== tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsBooleanType.ts === +//Cond ? Expr1 : Expr2, Cond is of boolean type, Expr1 and Expr2 have the same type +var condBoolean: boolean; +>condBoolean : boolean + +var exprAny1: any; +>exprAny1 : any + +var exprBoolean1: boolean; +>exprBoolean1 : boolean + +var exprNumber1: number; +>exprNumber1 : number + +var exprString1: string; +>exprString1 : string + +var exprIsObject1: Object; +>exprIsObject1 : Object +>Object : Object + +var exprAny2: any; +>exprAny2 : any + +var exprBoolean2: boolean; +>exprBoolean2 : boolean + +var exprNumber2: number; +>exprNumber2 : number + +var exprString2: string; +>exprString2 : string + +var exprIsObject2: Object; +>exprIsObject2 : Object +>Object : Object + +//Cond is a boolean type variable +condBoolean ? exprAny1 : exprAny2; +>condBoolean ? exprAny1 : exprAny2 : any +>condBoolean : boolean +>exprAny1 : any +>exprAny2 : any + +condBoolean ? exprBoolean1 : exprBoolean2; +>condBoolean ? exprBoolean1 : exprBoolean2 : boolean +>condBoolean : boolean +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +condBoolean ? exprNumber1 : exprNumber2; +>condBoolean ? exprNumber1 : exprNumber2 : number +>condBoolean : boolean +>exprNumber1 : number +>exprNumber2 : number + +condBoolean ? exprString1 : exprString2; +>condBoolean ? exprString1 : exprString2 : string +>condBoolean : boolean +>exprString1 : string +>exprString2 : string + +condBoolean ? exprIsObject1 : exprIsObject2; +>condBoolean ? exprIsObject1 : exprIsObject2 : Object +>condBoolean : boolean +>exprIsObject1 : Object +>exprIsObject2 : Object + +//Cond is a boolean type literal +true ? exprAny1 : exprAny2; +>true ? exprAny1 : exprAny2 : any +>exprAny1 : any +>exprAny2 : any + +false ? exprBoolean1 : exprBoolean2; +>false ? exprBoolean1 : exprBoolean2 : boolean +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +true ? exprNumber1 : exprNumber2; +>true ? exprNumber1 : exprNumber2 : number +>exprNumber1 : number +>exprNumber2 : number + +false ? exprString1 : exprString2; +>false ? exprString1 : exprString2 : string +>exprString1 : string +>exprString2 : string + +true ? exprIsObject1 : exprIsObject2; +>true ? exprIsObject1 : exprIsObject2 : Object +>exprIsObject1 : Object +>exprIsObject2 : Object + +//Cond is a boolean type expression +!true ? exprAny1 : exprAny2; +>!true ? exprAny1 : exprAny2 : any +>!true : boolean +>exprAny1 : any +>exprAny2 : any + +typeof "123" == "string" ? exprBoolean1 : exprBoolean2; +>typeof "123" == "string" ? exprBoolean1 : exprBoolean2 : boolean +>typeof "123" == "string" : boolean +>typeof "123" : string +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +2 > 1 ? exprNumber1 : exprNumber2; +>2 > 1 ? exprNumber1 : exprNumber2 : number +>2 > 1 : boolean +>exprNumber1 : number +>exprNumber2 : number + +null === undefined ? exprString1 : exprString2; +>null === undefined ? exprString1 : exprString2 : string +>null === undefined : boolean +>undefined : undefined +>exprString1 : string +>exprString2 : string + +true || false ? exprIsObject1 : exprIsObject2; +>true || false ? exprIsObject1 : exprIsObject2 : Object +>true || false : boolean +>exprIsObject1 : Object +>exprIsObject2 : Object + +//Results shoud be same as Expr1 and Expr2 +var resultIsAny1 = condBoolean ? exprAny1 : exprAny2; +>resultIsAny1 : any +>condBoolean ? exprAny1 : exprAny2 : any +>condBoolean : boolean +>exprAny1 : any +>exprAny2 : any + +var resultIsBoolean1 = condBoolean ? exprBoolean1 : exprBoolean2; +>resultIsBoolean1 : boolean +>condBoolean ? exprBoolean1 : exprBoolean2 : boolean +>condBoolean : boolean +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +var resultIsNumber1 = condBoolean ? exprNumber1 : exprNumber2; +>resultIsNumber1 : number +>condBoolean ? exprNumber1 : exprNumber2 : number +>condBoolean : boolean +>exprNumber1 : number +>exprNumber2 : number + +var resultIsString1 = condBoolean ? exprString1 : exprString2; +>resultIsString1 : string +>condBoolean ? exprString1 : exprString2 : string +>condBoolean : boolean +>exprString1 : string +>exprString2 : string + +var resultIsObject1 = condBoolean ? exprIsObject1 : exprIsObject2; +>resultIsObject1 : Object +>condBoolean ? exprIsObject1 : exprIsObject2 : Object +>condBoolean : boolean +>exprIsObject1 : Object +>exprIsObject2 : Object + +var resultIsAny2 = true ? exprAny1 : exprAny2; +>resultIsAny2 : any +>true ? exprAny1 : exprAny2 : any +>exprAny1 : any +>exprAny2 : any + +var resultIsBoolean2 = false ? exprBoolean1 : exprBoolean2; +>resultIsBoolean2 : boolean +>false ? exprBoolean1 : exprBoolean2 : boolean +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +var resultIsNumber2 = true ? exprNumber1 : exprNumber2; +>resultIsNumber2 : number +>true ? exprNumber1 : exprNumber2 : number +>exprNumber1 : number +>exprNumber2 : number + +var resultIsString2 = false ? exprString1 : exprString2; +>resultIsString2 : string +>false ? exprString1 : exprString2 : string +>exprString1 : string +>exprString2 : string + +var resultIsObject2 = true ? exprIsObject1 : exprIsObject2; +>resultIsObject2 : Object +>true ? exprIsObject1 : exprIsObject2 : Object +>exprIsObject1 : Object +>exprIsObject2 : Object + +var resultIsAny3 = !true ? exprAny1 : exprAny2; +>resultIsAny3 : any +>!true ? exprAny1 : exprAny2 : any +>!true : boolean +>exprAny1 : any +>exprAny2 : any + +var resultIsBoolean3 = typeof "123" == "string" ? exprBoolean1 : exprBoolean2; +>resultIsBoolean3 : boolean +>typeof "123" == "string" ? exprBoolean1 : exprBoolean2 : boolean +>typeof "123" == "string" : boolean +>typeof "123" : string +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +var resultIsNumber3 = 2 > 1 ? exprNumber1 : exprNumber2; +>resultIsNumber3 : number +>2 > 1 ? exprNumber1 : exprNumber2 : number +>2 > 1 : boolean +>exprNumber1 : number +>exprNumber2 : number + +var resultIsString3 = null === undefined ? exprString1 : exprString2; +>resultIsString3 : string +>null === undefined ? exprString1 : exprString2 : string +>null === undefined : boolean +>undefined : undefined +>exprString1 : string +>exprString2 : string + +var resultIsObject3 = true || false ? exprIsObject1 : exprIsObject2; +>resultIsObject3 : Object +>true || false ? exprIsObject1 : exprIsObject2 : Object +>true || false : boolean +>exprIsObject1 : Object +>exprIsObject2 : Object + diff --git a/tests/baselines/reference/conditionalOperatorConditionIsNumberType.types b/tests/baselines/reference/conditionalOperatorConditionIsNumberType.types new file mode 100644 index 00000000000..3396885509a --- /dev/null +++ b/tests/baselines/reference/conditionalOperatorConditionIsNumberType.types @@ -0,0 +1,247 @@ +=== tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsNumberType.ts === +//Cond ? Expr1 : Expr2, Cond is of number type, Expr1 and Expr2 have the same type +var condNumber: number; +>condNumber : number + +var exprAny1: any; +>exprAny1 : any + +var exprBoolean1: boolean; +>exprBoolean1 : boolean + +var exprNumber1: number; +>exprNumber1 : number + +var exprString1: string; +>exprString1 : string + +var exprIsObject1: Object; +>exprIsObject1 : Object +>Object : Object + +var exprAny2: any; +>exprAny2 : any + +var exprBoolean2: boolean; +>exprBoolean2 : boolean + +var exprNumber2: number; +>exprNumber2 : number + +var exprString2: string; +>exprString2 : string + +var exprIsObject2: Object; +>exprIsObject2 : Object +>Object : Object + +//Cond is a number type variable +condNumber ? exprAny1 : exprAny2; +>condNumber ? exprAny1 : exprAny2 : any +>condNumber : number +>exprAny1 : any +>exprAny2 : any + +condNumber ? exprBoolean1 : exprBoolean2; +>condNumber ? exprBoolean1 : exprBoolean2 : boolean +>condNumber : number +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +condNumber ? exprNumber1 : exprNumber2; +>condNumber ? exprNumber1 : exprNumber2 : number +>condNumber : number +>exprNumber1 : number +>exprNumber2 : number + +condNumber ? exprString1 : exprString2; +>condNumber ? exprString1 : exprString2 : string +>condNumber : number +>exprString1 : string +>exprString2 : string + +condNumber ? exprIsObject1 : exprIsObject2; +>condNumber ? exprIsObject1 : exprIsObject2 : Object +>condNumber : number +>exprIsObject1 : Object +>exprIsObject2 : Object + +//Cond is a number type literal +1 ? exprAny1 : exprAny2; +>1 ? exprAny1 : exprAny2 : any +>exprAny1 : any +>exprAny2 : any + +0 ? exprBoolean1 : exprBoolean2; +>0 ? exprBoolean1 : exprBoolean2 : boolean +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +0.123456789 ? exprNumber1 : exprNumber2; +>0.123456789 ? exprNumber1 : exprNumber2 : number +>exprNumber1 : number +>exprNumber2 : number + +- 10000000000000 ? exprString1 : exprString2; +>- 10000000000000 ? exprString1 : exprString2 : string +>- 10000000000000 : number +>exprString1 : string +>exprString2 : string + +1000000000000 ? exprIsObject1 : exprIsObject2; +>1000000000000 ? exprIsObject1 : exprIsObject2 : Object +>exprIsObject1 : Object +>exprIsObject2 : Object + +//Cond is a number type expression +function foo() { return 1 }; +>foo : () => number + +var array = [1, 2, 3]; +>array : number[] +>[1, 2, 3] : number[] + +1 * 0 ? exprAny1 : exprAny2; +>1 * 0 ? exprAny1 : exprAny2 : any +>1 * 0 : number +>exprAny1 : any +>exprAny2 : any + +1 + 1 ? exprBoolean1 : exprBoolean2; +>1 + 1 ? exprBoolean1 : exprBoolean2 : boolean +>1 + 1 : number +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +"string".length ? exprNumber1 : exprNumber2; +>"string".length ? exprNumber1 : exprNumber2 : number +>"string".length : number +>length : number +>exprNumber1 : number +>exprNumber2 : number + +foo() ? exprString1 : exprString2; +>foo() ? exprString1 : exprString2 : string +>foo() : number +>foo : () => number +>exprString1 : string +>exprString2 : string + +foo() / array[1] ? exprIsObject1 : exprIsObject2; +>foo() / array[1] ? exprIsObject1 : exprIsObject2 : Object +>foo() / array[1] : number +>foo() : number +>foo : () => number +>array[1] : number +>array : number[] +>exprIsObject1 : Object +>exprIsObject2 : Object + +//Results shoud be same as Expr1 and Expr2 +var resultIsAny1 = condNumber ? exprAny1 : exprAny2; +>resultIsAny1 : any +>condNumber ? exprAny1 : exprAny2 : any +>condNumber : number +>exprAny1 : any +>exprAny2 : any + +var resultIsBoolean1 = condNumber ? exprBoolean1 : exprBoolean2; +>resultIsBoolean1 : boolean +>condNumber ? exprBoolean1 : exprBoolean2 : boolean +>condNumber : number +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +var resultIsNumber1 = condNumber ? exprNumber1 : exprNumber2; +>resultIsNumber1 : number +>condNumber ? exprNumber1 : exprNumber2 : number +>condNumber : number +>exprNumber1 : number +>exprNumber2 : number + +var resultIsString1 = condNumber ? exprString1 : exprString2; +>resultIsString1 : string +>condNumber ? exprString1 : exprString2 : string +>condNumber : number +>exprString1 : string +>exprString2 : string + +var resultIsObject1 = condNumber ? exprIsObject1 : exprIsObject2; +>resultIsObject1 : Object +>condNumber ? exprIsObject1 : exprIsObject2 : Object +>condNumber : number +>exprIsObject1 : Object +>exprIsObject2 : Object + +var resultIsAny2 = 1 ? exprAny1 : exprAny2; +>resultIsAny2 : any +>1 ? exprAny1 : exprAny2 : any +>exprAny1 : any +>exprAny2 : any + +var resultIsBoolean2 = 0 ? exprBoolean1 : exprBoolean2; +>resultIsBoolean2 : boolean +>0 ? exprBoolean1 : exprBoolean2 : boolean +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +var resultIsNumber2 = 0.123456789 ? exprNumber1 : exprNumber2; +>resultIsNumber2 : number +>0.123456789 ? exprNumber1 : exprNumber2 : number +>exprNumber1 : number +>exprNumber2 : number + +var resultIsString2 = - 10000000000000 ? exprString1 : exprString2; +>resultIsString2 : string +>- 10000000000000 ? exprString1 : exprString2 : string +>- 10000000000000 : number +>exprString1 : string +>exprString2 : string + +var resultIsObject2 = 1000000000000 ? exprIsObject1 : exprIsObject2; +>resultIsObject2 : Object +>1000000000000 ? exprIsObject1 : exprIsObject2 : Object +>exprIsObject1 : Object +>exprIsObject2 : Object + +var resultIsAny3 = 1 * 0 ? exprAny1 : exprAny2; +>resultIsAny3 : any +>1 * 0 ? exprAny1 : exprAny2 : any +>1 * 0 : number +>exprAny1 : any +>exprAny2 : any + +var resultIsBoolean3 = 1 + 1 ? exprBoolean1 : exprBoolean2; +>resultIsBoolean3 : boolean +>1 + 1 ? exprBoolean1 : exprBoolean2 : boolean +>1 + 1 : number +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +var resultIsNumber3 = "string".length ? exprNumber1 : exprNumber2; +>resultIsNumber3 : number +>"string".length ? exprNumber1 : exprNumber2 : number +>"string".length : number +>length : number +>exprNumber1 : number +>exprNumber2 : number + +var resultIsString3 = foo() ? exprString1 : exprString2; +>resultIsString3 : string +>foo() ? exprString1 : exprString2 : string +>foo() : number +>foo : () => number +>exprString1 : string +>exprString2 : string + +var resultIsObject3 = foo() / array[1] ? exprIsObject1 : exprIsObject2; +>resultIsObject3 : Object +>foo() / array[1] ? exprIsObject1 : exprIsObject2 : Object +>foo() / array[1] : number +>foo() : number +>foo : () => number +>array[1] : number +>array : number[] +>exprIsObject1 : Object +>exprIsObject2 : Object + diff --git a/tests/baselines/reference/conditionalOperatorConditionIsObjectType.types b/tests/baselines/reference/conditionalOperatorConditionIsObjectType.types new file mode 100644 index 00000000000..36c15d64c54 --- /dev/null +++ b/tests/baselines/reference/conditionalOperatorConditionIsObjectType.types @@ -0,0 +1,296 @@ +=== tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsObjectType.ts === +//Cond ? Expr1 : Expr2, Cond is of object type, Expr1 and Expr2 have the same type +var condObject: Object; +>condObject : Object +>Object : Object + +var exprAny1: any; +>exprAny1 : any + +var exprBoolean1: boolean; +>exprBoolean1 : boolean + +var exprNumber1: number; +>exprNumber1 : number + +var exprString1: string; +>exprString1 : string + +var exprIsObject1: Object; +>exprIsObject1 : Object +>Object : Object + +var exprAny2: any; +>exprAny2 : any + +var exprBoolean2: boolean; +>exprBoolean2 : boolean + +var exprNumber2: number; +>exprNumber2 : number + +var exprString2: string; +>exprString2 : string + +var exprIsObject2: Object; +>exprIsObject2 : Object +>Object : Object + +function foo() { }; +>foo : () => void + +class C { static doIt: () => void }; +>C : C +>doIt : () => void + +//Cond is an object type variable +condObject ? exprAny1 : exprAny2; +>condObject ? exprAny1 : exprAny2 : any +>condObject : Object +>exprAny1 : any +>exprAny2 : any + +condObject ? exprBoolean1 : exprBoolean2; +>condObject ? exprBoolean1 : exprBoolean2 : boolean +>condObject : Object +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +condObject ? exprNumber1 : exprNumber2; +>condObject ? exprNumber1 : exprNumber2 : number +>condObject : Object +>exprNumber1 : number +>exprNumber2 : number + +condObject ? exprString1 : exprString2; +>condObject ? exprString1 : exprString2 : string +>condObject : Object +>exprString1 : string +>exprString2 : string + +condObject ? exprIsObject1 : exprIsObject2; +>condObject ? exprIsObject1 : exprIsObject2 : Object +>condObject : Object +>exprIsObject1 : Object +>exprIsObject2 : Object + +//Cond is an object type literal +((a: string) => a.length) ? exprAny1 : exprAny2; +>((a: string) => a.length) ? exprAny1 : exprAny2 : any +>((a: string) => a.length) : (a: string) => number +>(a: string) => a.length : (a: string) => number +>a : string +>a.length : number +>a : string +>length : number +>exprAny1 : any +>exprAny2 : any + +((a: string) => a.length) ? exprBoolean1 : exprBoolean2; +>((a: string) => a.length) ? exprBoolean1 : exprBoolean2 : boolean +>((a: string) => a.length) : (a: string) => number +>(a: string) => a.length : (a: string) => number +>a : string +>a.length : number +>a : string +>length : number +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +({}) ? exprNumber1 : exprNumber2; +>({}) ? exprNumber1 : exprNumber2 : number +>({}) : {} +>{} : {} +>exprNumber1 : number +>exprNumber2 : number + +({ a: 1, b: "s" }) ? exprString1 : exprString2; +>({ a: 1, b: "s" }) ? exprString1 : exprString2 : string +>({ a: 1, b: "s" }) : { a: number; b: string; } +>{ a: 1, b: "s" } : { a: number; b: string; } +>a : number +>b : string +>exprString1 : string +>exprString2 : string + +({ a: 1, b: "s" }) ? exprIsObject1 : exprIsObject2; +>({ a: 1, b: "s" }) ? exprIsObject1 : exprIsObject2 : Object +>({ a: 1, b: "s" }) : { a: number; b: string; } +>{ a: 1, b: "s" } : { a: number; b: string; } +>a : number +>b : string +>exprIsObject1 : Object +>exprIsObject2 : Object + +//Cond is an object type expression +foo() ? exprAny1 : exprAny2; +>foo() ? exprAny1 : exprAny2 : any +>foo() : void +>foo : () => void +>exprAny1 : any +>exprAny2 : any + +new Date() ? exprBoolean1 : exprBoolean2; +>new Date() ? exprBoolean1 : exprBoolean2 : boolean +>new Date() : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +new C() ? exprNumber1 : exprNumber2; +>new C() ? exprNumber1 : exprNumber2 : number +>new C() : C +>C : typeof C +>exprNumber1 : number +>exprNumber2 : number + +C.doIt() ? exprString1 : exprString2; +>C.doIt() ? exprString1 : exprString2 : string +>C.doIt() : void +>C.doIt : () => void +>C : typeof C +>doIt : () => void +>exprString1 : string +>exprString2 : string + +condObject.valueOf() ? exprIsObject1 : exprIsObject2; +>condObject.valueOf() ? exprIsObject1 : exprIsObject2 : Object +>condObject.valueOf() : Object +>condObject.valueOf : () => Object +>condObject : Object +>valueOf : () => Object +>exprIsObject1 : Object +>exprIsObject2 : Object + +//Results shoud be same as Expr1 and Expr2 +var resultIsAny1 = condObject ? exprAny1 : exprAny2; +>resultIsAny1 : any +>condObject ? exprAny1 : exprAny2 : any +>condObject : Object +>exprAny1 : any +>exprAny2 : any + +var resultIsBoolean1 = condObject ? exprBoolean1 : exprBoolean2; +>resultIsBoolean1 : boolean +>condObject ? exprBoolean1 : exprBoolean2 : boolean +>condObject : Object +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +var resultIsNumber1 = condObject ? exprNumber1 : exprNumber2; +>resultIsNumber1 : number +>condObject ? exprNumber1 : exprNumber2 : number +>condObject : Object +>exprNumber1 : number +>exprNumber2 : number + +var resultIsString1 = condObject ? exprString1 : exprString2; +>resultIsString1 : string +>condObject ? exprString1 : exprString2 : string +>condObject : Object +>exprString1 : string +>exprString2 : string + +var resultIsObject1 = condObject ? exprIsObject1 : exprIsObject2; +>resultIsObject1 : Object +>condObject ? exprIsObject1 : exprIsObject2 : Object +>condObject : Object +>exprIsObject1 : Object +>exprIsObject2 : Object + +var resultIsAny2 = ((a: string) => a.length) ? exprAny1 : exprAny2; +>resultIsAny2 : any +>((a: string) => a.length) ? exprAny1 : exprAny2 : any +>((a: string) => a.length) : (a: string) => number +>(a: string) => a.length : (a: string) => number +>a : string +>a.length : number +>a : string +>length : number +>exprAny1 : any +>exprAny2 : any + +var resultIsBoolean2 = ((a: string) => a.length) ? exprBoolean1 : exprBoolean2; +>resultIsBoolean2 : boolean +>((a: string) => a.length) ? exprBoolean1 : exprBoolean2 : boolean +>((a: string) => a.length) : (a: string) => number +>(a: string) => a.length : (a: string) => number +>a : string +>a.length : number +>a : string +>length : number +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +var resultIsNumber2 = ({}) ? exprNumber1 : exprNumber2; +>resultIsNumber2 : number +>({}) ? exprNumber1 : exprNumber2 : number +>({}) : {} +>{} : {} +>exprNumber1 : number +>exprNumber2 : number + +var resultIsString2 = ({ a: 1, b: "s" }) ? exprString1 : exprString2; +>resultIsString2 : string +>({ a: 1, b: "s" }) ? exprString1 : exprString2 : string +>({ a: 1, b: "s" }) : { a: number; b: string; } +>{ a: 1, b: "s" } : { a: number; b: string; } +>a : number +>b : string +>exprString1 : string +>exprString2 : string + +var resultIsObject2 = ({ a: 1, b: "s" }) ? exprIsObject1 : exprIsObject2; +>resultIsObject2 : Object +>({ a: 1, b: "s" }) ? exprIsObject1 : exprIsObject2 : Object +>({ a: 1, b: "s" }) : { a: number; b: string; } +>{ a: 1, b: "s" } : { a: number; b: string; } +>a : number +>b : string +>exprIsObject1 : Object +>exprIsObject2 : Object + +var resultIsAny3 = foo() ? exprAny1 : exprAny2; +>resultIsAny3 : any +>foo() ? exprAny1 : exprAny2 : any +>foo() : void +>foo : () => void +>exprAny1 : any +>exprAny2 : any + +var resultIsBoolean3 = new Date() ? exprBoolean1 : exprBoolean2; +>resultIsBoolean3 : boolean +>new Date() ? exprBoolean1 : exprBoolean2 : boolean +>new Date() : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +var resultIsNumber3 = new C() ? exprNumber1 : exprNumber2; +>resultIsNumber3 : number +>new C() ? exprNumber1 : exprNumber2 : number +>new C() : C +>C : typeof C +>exprNumber1 : number +>exprNumber2 : number + +var resultIsString3 = C.doIt() ? exprString1 : exprString2; +>resultIsString3 : string +>C.doIt() ? exprString1 : exprString2 : string +>C.doIt() : void +>C.doIt : () => void +>C : typeof C +>doIt : () => void +>exprString1 : string +>exprString2 : string + +var resultIsObject3 = condObject.valueOf() ? exprIsObject1 : exprIsObject2; +>resultIsObject3 : Object +>condObject.valueOf() ? exprIsObject1 : exprIsObject2 : Object +>condObject.valueOf() : Object +>condObject.valueOf : () => Object +>condObject : Object +>valueOf : () => Object +>exprIsObject1 : Object +>exprIsObject2 : Object + diff --git a/tests/baselines/reference/conditionalOperatorConditoinIsAnyType.types b/tests/baselines/reference/conditionalOperatorConditoinIsAnyType.types new file mode 100644 index 00000000000..9f5fc9326bb --- /dev/null +++ b/tests/baselines/reference/conditionalOperatorConditoinIsAnyType.types @@ -0,0 +1,259 @@ +=== tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditoinIsAnyType.ts === +//Cond ? Expr1 : Expr2, Cond is of any type, Expr1 and Expr2 have the same type +var condAny: any; +>condAny : any + +var x: any; +>x : any + +var exprAny1: any; +>exprAny1 : any + +var exprBoolean1: boolean; +>exprBoolean1 : boolean + +var exprNumber1: number; +>exprNumber1 : number + +var exprString1: string; +>exprString1 : string + +var exprIsObject1: Object; +>exprIsObject1 : Object +>Object : Object + +var exprAny2: any; +>exprAny2 : any + +var exprBoolean2: boolean; +>exprBoolean2 : boolean + +var exprNumber2: number; +>exprNumber2 : number + +var exprString2: string; +>exprString2 : string + +var exprIsObject2: Object; +>exprIsObject2 : Object +>Object : Object + +//Cond is an any type variable +condAny ? exprAny1 : exprAny2; +>condAny ? exprAny1 : exprAny2 : any +>condAny : any +>exprAny1 : any +>exprAny2 : any + +condAny ? exprBoolean1 : exprBoolean2; +>condAny ? exprBoolean1 : exprBoolean2 : boolean +>condAny : any +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +condAny ? exprNumber1 : exprNumber2; +>condAny ? exprNumber1 : exprNumber2 : number +>condAny : any +>exprNumber1 : number +>exprNumber2 : number + +condAny ? exprString1 : exprString2; +>condAny ? exprString1 : exprString2 : string +>condAny : any +>exprString1 : string +>exprString2 : string + +condAny ? exprIsObject1 : exprIsObject2; +>condAny ? exprIsObject1 : exprIsObject2 : Object +>condAny : any +>exprIsObject1 : Object +>exprIsObject2 : Object + +//Cond is an any type literal +null ? exprAny1 : exprAny2; +>null ? exprAny1 : exprAny2 : any +>exprAny1 : any +>exprAny2 : any + +null ? exprBoolean1 : exprBoolean2; +>null ? exprBoolean1 : exprBoolean2 : boolean +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +undefined ? exprNumber1 : exprNumber2; +>undefined ? exprNumber1 : exprNumber2 : number +>undefined : undefined +>exprNumber1 : number +>exprNumber2 : number + +[null, undefined] ? exprString1 : exprString2; +>[null, undefined] ? exprString1 : exprString2 : string +>[null, undefined] : null[] +>undefined : undefined +>exprString1 : string +>exprString2 : string + +[null, undefined] ? exprIsObject1 : exprIsObject2; +>[null, undefined] ? exprIsObject1 : exprIsObject2 : Object +>[null, undefined] : null[] +>undefined : undefined +>exprIsObject1 : Object +>exprIsObject2 : Object + +//Cond is an any type expression +x.doSomeThing() ? exprAny1 : exprAny2; +>x.doSomeThing() ? exprAny1 : exprAny2 : any +>x.doSomeThing() : any +>x.doSomeThing : any +>x : any +>doSomeThing : any +>exprAny1 : any +>exprAny2 : any + +x("x") ? exprBoolean1 : exprBoolean2; +>x("x") ? exprBoolean1 : exprBoolean2 : boolean +>x("x") : any +>x : any +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +x(x) ? exprNumber1 : exprNumber2; +>x(x) ? exprNumber1 : exprNumber2 : number +>x(x) : any +>x : any +>x : any +>exprNumber1 : number +>exprNumber2 : number + +x("x") ? exprString1 : exprString2; +>x("x") ? exprString1 : exprString2 : string +>x("x") : any +>x : any +>exprString1 : string +>exprString2 : string + +x.doSomeThing() ? exprIsObject1 : exprIsObject2; +>x.doSomeThing() ? exprIsObject1 : exprIsObject2 : Object +>x.doSomeThing() : any +>x.doSomeThing : any +>x : any +>doSomeThing : any +>exprIsObject1 : Object +>exprIsObject2 : Object + +//Results shoud be same as Expr1 and Expr2 +var resultIsAny1 = condAny ? exprAny1 : exprAny2; +>resultIsAny1 : any +>condAny ? exprAny1 : exprAny2 : any +>condAny : any +>exprAny1 : any +>exprAny2 : any + +var resultIsBoolean1 = condAny ? exprBoolean1 : exprBoolean2; +>resultIsBoolean1 : boolean +>condAny ? exprBoolean1 : exprBoolean2 : boolean +>condAny : any +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +var resultIsNumber1 = condAny ? exprNumber1 : exprNumber2; +>resultIsNumber1 : number +>condAny ? exprNumber1 : exprNumber2 : number +>condAny : any +>exprNumber1 : number +>exprNumber2 : number + +var resultIsString1 = condAny ? exprString1 : exprString2; +>resultIsString1 : string +>condAny ? exprString1 : exprString2 : string +>condAny : any +>exprString1 : string +>exprString2 : string + +var resultIsObject1 = condAny ? exprIsObject1 : exprIsObject2; +>resultIsObject1 : Object +>condAny ? exprIsObject1 : exprIsObject2 : Object +>condAny : any +>exprIsObject1 : Object +>exprIsObject2 : Object + +var resultIsAny2 = null ? exprAny1 : exprAny2; +>resultIsAny2 : any +>null ? exprAny1 : exprAny2 : any +>exprAny1 : any +>exprAny2 : any + +var resultIsBoolean2 = null ? exprBoolean1 : exprBoolean2; +>resultIsBoolean2 : boolean +>null ? exprBoolean1 : exprBoolean2 : boolean +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +var resultIsNumber2 = undefined ? exprNumber1 : exprNumber2; +>resultIsNumber2 : number +>undefined ? exprNumber1 : exprNumber2 : number +>undefined : undefined +>exprNumber1 : number +>exprNumber2 : number + +var resultIsString2 = [null, undefined] ? exprString1 : exprString2; +>resultIsString2 : string +>[null, undefined] ? exprString1 : exprString2 : string +>[null, undefined] : null[] +>undefined : undefined +>exprString1 : string +>exprString2 : string + +var resultIsObject2 = [null, undefined] ? exprIsObject1 : exprIsObject2; +>resultIsObject2 : Object +>[null, undefined] ? exprIsObject1 : exprIsObject2 : Object +>[null, undefined] : null[] +>undefined : undefined +>exprIsObject1 : Object +>exprIsObject2 : Object + +var resultIsAny3 = x.doSomeThing() ? exprAny1 : exprAny2; +>resultIsAny3 : any +>x.doSomeThing() ? exprAny1 : exprAny2 : any +>x.doSomeThing() : any +>x.doSomeThing : any +>x : any +>doSomeThing : any +>exprAny1 : any +>exprAny2 : any + +var resultIsBoolean3 = x("x") ? exprBoolean1 : exprBoolean2; +>resultIsBoolean3 : boolean +>x("x") ? exprBoolean1 : exprBoolean2 : boolean +>x("x") : any +>x : any +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +var resultIsNumber3 = x(x) ? exprNumber1 : exprNumber2; +>resultIsNumber3 : number +>x(x) ? exprNumber1 : exprNumber2 : number +>x(x) : any +>x : any +>x : any +>exprNumber1 : number +>exprNumber2 : number + +var resultIsString3 = x("x") ? exprString1 : exprString2; +>resultIsString3 : string +>x("x") ? exprString1 : exprString2 : string +>x("x") : any +>x : any +>exprString1 : string +>exprString2 : string + +var resultIsObject3 = x.doSomeThing() ? exprIsObject1 : exprIsObject2; +>resultIsObject3 : Object +>x.doSomeThing() ? exprIsObject1 : exprIsObject2 : Object +>x.doSomeThing() : any +>x.doSomeThing : any +>x : any +>doSomeThing : any +>exprIsObject1 : Object +>exprIsObject2 : Object + diff --git a/tests/baselines/reference/conditionalOperatorConditoinIsStringType.types b/tests/baselines/reference/conditionalOperatorConditoinIsStringType.types new file mode 100644 index 00000000000..668e0fc437c --- /dev/null +++ b/tests/baselines/reference/conditionalOperatorConditoinIsStringType.types @@ -0,0 +1,245 @@ +=== tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditoinIsStringType.ts === +//Cond ? Expr1 : Expr2, Cond is of string type, Expr1 and Expr2 have the same type +var condString: string; +>condString : string + +var exprAny1: any; +>exprAny1 : any + +var exprBoolean1: boolean; +>exprBoolean1 : boolean + +var exprNumber1: number; +>exprNumber1 : number + +var exprString1: string; +>exprString1 : string + +var exprIsObject1: Object; +>exprIsObject1 : Object +>Object : Object + +var exprAny2: any; +>exprAny2 : any + +var exprBoolean2: boolean; +>exprBoolean2 : boolean + +var exprNumber2: number; +>exprNumber2 : number + +var exprString2: string; +>exprString2 : string + +var exprIsObject2: Object; +>exprIsObject2 : Object +>Object : Object + +//Cond is a string type variable +condString ? exprAny1 : exprAny2; +>condString ? exprAny1 : exprAny2 : any +>condString : string +>exprAny1 : any +>exprAny2 : any + +condString ? exprBoolean1 : exprBoolean2; +>condString ? exprBoolean1 : exprBoolean2 : boolean +>condString : string +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +condString ? exprNumber1 : exprNumber2; +>condString ? exprNumber1 : exprNumber2 : number +>condString : string +>exprNumber1 : number +>exprNumber2 : number + +condString ? exprString1 : exprString2; +>condString ? exprString1 : exprString2 : string +>condString : string +>exprString1 : string +>exprString2 : string + +condString ? exprIsObject1 : exprIsObject2; +>condString ? exprIsObject1 : exprIsObject2 : Object +>condString : string +>exprIsObject1 : Object +>exprIsObject2 : Object + +//Cond is a string type literal +"" ? exprAny1 : exprAny2; +>"" ? exprAny1 : exprAny2 : any +>exprAny1 : any +>exprAny2 : any + +"string" ? exprBoolean1 : exprBoolean2; +>"string" ? exprBoolean1 : exprBoolean2 : boolean +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +'c' ? exprNumber1 : exprNumber2; +>'c' ? exprNumber1 : exprNumber2 : number +>exprNumber1 : number +>exprNumber2 : number + +'string' ? exprString1 : exprString2; +>'string' ? exprString1 : exprString2 : string +>exprString1 : string +>exprString2 : string + +" " ? exprIsObject1 : exprIsObject2; +>" " ? exprIsObject1 : exprIsObject2 : Object +>exprIsObject1 : Object +>exprIsObject2 : Object + +//Cond is a string type expression +function foo() { return "string" }; +>foo : () => string + +var array = ["1", "2", "3"]; +>array : string[] +>["1", "2", "3"] : string[] + +typeof condString ? exprAny1 : exprAny2; +>typeof condString ? exprAny1 : exprAny2 : any +>typeof condString : string +>condString : string +>exprAny1 : any +>exprAny2 : any + +condString.toUpperCase ? exprBoolean1 : exprBoolean2; +>condString.toUpperCase ? exprBoolean1 : exprBoolean2 : boolean +>condString.toUpperCase : () => string +>condString : string +>toUpperCase : () => string +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +condString + "string" ? exprNumber1 : exprNumber2; +>condString + "string" ? exprNumber1 : exprNumber2 : number +>condString + "string" : string +>condString : string +>exprNumber1 : number +>exprNumber2 : number + +foo() ? exprString1 : exprString2; +>foo() ? exprString1 : exprString2 : string +>foo() : string +>foo : () => string +>exprString1 : string +>exprString2 : string + +array[1] ? exprIsObject1 : exprIsObject2; +>array[1] ? exprIsObject1 : exprIsObject2 : Object +>array[1] : string +>array : string[] +>exprIsObject1 : Object +>exprIsObject2 : Object + +//Results shoud be same as Expr1 and Expr2 +var resultIsAny1 = condString ? exprAny1 : exprAny2; +>resultIsAny1 : any +>condString ? exprAny1 : exprAny2 : any +>condString : string +>exprAny1 : any +>exprAny2 : any + +var resultIsBoolean1 = condString ? exprBoolean1 : exprBoolean2; +>resultIsBoolean1 : boolean +>condString ? exprBoolean1 : exprBoolean2 : boolean +>condString : string +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +var resultIsNumber1 = condString ? exprNumber1 : exprNumber2; +>resultIsNumber1 : number +>condString ? exprNumber1 : exprNumber2 : number +>condString : string +>exprNumber1 : number +>exprNumber2 : number + +var resultIsString1 = condString ? exprString1 : exprString2; +>resultIsString1 : string +>condString ? exprString1 : exprString2 : string +>condString : string +>exprString1 : string +>exprString2 : string + +var resultIsObject1 = condString ? exprIsObject1 : exprIsObject2; +>resultIsObject1 : Object +>condString ? exprIsObject1 : exprIsObject2 : Object +>condString : string +>exprIsObject1 : Object +>exprIsObject2 : Object + +var resultIsAny2 = "" ? exprAny1 : exprAny2; +>resultIsAny2 : any +>"" ? exprAny1 : exprAny2 : any +>exprAny1 : any +>exprAny2 : any + +var resultIsBoolean2 = "string" ? exprBoolean1 : exprBoolean2; +>resultIsBoolean2 : boolean +>"string" ? exprBoolean1 : exprBoolean2 : boolean +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +var resultIsNumber2 = 'c' ? exprNumber1 : exprNumber2; +>resultIsNumber2 : number +>'c' ? exprNumber1 : exprNumber2 : number +>exprNumber1 : number +>exprNumber2 : number + +var resultIsString2 = 'string' ? exprString1 : exprString2; +>resultIsString2 : string +>'string' ? exprString1 : exprString2 : string +>exprString1 : string +>exprString2 : string + +var resultIsObject2 = " " ? exprIsObject1 : exprIsObject2; +>resultIsObject2 : Object +>" " ? exprIsObject1 : exprIsObject2 : Object +>exprIsObject1 : Object +>exprIsObject2 : Object + +var resultIsAny3 = typeof condString ? exprAny1 : exprAny2; +>resultIsAny3 : any +>typeof condString ? exprAny1 : exprAny2 : any +>typeof condString : string +>condString : string +>exprAny1 : any +>exprAny2 : any + +var resultIsBoolean3 = condString.toUpperCase ? exprBoolean1 : exprBoolean2; +>resultIsBoolean3 : boolean +>condString.toUpperCase ? exprBoolean1 : exprBoolean2 : boolean +>condString.toUpperCase : () => string +>condString : string +>toUpperCase : () => string +>exprBoolean1 : boolean +>exprBoolean2 : boolean + +var resultIsNumber3 = condString + "string" ? exprNumber1 : exprNumber2; +>resultIsNumber3 : number +>condString + "string" ? exprNumber1 : exprNumber2 : number +>condString + "string" : string +>condString : string +>exprNumber1 : number +>exprNumber2 : number + +var resultIsString3 = foo() ? exprString1 : exprString2; +>resultIsString3 : string +>foo() ? exprString1 : exprString2 : string +>foo() : string +>foo : () => string +>exprString1 : string +>exprString2 : string + +var resultIsObject3 = array[1] ? exprIsObject1 : exprIsObject2; +>resultIsObject3 : Object +>array[1] ? exprIsObject1 : exprIsObject2 : Object +>array[1] : string +>array : string[] +>exprIsObject1 : Object +>exprIsObject2 : Object + diff --git a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types new file mode 100644 index 00000000000..8ad918936d2 --- /dev/null +++ b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types @@ -0,0 +1,188 @@ +=== tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithIdenticalBCT.ts === +//Cond ? Expr1 : Expr2, Expr1 and Expr2 have identical best common type +class X { propertyX: any; propertyX1: number; propertyX2: string }; +>X : X +>propertyX : any +>propertyX1 : number +>propertyX2 : string + +class A extends X { propertyA: number }; +>A : A +>X : X +>propertyA : number + +class B extends X { propertyB: string }; +>B : B +>X : X +>propertyB : string + +var x: X; +>x : X +>X : X + +var a: A; +>a : A +>A : A + +var b: B; +>b : B +>B : B + +//Cond ? Expr1 : Expr2, Expr1 is supertype +//Be Not contextually typed +true ? x : a; +>true ? x : a : X +>x : X +>a : A + +var result1 = true ? x : a; +>result1 : X +>true ? x : a : X +>x : X +>a : A + +//Expr1 and Expr2 are literals +true ? {} : 1; +>true ? {} : 1 : {} +>{} : {} + +true ? { a: 1 } : { a: 2, b: 'string' }; +>true ? { a: 1 } : { a: 2, b: 'string' } : { a: number; } +>{ a: 1 } : { a: number; } +>a : number +>{ a: 2, b: 'string' } : { a: number; b: string; } +>a : number +>b : string + +var result2 = true ? {} : 1; +>result2 : {} +>true ? {} : 1 : {} +>{} : {} + +var result3 = true ? { a: 1 } : { a: 2, b: 'string' }; +>result3 : { a: number; } +>true ? { a: 1 } : { a: 2, b: 'string' } : { a: number; } +>{ a: 1 } : { a: number; } +>a : number +>{ a: 2, b: 'string' } : { a: number; b: string; } +>a : number +>b : string + +//Contextually typed +var resultIsX1: X = true ? x : a; +>resultIsX1 : X +>X : X +>true ? x : a : X +>x : X +>a : A + +var result4: (t: A) => any = true ? (m) => m.propertyX : (n) => n.propertyA; +>result4 : (t: A) => any +>t : A +>A : A +>true ? (m) => m.propertyX : (n) => n.propertyA : (t: A) => any +>(m) => m.propertyX : (m: A) => any +>m : A +>m.propertyX : any +>m : A +>propertyX : any +>(n) => n.propertyA : (n: A) => number +>n : A +>n.propertyA : number +>n : A +>propertyA : number + +//Cond ? Expr1 : Expr2, Expr2 is supertype +//Be Not contextually typed +true ? a : x; +>true ? a : x : X +>a : A +>x : X + +var result5 = true ? a : x; +>result5 : X +>true ? a : x : X +>a : A +>x : X + +//Expr1 and Expr2 are literals +true ? 1 : {}; +>true ? 1 : {} : {} +>{} : {} + +true ? { a: 2, b: 'string' } : { a: 1 }; +>true ? { a: 2, b: 'string' } : { a: 1 } : { a: number; } +>{ a: 2, b: 'string' } : { a: number; b: string; } +>a : number +>b : string +>{ a: 1 } : { a: number; } +>a : number + +var result6 = true ? 1 : {}; +>result6 : {} +>true ? 1 : {} : {} +>{} : {} + +var result7 = true ? { a: 2, b: 'string' } : { a: 1 }; +>result7 : { a: number; } +>true ? { a: 2, b: 'string' } : { a: 1 } : { a: number; } +>{ a: 2, b: 'string' } : { a: number; b: string; } +>a : number +>b : string +>{ a: 1 } : { a: number; } +>a : number + +//Contextually typed +var resultIsX2: X = true ? x : a; +>resultIsX2 : X +>X : X +>true ? x : a : X +>x : X +>a : A + +var result8: (t: A) => any = true ? (m) => m.propertyA : (n) => n.propertyX; +>result8 : (t: A) => any +>t : A +>A : A +>true ? (m) => m.propertyA : (n) => n.propertyX : (t: A) => any +>(m) => m.propertyA : (m: A) => number +>m : A +>m.propertyA : number +>m : A +>propertyA : number +>(n) => n.propertyX : (n: A) => any +>n : A +>n.propertyX : any +>n : A +>propertyX : any + +//Result = Cond ? Expr1 : Expr2, Result is supertype +//Contextually typed +var resultIsX3: X = true ? a : b; +>resultIsX3 : X +>X : X +>true ? a : b : X +>a : A +>b : B + +var result10: (t: X) => any = true ? (m) => m.propertyX1 : (n) => n.propertyX2; +>result10 : (t: X) => any +>t : X +>X : X +>true ? (m) => m.propertyX1 : (n) => n.propertyX2 : (t: X) => any +>(m) => m.propertyX1 : (m: X) => number +>m : X +>m.propertyX1 : number +>m : X +>propertyX1 : number +>(n) => n.propertyX2 : (n: X) => string +>n : X +>n.propertyX2 : string +>n : X +>propertyX2 : string + +//Expr1 and Expr2 are literals +var result11: any = true ? 1 : 'string'; +>result11 : any +>true ? 1 : 'string' : any + diff --git a/tests/baselines/reference/conditionallyDuplicateOverloadsCausedByOverloadResolution.types b/tests/baselines/reference/conditionallyDuplicateOverloadsCausedByOverloadResolution.types new file mode 100644 index 00000000000..021574dfbfa --- /dev/null +++ b/tests/baselines/reference/conditionallyDuplicateOverloadsCausedByOverloadResolution.types @@ -0,0 +1,97 @@ +=== tests/cases/compiler/conditionallyDuplicateOverloadsCausedByOverloadResolution.ts === +declare function foo(func: (x: string, y: string) => any): boolean; +>foo : { (func: (x: string, y: string) => any): boolean; (func: (x: string, y: number) => any): string; } +>func : (x: string, y: string) => any +>x : string +>y : string + +declare function foo(func: (x: string, y: number) => any): string; +>foo : { (func: (x: string, y: string) => any): boolean; (func: (x: string, y: number) => any): string; } +>func : (x: string, y: number) => any +>x : string +>y : number + +var out = foo((x, y) => { +>out : boolean +>foo((x, y) => { + function bar(a: typeof x): void; + function bar(b: typeof y): void; + function bar() { } + return bar; +}) : boolean +>foo : { (func: (x: string, y: string) => any): boolean; (func: (x: string, y: number) => any): string; } +>(x, y) => { + function bar(a: typeof x): void; + function bar(b: typeof y): void; + function bar() { } + return bar; +} : (x: string, y: string) => { (a: string): void; (b: string): void; } +>x : string +>y : string + + function bar(a: typeof x): void; +>bar : { (a: string): void; (b: string): void; } +>a : string +>x : string + + function bar(b: typeof y): void; +>bar : { (a: string): void; (b: string): void; } +>b : string +>y : string + + function bar() { } +>bar : { (a: string): void; (b: string): void; } + + return bar; +>bar : { (a: string): void; (b: string): void; } + +}); + +declare function foo2(func: (x: string, y: string) => any): boolean; +>foo2 : { (func: (x: string, y: string) => any): boolean; (func: (x: string, y: number) => any): string; } +>func : (x: string, y: string) => any +>x : string +>y : string + +declare function foo2(func: (x: string, y: number) => any): string; +>foo2 : { (func: (x: string, y: string) => any): boolean; (func: (x: string, y: number) => any): string; } +>func : (x: string, y: number) => any +>x : string +>y : number + +var out2 = foo2((x, y) => { +>out2 : boolean +>foo2((x, y) => { + var bar: { + (a: typeof x): void; + (b: typeof y): void; + }; + return bar; +}) : boolean +>foo2 : { (func: (x: string, y: string) => any): boolean; (func: (x: string, y: number) => any): string; } +>(x, y) => { + var bar: { + (a: typeof x): void; + (b: typeof y): void; + }; + return bar; +} : (x: string, y: string) => { (a: string): void; (b: string): void; } +>x : string +>y : string + + var bar: { +>bar : { (a: string): void; (b: string): void; } + + (a: typeof x): void; +>a : string +>x : string + + (b: typeof y): void; +>b : string +>y : string + + }; + return bar; +>bar : { (a: string): void; (b: string): void; } + +}); diff --git a/tests/baselines/reference/conformanceFunctionOverloads.types b/tests/baselines/reference/conformanceFunctionOverloads.types new file mode 100644 index 00000000000..a80814ea93e --- /dev/null +++ b/tests/baselines/reference/conformanceFunctionOverloads.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/functions/conformanceFunctionOverloads.ts === +// Function overloads do not emit code +No type information for this code. +No type information for this code.// Function overload signature with optional parameter +No type information for this code. +No type information for this code.// Function overload signature with optional parameter +No type information for this code. +No type information for this code.// Function overloads with generic and non-generic overloads +No type information for this code. +No type information for this code.// Function overloads whose only difference is returning different unconstrained generic parameters +No type information for this code. +No type information for this code.// Function overloads whose only difference is returning different constrained generic parameters +No type information for this code. +No type information for this code.// Function overloads that differ only by type parameter constraints +No type information for this code. +No type information for this code.// Function overloads with matching accessibility +No type information for this code. +No type information for this code.// Function overloads with matching export +No type information for this code. +No type information for this code.// Function overloads with more params than implementation signature +No type information for this code. +No type information for this code.// Function overloads where return types are same infinitely recursive type reference +No type information for this code. +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/constantOverloadFunction.types b/tests/baselines/reference/constantOverloadFunction.types new file mode 100644 index 00000000000..1e74486cb32 --- /dev/null +++ b/tests/baselines/reference/constantOverloadFunction.types @@ -0,0 +1,48 @@ +=== tests/cases/compiler/constantOverloadFunction.ts === +class Base { foo() { } } +>Base : Base +>foo : () => void + +class Derived1 extends Base { bar() { } } +>Derived1 : Derived1 +>Base : Base +>bar : () => void + +class Derived2 extends Base { baz() { } } +>Derived2 : Derived2 +>Base : Base +>baz : () => void + +class Derived3 extends Base { biz() { } } +>Derived3 : Derived3 +>Base : Base +>biz : () => void + +function foo(tagName: 'canvas'): Derived1; +>foo : { (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; (tagName: string): Base; } +>tagName : 'canvas' +>Derived1 : Derived1 + +function foo(tagName: 'div'): Derived2; +>foo : { (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; (tagName: string): Base; } +>tagName : 'div' +>Derived2 : Derived2 + +function foo(tagName: 'span'): Derived3; +>foo : { (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; (tagName: string): Base; } +>tagName : 'span' +>Derived3 : Derived3 + +function foo(tagName: string): Base; +>foo : { (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; (tagName: string): Base; } +>tagName : string +>Base : Base + +function foo(tagName: any): Base { +>foo : { (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; (tagName: string): Base; } +>tagName : any +>Base : Base + + return null; +} + diff --git a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.types b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.types new file mode 100644 index 00000000000..25504880a2a --- /dev/null +++ b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.types @@ -0,0 +1,44 @@ +=== tests/cases/compiler/constraintCheckInGenericBaseTypeReference.ts === +// No errors +class Constraint { +>Constraint : Constraint + + public method() { } +>method : () => void +} +class GenericBase { +>GenericBase : GenericBase +>T : T +>Constraint : Constraint + + public items: any; +>items : any +} +class Derived extends GenericBase { +>Derived : Derived +>GenericBase : GenericBase +>TypeArg : TypeArg + +} +class TypeArg { +>TypeArg : TypeArg + + public method() { +>method : () => void + + Container.People.items; +>Container.People.items : any +>Container.People : Derived +>Container : typeof Container +>People : Derived +>items : any + } +} + +class Container { +>Container : Container + + public static People: Derived +>People : Derived +>Derived : Derived +} diff --git a/tests/baselines/reference/constraintPropagationThroughReturnTypes.types b/tests/baselines/reference/constraintPropagationThroughReturnTypes.types new file mode 100644 index 00000000000..6f56cca28cc --- /dev/null +++ b/tests/baselines/reference/constraintPropagationThroughReturnTypes.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/constraintPropagationThroughReturnTypes.ts === +function g(x: T): T { +>g : (x: T) => T +>T : T +>x : T +>T : T +>T : T + + return x; +>x : T +} + +function f(x: S) { +>f : (x: S) => void +>S : S +>foo : string +>x : S +>S : S + + var y = g(x); +>y : S +>g(x) : S +>g : (x: T) => T +>x : S + + y; +>y : S +} + diff --git a/tests/baselines/reference/constraintSatisfactionWithAny.types b/tests/baselines/reference/constraintSatisfactionWithAny.types new file mode 100644 index 00000000000..e007d3cec73 --- /dev/null +++ b/tests/baselines/reference/constraintSatisfactionWithAny.types @@ -0,0 +1,150 @@ +=== tests/cases/conformance/types/typeParameters/typeArgumentLists/constraintSatisfactionWithAny.ts === +// any is not a valid type argument unless there is no constraint, or the constraint is any + +function foo(x: T): T { return null; } +>foo : (x: T) => T +>T : T +>String : String +>x : T +>T : T +>T : T + +function foo2(x: T): T { return null; } +>foo2 : (x: T) => T +>T : T +>x : number +>x : T +>T : T +>T : T + +//function foo3(x: T): T { return null; } +function foo4(x: T) => void>(x: T): T { return null; } +>foo4 : (x: T) => void>(x: T) => T +>T : T +>T : T +>x : T +>T : T +>x : T +>T : T +>T : T + +var a; +>a : any + +foo(a); +>foo(a) : any +>foo : (x: T) => T +>a : any + +foo2(a); +>foo2(a) : any +>foo2 : (x: T) => T +>a : any + +//foo3(a); +foo4(a); +>foo4(a) : any +>foo4 : (x: T) => void>(x: T) => T +>a : any + +var b: number; +>b : number + +foo(b); +>foo(b) : any +>foo : (x: T) => T +>b : number + +foo2(b); +>foo2(b) : any +>foo2 : (x: T) => T +>b : number + +//foo3(b); +foo4(b); +>foo4(b) : any +>foo4 : (x: T) => void>(x: T) => T +>b : number + +//function foo5(x: T, y: U): T { return null; } +//foo5(a, a); +//foo5(b, b); + +class C { +>C : C +>T : T +>String : String + + constructor(public x: T) { } +>x : T +>T : T +} + +var c1 = new C(a); +>c1 : C +>new C(a) : C +>C : typeof C +>a : any + +var c2 = new C(b); +>c2 : C +>new C(b) : C +>C : typeof C +>b : number + +class C2 { +>C2 : C2 +>T : T +>x : number + + constructor(public x: T) { } +>x : T +>T : T +} + +var c3 = new C2(a); +>c3 : C2 +>new C2(a) : C2 +>C2 : typeof C2 +>a : any + +var c4 = new C2(b); +>c4 : C2 +>new C2(b) : C2 +>C2 : typeof C2 +>b : number + +//class C3 { +// constructor(public x: T) { } +//} + +//var c5 = new C3(a); +//var c6 = new C3(b); + +class C4(x:T) => T> { +>C4 : C4 +>T : T +>T : T +>x : T +>T : T +>T : T + + constructor(public x: T) { } +>x : T +>T : T +} + +var c7 = new C4(a); +>c7 : C4 +>new C4(a) : C4 +>C4 : typeof C4 +>a : any + +var c8 = new C4(b); +>c8 : C4 +>new C4(b) : C4 +>C4 : typeof C4 +>b : number + + + diff --git a/tests/baselines/reference/constraintSatisfactionWithEmptyObject.types b/tests/baselines/reference/constraintSatisfactionWithEmptyObject.types new file mode 100644 index 00000000000..01a7278be31 --- /dev/null +++ b/tests/baselines/reference/constraintSatisfactionWithEmptyObject.types @@ -0,0 +1,107 @@ +=== tests/cases/conformance/types/typeParameters/typeArgumentLists/constraintSatisfactionWithEmptyObject.ts === +// valid uses of a basic object constraint, no errors expected + +// Object constraint +function foo(x: T) { } +>foo : (x: T) => void +>T : T +>Object : Object +>x : T +>T : T + +var r = foo({}); +>r : void +>foo({}) : void +>foo : (x: T) => void +>{} : {} + +var a = {}; +>a : {} +>{} : {} + +var r = foo({}); +>r : void +>foo({}) : void +>foo : (x: T) => void +>{} : {} + +class C { +>C : C +>T : T +>Object : Object + + constructor(public x: T) { } +>x : T +>T : T +} + +var r2 = new C({}); +>r2 : C<{}> +>new C({}) : C<{}> +>C : typeof C +>{} : {} + +interface I { +>I : I +>T : T +>Object : Object + + x: T; +>x : T +>T : T +} +var i: I<{}>; +>i : I<{}> +>I : I + +// {} constraint +function foo2(x: T) { } +>foo2 : (x: T) => void +>T : T +>x : T +>T : T + +var r = foo2({}); +>r : void +>foo2({}) : void +>foo2 : (x: T) => void +>{} : {} + +var a = {}; +>a : {} +>{} : {} + +var r = foo2({}); +>r : void +>foo2({}) : void +>foo2 : (x: T) => void +>{} : {} + +class C2 { +>C2 : C2 +>T : T + + constructor(public x: T) { } +>x : T +>T : T +} + +var r2 = new C2({}); +>r2 : C<{}> +>new C2({}) : C2<{}> +>C2 : typeof C2 +>{} : {} + +interface I2 { +>I2 : I2 +>T : T + + x: T; +>x : T +>T : T +} +var i2: I2<{}>; +>i2 : I2<{}> +>I2 : I2 + + diff --git a/tests/baselines/reference/constraintsUsedInPrototypeProperty.types b/tests/baselines/reference/constraintsUsedInPrototypeProperty.types new file mode 100644 index 00000000000..a92b69a3392 --- /dev/null +++ b/tests/baselines/reference/constraintsUsedInPrototypeProperty.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/constraintsUsedInPrototypeProperty.ts === +class Foo { } +>Foo : Foo +>T : T +>U : U +>V : V + +Foo.prototype; // Foo +>Foo.prototype : Foo +>Foo : typeof Foo +>prototype : Foo + diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.types b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.types new file mode 100644 index 00000000000..9f75c2c4426 --- /dev/null +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.types @@ -0,0 +1,398 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance2.ts === +// checking subtype relations for function types as it relates to contextual signature instantiation + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Derived { baz: string; } +>Derived2 : Derived2 +>Derived : Derived +>baz : string + +class OtherDerived extends Base { bing: string; } +>OtherDerived : OtherDerived +>Base : Base +>bing : string + +interface A { // T +>A : A + + // M's + a: new (x: number) => number[]; +>a : new (x: number) => number[] +>x : number + + a2: new (x: number) => string[]; +>a2 : new (x: number) => string[] +>x : number + + a3: new (x: number) => void; +>a3 : new (x: number) => void +>x : number + + a4: new (x: string, y: number) => string; +>a4 : new (x: string, y: number) => string +>x : string +>y : number + + a5: new (x: (arg: string) => number) => string; +>a5 : new (x: (arg: string) => number) => string +>x : (arg: string) => number +>arg : string + + a6: new (x: (arg: Base) => Derived) => Base; +>a6 : new (x: (arg: Base) => Derived) => Base +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>Base : Base + + a7: new (x: (arg: Base) => Derived) => (r: Base) => Derived; +>a7 : new (x: (arg: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + + a8: new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; +>a8 : new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>y : (arg2: Base) => Derived +>arg2 : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + + a9: new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; +>a9 : new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>y : (arg2: Base) => Derived +>arg2 : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + + a10: new (...x: Derived[]) => Derived; +>a10 : new (...x: Derived[]) => Derived +>x : Derived[] +>Derived : Derived +>Derived : Derived + + a11: new (x: { foo: string }, y: { foo: string; bar: string }) => Base; +>a11 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base +>x : { foo: string; } +>foo : string +>y : { foo: string; bar: string; } +>foo : string +>bar : string +>Base : Base + + a12: new (x: Array, y: Array) => Array; +>a12 : new (x: Base[], y: Derived2[]) => Derived[] +>x : Base[] +>Array : Array +>Base : Base +>y : Derived2[] +>Array : Array +>Derived2 : Derived2 +>Array : Array +>Derived : Derived + + a13: new (x: Array, y: Array) => Array; +>a13 : new (x: Base[], y: Derived[]) => Derived[] +>x : Base[] +>Array : Array +>Base : Base +>y : Derived[] +>Array : Array +>Derived : Derived +>Array : Array +>Derived : Derived + + a14: new (x: { a: string; b: number }) => Object; +>a14 : new (x: { a: string; b: number; }) => Object +>x : { a: string; b: number; } +>a : string +>b : number +>Object : Object + + a15: { +>a15 : { new (x: number): number[]; new (x: string): string[]; } + + new (x: number): number[]; +>x : number + + new (x: string): string[]; +>x : string + + }; + a16: { +>a16 : { new (x: T): number[]; new (x: U): number[]; } + + new (x: T): number[]; +>T : T +>Derived : Derived +>x : T +>T : T + + new (x: U): number[]; +>U : U +>Base : Base +>x : U +>U : U + + }; + a17: { +>a17 : { new (x: new (a: number) => number): number[]; new (x: new (a: string) => string): string[]; } + + new (x: new (a: number) => number): number[]; +>x : new (a: number) => number +>a : number + + new (x: new (a: string) => string): string[]; +>x : new (a: string) => string +>a : string + + }; + a18: { +>a18 : { new (x: { new (a: number): number; new (a: string): string; }): any[]; new (x: { new (a: boolean): boolean; new (a: Date): Date; }): any[]; } + + new (x: { +>x : { new (a: number): number; new (a: string): string; } + + new (a: number): number; +>a : number + + new (a: string): string; +>a : string + + }): any[]; + new (x: { +>x : { new (a: boolean): boolean; new (a: Date): Date; } + + new (a: boolean): boolean; +>a : boolean + + new (a: Date): Date; +>a : Date +>Date : Date +>Date : Date + + }): any[]; + }; +} + +// S's +interface I extends A { +>I : I +>A : A + + // N's + a: new (x: T) => T[]; // ok, instantiation of N is a subtype of M, T is number +>a : new (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + + a2: new (x: T) => string[]; // ok +>a2 : new (x: T) => string[] +>T : T +>x : T +>T : T + + a3: new (x: T) => T; // ok since Base returns void +>a3 : new (x: T) => T +>T : T +>x : T +>T : T +>T : T + + a4: new (x: T, y: U) => T; // ok, instantiation of N is a subtype of M, T is string, U is number +>a4 : new (x: T, y: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T + + a5: new (x: (arg: T) => U) => T; // ok, U is in a parameter position so inferences can be made +>a5 : new (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a6: new (x: (arg: T) => U) => T; // ok, same as a5 but with object type hierarchy +>a6 : new (x: (arg: T) => U) => T +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a7: new (x: (arg: T) => U) => (r: T) => U; // ok +>a7 : new (x: (arg: T) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>r : T +>T : T +>U : U + + a8: new (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U; // ok +>a8 : new (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>y : (arg2: T) => U +>arg2 : T +>T : T +>U : U +>r : T +>T : T +>U : U + + a9: new (x: (arg: T) => U, y: (arg2: { foo: string; bing: number }) => U) => (r: T) => U; // ok, same as a8 with compatible object literal +>a9 : new (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>y : (arg2: { foo: string; bing: number; }) => U +>arg2 : { foo: string; bing: number; } +>foo : string +>bing : number +>U : U +>r : T +>T : T +>U : U + + a10: new (...x: T[]) => T; // ok +>a10 : new (...x: T[]) => T +>T : T +>Derived : Derived +>x : T[] +>T : T +>T : T + + a11: new (x: T, y: T) => T; // ok +>a11 : new (x: T, y: T) => T +>T : T +>Base : Base +>x : T +>T : T +>y : T +>T : T +>T : T + + a12: new >(x: Array, y: T) => Array; // ok, less specific parameter type +>a12 : new (x: Base[], y: T) => Derived[] +>T : T +>Array : Array +>Base : Base +>x : Base[] +>Array : Array +>Base : Base +>y : T +>T : T +>Array : Array +>Derived : Derived + + a13: new >(x: Array, y: T) => T; // ok, T = Array, satisfies constraint, contextual signature instantiation succeeds +>a13 : new (x: Base[], y: T) => T +>T : T +>Array : Array +>Derived : Derived +>x : Base[] +>Array : Array +>Base : Base +>y : T +>T : T +>T : T + + a14: new (x: { a: T; b: T }) => T; // ok, best common type yields T = {} but that's satisfactory for this signature +>a14 : new (x: { a: T; b: T; }) => T +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + + a15: new (x: T) => T[]; // ok +>a15 : new (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + + a16: new (x: T) => number[]; // ok +>a16 : new (x: T) => number[] +>T : T +>Base : Base +>x : T +>T : T + + a17: new (x: new (a: T) => T) => T[]; // ok +>a17 : new (x: new (a: T) => T) => T[] +>T : T +>x : new (a: T) => T +>a : T +>T : T +>T : T +>T : T + + a18: new (x: new (a: T) => T) => T[]; // ok, no inferences for T but assignable to any +>a18 : new (x: new (a: T) => T) => T[] +>T : T +>x : new (a: T) => T +>a : T +>T : T +>T : T +>T : T +} diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.types b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.types new file mode 100644 index 00000000000..7782389d69a --- /dev/null +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.types @@ -0,0 +1,332 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance4.ts === +// checking subtype relations for function types as it relates to contextual signature instantiation + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Derived { baz: string; } +>Derived2 : Derived2 +>Derived : Derived +>baz : string + +class OtherDerived extends Base { bing: string; } +>OtherDerived : OtherDerived +>Base : Base +>bing : string + +interface A { // T +>A : A + + // M's + a: new (x: T) => T[]; +>a : new (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + + a2: new (x: T) => string[]; +>a2 : new (x: T) => string[] +>T : T +>x : T +>T : T + + a3: new (x: T) => void; +>a3 : new (x: T) => void +>T : T +>x : T +>T : T + + a4: new (x: T, y: U) => string; +>a4 : new (x: T, y: U) => string +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U + + a5: new (x: (arg: T) => U) => T; +>a5 : new (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a6: new (x: (arg: T) => Derived) => T; +>a6 : new (x: (arg: T) => Derived) => T +>T : T +>Base : Base +>x : (arg: T) => Derived +>arg : T +>T : T +>Derived : Derived +>T : T + + a11: new (x: { foo: T }, y: { foo: T; bar: T }) => Base; +>a11 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>T : T +>x : { foo: T; } +>foo : T +>T : T +>y : { foo: T; bar: T; } +>foo : T +>T : T +>bar : T +>T : T +>Base : Base + + a15: new (x: { a: T; b: T }) => T[]; +>a15 : new (x: { a: T; b: T; }) => T[] +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + + a16: new (x: { a: T; b: T }) => T[]; +>a16 : new (x: { a: T; b: T; }) => T[] +>T : T +>Base : Base +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + + a17: { +>a17 : { new (x: T): T[]; new (x: U): U[]; } + + new (x: T): T[]; +>T : T +>Base : Base +>x : T +>T : T +>T : T + + new (x: U): U[]; +>U : U +>Derived : Derived +>x : U +>U : U +>U : U + + }; + a18: { +>a18 : { new (x: T): number[]; new (x: U): number[]; } + + new (x: T): number[]; +>T : T +>Derived : Derived +>x : T +>T : T + + new (x: U): number[]; +>U : U +>Base : Base +>x : U +>U : U + + }; + a19: { +>a19 : { new (x: new (a: T) => T): T[]; new (x: new (a: U) => U): U[]; } + + new (x: new (a: T) => T): T[]; +>T : T +>Derived : Derived +>x : new (a: T) => T +>a : T +>T : T +>T : T +>T : T + + new (x: new (a: U) => U): U[]; +>U : U +>Base : Base +>x : new (a: U) => U +>a : U +>U : U +>U : U +>U : U + + }; + a20: { +>a20 : { new (x: { new (a: T): T; new (a: U): U; }): any[]; new (x: { new (a: T): T; new (a: U): U; }): any[]; } + + new (x: { +>x : { new (a: T): T; new (a: U): U; } + + new (a: T): T; +>T : T +>Derived : Derived +>a : T +>T : T +>T : T + + new (a: U): U; +>U : U +>Base : Base +>a : U +>U : U +>U : U + + }): any[]; + new (x: { +>x : { new (a: T): T; new (a: U): U; } + + new (a: T): T; +>T : T +>Base : Base +>a : T +>T : T +>T : T + + new (a: U): U; +>U : U +>Derived2 : Derived2 +>a : U +>U : U +>U : U + + }): any[]; + }; +} + +// S's +interface I extends A { +>I : I +>A : A + + // N's + a: new (x: T) => T[]; // ok, instantiation of N is a subtype of M, T is number +>a : new (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + + a2: new (x: T) => string[]; // ok +>a2 : new (x: T) => string[] +>T : T +>x : T +>T : T + + a3: new (x: T) => T; // ok since Base returns void +>a3 : new (x: T) => T +>T : T +>x : T +>T : T +>T : T + + a4: new (x: T, y: U) => string; // ok, instantiation of N is a subtype of M, T is string, U is number +>a4 : new (x: T, y: U) => string +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U + + a5: new (x: (arg: T) => U) => T; // ok, U is in a parameter position so inferences can be made +>a5 : new (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a6: new (x: (arg: T) => U) => T; // ok, same as a5 but with object type hierarchy +>a6 : new (x: (arg: T) => U) => T +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a11: new (x: { foo: T }, y: { foo: U; bar: U }) => Base; // ok +>a11 : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base +>T : T +>U : U +>x : { foo: T; } +>foo : T +>T : T +>y : { foo: U; bar: U; } +>foo : U +>U : U +>bar : U +>U : U +>Base : Base + + a15: new (x: { a: U; b: V; }) => U[]; // ok, T = U, T = V +>a15 : new (x: { a: U; b: V; }) => U[] +>U : U +>V : V +>x : { a: U; b: V; } +>a : U +>U : U +>b : V +>V : V +>U : U + + a16: new (x: { a: T; b: T }) => T[]; // ok, more general parameter type +>a16 : new (x: { a: T; b: T; }) => T[] +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + + a17: new (x: T) => T[]; // ok, more general parameter type +>a17 : new (x: T) => T[] +>T : T +>Base : Base +>x : T +>T : T +>T : T + + a18: new (x: T) => number[]; // ok, more general parameter type +>a18 : new (x: T) => number[] +>T : T +>Base : Base +>x : T +>T : T + + a19: new (x: new (a: T) => T) => T[]; // ok +>a19 : new (x: new (a: T) => T) => T[] +>T : T +>Base : Base +>x : new (a: T) => T +>a : T +>T : T +>T : T +>T : T + + a20: new (x: new (a: T) => T) => any[]; // ok +>a20 : new (x: new (a: T) => T) => any[] +>x : new (a: T) => T +>T : T +>Base : Base +>a : T +>T : T +>T : T +} diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.types b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.types new file mode 100644 index 00000000000..2574298f68b --- /dev/null +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.types @@ -0,0 +1,314 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance5.ts === +// checking subtype relations for function types as it relates to contextual signature instantiation +// same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Derived { baz: string; } +>Derived2 : Derived2 +>Derived : Derived +>baz : string + +class OtherDerived extends Base { bing: string; } +>OtherDerived : OtherDerived +>Base : Base +>bing : string + +interface A { // T +>A : A + + // M's + a: new (x: number) => number[]; +>a : new (x: number) => number[] +>x : number + + a2: new (x: number) => string[]; +>a2 : new (x: number) => string[] +>x : number + + a3: new (x: number) => void; +>a3 : new (x: number) => void +>x : number + + a4: new (x: string, y: number) => string; +>a4 : new (x: string, y: number) => string +>x : string +>y : number + + a5: new (x: (arg: string) => number) => string; +>a5 : new (x: (arg: string) => number) => string +>x : (arg: string) => number +>arg : string + + a6: new (x: (arg: Base) => Derived) => Base; +>a6 : new (x: (arg: Base) => Derived) => Base +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>Base : Base + + a7: new (x: (arg: Base) => Derived) => (r: Base) => Derived; +>a7 : new (x: (arg: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + + a8: new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; +>a8 : new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>y : (arg2: Base) => Derived +>arg2 : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + + a9: new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; +>a9 : new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived +>x : (arg: Base) => Derived +>arg : Base +>Base : Base +>Derived : Derived +>y : (arg2: Base) => Derived +>arg2 : Base +>Base : Base +>Derived : Derived +>r : Base +>Base : Base +>Derived : Derived + + a10: new (...x: Derived[]) => Derived; +>a10 : new (...x: Derived[]) => Derived +>x : Derived[] +>Derived : Derived +>Derived : Derived + + a11: new (x: { foo: string }, y: { foo: string; bar: string }) => Base; +>a11 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base +>x : { foo: string; } +>foo : string +>y : { foo: string; bar: string; } +>foo : string +>bar : string +>Base : Base + + a12: new (x: Array, y: Array) => Array; +>a12 : new (x: Base[], y: Derived2[]) => Derived[] +>x : Base[] +>Array : Array +>Base : Base +>y : Derived2[] +>Array : Array +>Derived2 : Derived2 +>Array : Array +>Derived : Derived + + a13: new (x: Array, y: Array) => Array; +>a13 : new (x: Base[], y: Derived[]) => Derived[] +>x : Base[] +>Array : Array +>Base : Base +>y : Derived[] +>Array : Array +>Derived : Derived +>Array : Array +>Derived : Derived + + a14: new (x: { a: string; b: number }) => Object; +>a14 : new (x: { a: string; b: number; }) => Object +>x : { a: string; b: number; } +>a : string +>b : number +>Object : Object +} + +interface B extends A { +>B : B +>A : A + + a: new (x: T) => T[]; +>a : new (x: T) => T[] +>T : T +>x : T +>T : T +>T : T +} + +// S's +interface I extends B { +>I : I +>B : B + + // N's + a: new (x: T) => T[]; // ok, instantiation of N is a subtype of M, T is number +>a : new (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + + a2: new (x: T) => string[]; // ok +>a2 : new (x: T) => string[] +>T : T +>x : T +>T : T + + a3: new (x: T) => T; // ok since Base returns void +>a3 : new (x: T) => T +>T : T +>x : T +>T : T +>T : T + + a4: new (x: T, y: U) => T; // ok, instantiation of N is a subtype of M, T is string, U is number +>a4 : new (x: T, y: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T + + a5: new (x: (arg: T) => U) => T; // ok, U is in a parameter position so inferences can be made +>a5 : new (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a6: new (x: (arg: T) => U) => T; // ok, same as a5 but with object type hierarchy +>a6 : new (x: (arg: T) => U) => T +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a7: new (x: (arg: T) => U) => (r: T) => U; // ok +>a7 : new (x: (arg: T) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>r : T +>T : T +>U : U + + a8: new (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U; // ok +>a8 : new (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>y : (arg2: T) => U +>arg2 : T +>T : T +>U : U +>r : T +>T : T +>U : U + + a9: new (x: (arg: T) => U, y: (arg2: { foo: string; bing: number }) => U) => (r: T) => U; // ok, same as a8 with compatible object literal +>a9 : new (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>y : (arg2: { foo: string; bing: number; }) => U +>arg2 : { foo: string; bing: number; } +>foo : string +>bing : number +>U : U +>r : T +>T : T +>U : U + + a10: new (...x: T[]) => T; // ok +>a10 : new (...x: T[]) => T +>T : T +>Derived : Derived +>x : T[] +>T : T +>T : T + + a11: new (x: T, y: T) => T; // ok +>a11 : new (x: T, y: T) => T +>T : T +>Base : Base +>x : T +>T : T +>y : T +>T : T +>T : T + + a12: new >(x: Array, y: T) => Array; // ok, less specific parameter type +>a12 : new (x: Base[], y: T) => Derived[] +>T : T +>Array : Array +>Base : Base +>x : Base[] +>Array : Array +>Base : Base +>y : T +>T : T +>Array : Array +>Derived : Derived + + a13: new >(x: Array, y: T) => T; // ok, T = Array, satisfies constraint, contextual signature instantiation succeeds +>a13 : new (x: Base[], y: T) => T +>T : T +>Array : Array +>Derived : Derived +>x : Base[] +>Array : Array +>Base : Base +>y : T +>T : T +>T : T + + a14: new (x: { a: T; b: T }) => T; // ok, best common type yields T = {} but that's satisfactory for this signature +>a14 : new (x: { a: T; b: T; }) => T +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T +} diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.types b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.types new file mode 100644 index 00000000000..193a19a5f2c --- /dev/null +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.types @@ -0,0 +1,209 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance6.ts === +// checking subtype relations for function types as it relates to contextual signature instantiation +// same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures +// all are errors + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Derived { baz: string; } +>Derived2 : Derived2 +>Derived : Derived +>baz : string + +class OtherDerived extends Base { bing: string; } +>OtherDerived : OtherDerived +>Base : Base +>bing : string + +interface A { // T +>A : A + + // M's + a: new (x: T) => T[]; +>a : new (x: T) => T[] +>T : T +>x : T +>T : T +>T : T + + a2: new (x: T) => string[]; +>a2 : new (x: T) => string[] +>T : T +>x : T +>T : T + + a3: new (x: T) => void; +>a3 : new (x: T) => void +>T : T +>x : T +>T : T + + a4: new (x: T, y: U) => string; +>a4 : new (x: T, y: U) => string +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U + + a5: new (x: (arg: T) => U) => T; +>a5 : new (x: (arg: T) => U) => T +>T : T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T + + a6: new (x: (arg: T) => Derived) => T; +>a6 : new (x: (arg: T) => Derived) => T +>T : T +>Base : Base +>x : (arg: T) => Derived +>arg : T +>T : T +>Derived : Derived +>T : T + + a11: new (x: { foo: T }, y: { foo: T; bar: T }) => Base; +>a11 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base +>T : T +>x : { foo: T; } +>foo : T +>T : T +>y : { foo: T; bar: T; } +>foo : T +>T : T +>bar : T +>T : T +>Base : Base + + a15: new (x: { a: T; b: T }) => T[]; +>a15 : new (x: { a: T; b: T; }) => T[] +>T : T +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T + + a16: new (x: { a: T; b: T }) => T[]; +>a16 : new (x: { a: T; b: T; }) => T[] +>T : T +>Base : Base +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T +} + +// S's +interface I extends A { +>I : I +>T : T +>A : A + + a: new (x: T) => T[]; +>a : new (x: T) => T[] +>x : T +>T : T +>T : T +} + +interface I2 extends A { +>I2 : I2 +>T : T +>A : A + + a2: new (x: T) => string[]; +>a2 : new (x: T) => string[] +>x : T +>T : T +} + +interface I3 extends A { +>I3 : I3 +>T : T +>A : A + + a3: new (x: T) => T; +>a3 : new (x: T) => T +>x : T +>T : T +>T : T +} + +interface I4 extends A { +>I4 : I4 +>T : T +>A : A + + a4: new (x: T, y: U) => string; +>a4 : new (x: T, y: U) => string +>U : U +>x : T +>T : T +>y : U +>U : U +} + +interface I5 extends A { +>I5 : I5 +>T : T +>A : A + + a5: new (x: (arg: T) => U) => T; +>a5 : new (x: (arg: T) => U) => T +>U : U +>x : (arg: T) => U +>arg : T +>T : T +>U : U +>T : T +} + +interface I7 extends A { +>I7 : I7 +>T : T +>A : A + + a11: new (x: { foo: T }, y: { foo: U; bar: U }) => Base; +>a11 : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base +>U : U +>x : { foo: T; } +>foo : T +>T : T +>y : { foo: U; bar: U; } +>foo : U +>U : U +>bar : U +>U : U +>Base : Base +} + +interface I9 extends A { +>I9 : I9 +>T : T +>A : A + + a16: new (x: { a: T; b: T }) => T[]; +>a16 : new (x: { a: T; b: T; }) => T[] +>x : { a: T; b: T; } +>a : T +>T : T +>b : T +>T : T +>T : T +} diff --git a/tests/baselines/reference/constructSignaturesWithIdenticalOverloads.types b/tests/baselines/reference/constructSignaturesWithIdenticalOverloads.types new file mode 100644 index 00000000000..9cbf379ca52 --- /dev/null +++ b/tests/baselines/reference/constructSignaturesWithIdenticalOverloads.types @@ -0,0 +1,158 @@ +=== tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithIdenticalOverloads.ts === +// Duplicate overloads of construct signatures should generate errors + +class C { +>C : C + + constructor(x: number, y: string); +>x : number +>y : string + + constructor(x: number, y: string); // error +>x : number +>y : string + + constructor(x: number) { } +>x : number +} + +var r1 = new C(1, ''); +>r1 : C +>new C(1, '') : C +>C : typeof C + +class C2 { +>C2 : C2 +>T : T + + constructor(x: T, y: string); +>x : T +>T : T +>y : string + + constructor(x: T, y: string); // error +>x : T +>T : T +>y : string + + constructor(x: T) { } +>x : T +>T : T +} + +var r2 = new C2(1, ''); +>r2 : C2 +>new C2(1, '') : C2 +>C2 : typeof C2 + +interface I { +>I : I + + new (x: number, y: string): C; +>x : number +>y : string +>C : C + + new (x: number, y: string): C; // error +>x : number +>y : string +>C : C +} + +var i: I; +>i : I +>I : I + +var r3 = new i(1, ''); +>r3 : C +>new i(1, '') : C +>i : I + +interface I2 { +>I2 : I2 +>T : T + + new (x: T, y: string): C2; +>x : T +>T : T +>y : string +>C2 : C2 +>T : T + + new (x: T, y: string): C2; // error +>x : T +>T : T +>y : string +>C2 : C2 +>T : T + + new (x: T, y: string): C2; +>T : T +>x : T +>T : T +>y : string +>C2 : C2 +>T : T + + new (x: T, y: string): C2; // error +>T : T +>x : T +>T : T +>y : string +>C2 : C2 +>T : T +} + +var i2: I2; +>i2 : I2 +>I2 : I2 + +var r4 = new i2(1, ''); +>r4 : C2 +>new i2(1, '') : C2 +>i2 : I2 + +var a: { +>a : { new (x: number, y: string): C; new (x: number, y: string): C; } + + new (x: number, y: string): C; +>x : number +>y : string +>C : C + + new (x: number, y: string): C; // error +>x : number +>y : string +>C : C +} + +var r5 = new a(1, ''); +>r5 : C +>new a(1, '') : C +>a : { new (x: number, y: string): C; new (x: number, y: string): C; } + +var b: { +>b : { new (x: T, y: string): C2; new (x: T, y: string): C2; } + + new (x: T, y: string): C2; +>T : T +>x : T +>T : T +>y : string +>C2 : C2 +>T : T + + new (x: T, y: string): C2; // error +>T : T +>x : T +>T : T +>y : string +>C2 : C2 +>T : T +} + +var r6 = new b(1, ''); +>r6 : C2 +>new b(1, '') : C2 +>b : { new (x: T, y: string): C2; new (x: T, y: string): C2; } + diff --git a/tests/baselines/reference/constructSignaturesWithOverloads.types b/tests/baselines/reference/constructSignaturesWithOverloads.types new file mode 100644 index 00000000000..e725792d251 --- /dev/null +++ b/tests/baselines/reference/constructSignaturesWithOverloads.types @@ -0,0 +1,159 @@ +=== tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads.ts === +// No errors expected for basic overloads of construct signatures + +class C { +>C : C + + constructor(x: number, y?: string); +>x : number +>y : string + + constructor(x: number, y: string); +>x : number +>y : string + + constructor(x: number) { } +>x : number +} + +var r1 = new C(1, ''); +>r1 : C +>new C(1, '') : C +>C : typeof C + +class C2 { +>C2 : C2 +>T : T + + constructor(x: T, y?: string); +>x : T +>T : T +>y : string + + constructor(x: T, y: string); +>x : T +>T : T +>y : string + + constructor(x: T) { } +>x : T +>T : T +} + +var r2 = new C2(1, ''); +>r2 : C2 +>new C2(1, '') : C2 +>C2 : typeof C2 + +interface I { +>I : I + + new(x: number, y?: string): C; +>x : number +>y : string +>C : C + + new(x: number, y: string): C; +>x : number +>y : string +>C : C +} + +var i: I; +>i : I +>I : I + +var r3 = new i(1, ''); +>r3 : C +>new i(1, '') : C +>i : I + +interface I2 { +>I2 : I2 +>T : T + + new (x: T, y?: string): C2; +>x : T +>T : T +>y : string +>C2 : C2 +>T : T + + new (x: T, y: string): C2; +>x : T +>T : T +>y : string +>C2 : C2 +>T : T + + new (x: T, y?: string): C2; +>T : T +>x : T +>T : T +>y : string +>C2 : C2 +>T : T + + new (x: T, y: string): C2; +>T : T +>x : T +>T : T +>y : string +>C2 : C2 +>T : T + +} + +var i2: I2; +>i2 : I2 +>I2 : I2 + +var r4 = new i2(1, ''); +>r4 : C2 +>new i2(1, '') : C2 +>i2 : I2 + +var a: { +>a : { new (x: number, y?: string): C; new (x: number, y: string): C; } + + new(x: number, y?: string): C; +>x : number +>y : string +>C : C + + new(x: number, y: string): C; +>x : number +>y : string +>C : C +} + +var r5 = new a(1, ''); +>r5 : C +>new a(1, '') : C +>a : { new (x: number, y?: string): C; new (x: number, y: string): C; } + +var b: { +>b : { new (x: T, y?: string): C2; new (x: T, y: string): C2; } + + new(x: T, y?: string): C2; +>T : T +>x : T +>T : T +>y : string +>C2 : C2 +>T : T + + new(x: T, y: string): C2; +>T : T +>x : T +>T : T +>y : string +>C2 : C2 +>T : T +} + +var r6 = new b(1, ''); +>r6 : C2 +>new b(1, '') : C2 +>b : { new (x: T, y?: string): C2; new (x: T, y: string): C2; } + diff --git a/tests/baselines/reference/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.types b/tests/baselines/reference/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.types new file mode 100644 index 00000000000..c24ae97e34d --- /dev/null +++ b/tests/baselines/reference/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.types @@ -0,0 +1,99 @@ +=== tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.ts === +// Error for construct signature overloads to differ only by return type + +class C { +>C : C + + constructor(x: number) { } +>x : number +} + +class C2 { +>C2 : C2 +>T : T + + constructor(x: T, y?: string) { } +>x : T +>T : T +>y : string +} + +interface I { +>I : I + + new(x: number, y: string): C; +>x : number +>y : string +>C : C + + new(x: number, y: string): C2; // error +>x : number +>y : string +>C2 : C2 +} + +interface I2 { +>I2 : I2 +>T : T + + new (x: T, y: string): C2; +>x : T +>T : T +>y : string +>C2 : C2 + + new (x: T, y: string): C; // error +>x : T +>T : T +>y : string +>C : C + + new (x: T, y: string): C2; +>T : T +>x : T +>T : T +>y : string +>C2 : C2 +>T : T + + new (x: T, y: string): C; // error +>T : T +>x : T +>T : T +>y : string +>C : C + +} + +var a: { +>a : { new (x: number, y: string): C2; new (x: number, y: string): C; } + + new (x: number, y: string): C2; +>x : number +>y : string +>C2 : C2 + + new (x: number, y: string): C; // error +>x : number +>y : string +>C : C +} + +var b: { +>b : { new (x: T, y: string): C2; new (x: T, y: string): C; } + + new (x: T, y: string): C2; +>T : T +>x : T +>T : T +>y : string +>C2 : C2 +>T : T + + new (x: T, y: string): C; // error +>T : T +>x : T +>T : T +>y : string +>C : C +} diff --git a/tests/baselines/reference/constructorArgWithGenericCallSignature.types b/tests/baselines/reference/constructorArgWithGenericCallSignature.types new file mode 100644 index 00000000000..de3ed3ae5f1 --- /dev/null +++ b/tests/baselines/reference/constructorArgWithGenericCallSignature.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/constructorArgWithGenericCallSignature.ts === +module Test { +>Test : typeof Test + + export interface MyFunc { +>MyFunc : MyFunc + + (value1: T): T; +>T : T +>value1 : T +>T : T +>T : T + } + export class MyClass { +>MyClass : MyClass + + constructor(func: MyFunc) { } +>func : MyFunc +>MyFunc : MyFunc + } + + export function F(func: MyFunc) { } +>F : (func: MyFunc) => void +>func : MyFunc +>MyFunc : MyFunc +} +var func: Test.MyFunc; +>func : MyFunc +>Test : Test +>MyFunc : MyFunc + +Test.F(func); // OK +>Test.F(func) : void +>Test.F : (func: MyFunc) => void +>Test : typeof Test +>F : (func: MyFunc) => void +>func : MyFunc + +var test = new Test.MyClass(func); // Should be OK +>test : MyClass +>new Test.MyClass(func) : MyClass +>Test.MyClass : typeof MyClass +>Test : typeof Test +>MyClass : typeof MyClass +>func : MyFunc + diff --git a/tests/baselines/reference/constructorArgs.types b/tests/baselines/reference/constructorArgs.types new file mode 100644 index 00000000000..14971ac935f --- /dev/null +++ b/tests/baselines/reference/constructorArgs.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/constructorArgs.ts === +interface Options { +>Options : Options + + value: number; +>value : number +} + +class Super { +>Super : Super + + constructor(value:number) { +>value : number + } +} + +class Sub extends Super { +>Sub : Sub +>Super : Super + + constructor(public options:Options) { +>options : Options +>Options : Options + + super(options.value); +>super(options.value) : void +>options.value : number +>options : Options +>value : number + } +} + diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.types b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.types new file mode 100644 index 00000000000..3702be4f2dc --- /dev/null +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.types @@ -0,0 +1,38 @@ +=== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/constructorFunctionTypeIsAssignableToBaseType.ts === +class Base { +>Base : Base + + static foo: { +>foo : { bar: Object; } + + bar: Object; +>bar : Object +>Object : Object + } +} + +class Derived extends Base { +>Derived : Derived +>Base : Base + + // ok + static foo: { +>foo : { bar: number; } + + bar: number; +>bar : number + } +} + +class Derived2 extends Base { +>Derived2 : Derived2 +>Base : Base + + // ok, use assignability here + static foo: { +>foo : { bar: any; } + + bar: any; +>bar : any + } +} diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.types b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.types new file mode 100644 index 00000000000..b9fccd0efea --- /dev/null +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.types @@ -0,0 +1,62 @@ +=== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/constructorFunctionTypeIsAssignableToBaseType2.ts === +// the constructor function itself does not need to be a subtype of the base type constructor function + +class Base { +>Base : Base + + static foo: { +>foo : { bar: Object; } + + bar: Object; +>bar : Object +>Object : Object + } + constructor(x: Object) { +>x : Object +>Object : Object + } +} + +class Derived extends Base { +>Derived : Derived +>Base : Base + + // ok + static foo: { +>foo : { bar: number; } + + bar: number; +>bar : number + } + + constructor(x: number) { +>x : number + + super(x); +>super(x) : void +>x : number + } +} + +class Derived2 extends Base { +>Derived2 : Derived2 +>Base : Base + + static foo: { +>foo : { bar: number; } + + bar: number; +>bar : number + } + + // ok, not enforcing assignability relation on this + constructor(x: any) { +>x : any + + super(x); +>super(x) : void +>x : any + + return 1; + } +} diff --git a/tests/baselines/reference/constructorHasPrototypeProperty.types b/tests/baselines/reference/constructorHasPrototypeProperty.types new file mode 100644 index 00000000000..a39b95cc137 --- /dev/null +++ b/tests/baselines/reference/constructorHasPrototypeProperty.types @@ -0,0 +1,100 @@ +=== tests/cases/conformance/classes/members/constructorFunctionTypes/constructorHasPrototypeProperty.ts === +module NonGeneric { +>NonGeneric : typeof NonGeneric + + class C { +>C : C + + foo: string; +>foo : string + } + + class D extends C { +>D : D +>C : C + + bar: string; +>bar : string + } + + var r = C.prototype; +>r : C +>C.prototype : C +>C : typeof C +>prototype : C + + r.foo; +>r.foo : string +>r : C +>foo : string + + var r2 = D.prototype; +>r2 : D +>D.prototype : D +>D : typeof D +>prototype : D + + r2.bar; +>r2.bar : string +>r2 : D +>bar : string +} + +module Generic { +>Generic : typeof Generic + + class C { +>C : C +>T : T +>U : U + + foo: T; +>foo : T +>T : T + + bar: U; +>bar : U +>U : U + } + + class D extends C { +>D : D +>T : T +>U : U +>C : C +>T : T +>U : U + + baz: T; +>baz : T +>T : T + + bing: U; +>bing : U +>U : U + } + + var r = C.prototype; // C +>r : C +>C.prototype : C +>C : typeof C +>prototype : C + + var ra = r.foo; // any +>ra : any +>r.foo : any +>r : C +>foo : any + + var r2 = D.prototype; // D +>r2 : D +>D.prototype : D +>D : typeof D +>prototype : D + + var rb = r2.baz; // any +>rb : any +>r2.baz : any +>r2 : D +>baz : any +} diff --git a/tests/baselines/reference/constructorImplementationWithDefaultValues.types b/tests/baselines/reference/constructorImplementationWithDefaultValues.types new file mode 100644 index 00000000000..6dc2b4f285b --- /dev/null +++ b/tests/baselines/reference/constructorImplementationWithDefaultValues.types @@ -0,0 +1,50 @@ +=== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues.ts === +class C { +>C : C + + constructor(x); +>x : any + + constructor(x = 1) { +>x : number + + var y = x; +>y : number +>x : number + } +} + +class D { +>D : D +>T : T + + constructor(x); +>x : any + + constructor(x:T = null) { +>x : T +>T : T + + var y = x; +>y : T +>x : T + } +} + +class E { +>E : E +>T : T +>Date : Date + + constructor(x); +>x : any + + constructor(x: T = null) { +>x : T +>T : T + + var y = x; +>y : T +>x : T + } +} diff --git a/tests/baselines/reference/constructorOverloads2.types b/tests/baselines/reference/constructorOverloads2.types new file mode 100644 index 00000000000..fc5b97723b4 --- /dev/null +++ b/tests/baselines/reference/constructorOverloads2.types @@ -0,0 +1,73 @@ +=== tests/cases/compiler/constructorOverloads2.ts === +class FooBase { +>FooBase : FooBase + + constructor(s: string); +>s : string + + constructor(n: number); +>n : number + + constructor(x: any) { +>x : any + } + bar1() { /*WScript.Echo("base bar1");*/ } +>bar1 : () => void +} + +class Foo extends FooBase { +>Foo : Foo +>FooBase : FooBase + + constructor(s: string); +>s : string + + constructor(n: number); +>n : number + + constructor(a:any); +>a : any + + constructor(x: any, y?: any) { +>x : any +>y : any + + super(x); +>super(x) : void +>x : any + } + bar1() { /*WScript.Echo("bar1");*/ } +>bar1 : () => void +} + +var f1 = new Foo("hey"); +>f1 : Foo +>new Foo("hey") : Foo +>Foo : typeof Foo + +var f2 = new Foo(0); +>f2 : Foo +>new Foo(0) : Foo +>Foo : typeof Foo + +var f3 = new Foo(f1); +>f3 : Foo +>new Foo(f1) : Foo +>Foo : typeof Foo +>f1 : Foo + +var f4 = new Foo([f1,f2,f3]); +>f4 : Foo +>new Foo([f1,f2,f3]) : Foo +>Foo : typeof Foo +>[f1,f2,f3] : Foo[] +>f1 : Foo +>f2 : Foo +>f3 : Foo + +f1.bar1(); +>f1.bar1() : void +>f1.bar1 : () => void +>f1 : Foo +>bar1 : () => void + diff --git a/tests/baselines/reference/constructorOverloadsWithOptionalParameters.types b/tests/baselines/reference/constructorOverloadsWithOptionalParameters.types new file mode 100644 index 00000000000..c68aa782252 --- /dev/null +++ b/tests/baselines/reference/constructorOverloadsWithOptionalParameters.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorOverloadsWithOptionalParameters.ts === +class C { +>C : C + + foo: string; +>foo : string + + constructor(x?, y?: any[]); +>x : any +>y : any[] + + constructor() { + } +} + +class D { +>D : D +>T : T + + foo: string; +>foo : string + + constructor(x?, y?: any[]); +>x : any +>y : any[] + + constructor() { + } +} diff --git a/tests/baselines/reference/constructorReturningAPrimitive.types b/tests/baselines/reference/constructorReturningAPrimitive.types new file mode 100644 index 00000000000..c4ca2ba7078 --- /dev/null +++ b/tests/baselines/reference/constructorReturningAPrimitive.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/constructorReturningAPrimitive.ts === +// technically not allowed by JavaScript but we don't have a 'not-primitive' constraint +// functionally only possible when your class is otherwise devoid of members so of little consequence in practice + +class A { +>A : A + + constructor() { + return 1; + } +} + +var a = new A(); +>a : A +>new A() : A +>A : typeof A + +class B { +>B : B +>T : T + + constructor() { + var x: T; +>x : T +>T : T + + return x; +>x : T + } +} + +var b = new B(); +>b : B +>new B() : B +>B : typeof B + diff --git a/tests/baselines/reference/constructorStaticParamName.types b/tests/baselines/reference/constructorStaticParamName.types new file mode 100644 index 00000000000..9fdc94e4a73 --- /dev/null +++ b/tests/baselines/reference/constructorStaticParamName.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/constructorStaticParamName.ts === +// static as constructor parameter name should only give error if 'use strict' + +class test { +>test : test + + constructor (static) { } +>static : any +} + diff --git a/tests/baselines/reference/constructorTypeWithTypeParameters.types b/tests/baselines/reference/constructorTypeWithTypeParameters.types new file mode 100644 index 00000000000..e1f094bf8ef --- /dev/null +++ b/tests/baselines/reference/constructorTypeWithTypeParameters.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/constructorTypeWithTypeParameters.ts === +declare var X: { +>X : new () => number + + new (): number; +>T : T +} +declare var Y: { +>Y : new () => number + + new (): number; +} +var anotherVar: new () => number; +>anotherVar : new () => number +>T : T + diff --git a/tests/baselines/reference/constructorWithExpressionLessReturn.types b/tests/baselines/reference/constructorWithExpressionLessReturn.types new file mode 100644 index 00000000000..595a4ae533f --- /dev/null +++ b/tests/baselines/reference/constructorWithExpressionLessReturn.types @@ -0,0 +1,41 @@ +=== tests/cases/conformance/classes/constructorDeclarations/constructorWithExpressionLessReturn.ts === +class C { +>C : C + + constructor() { + return; + } +} + +class D { +>D : D + + x: number; +>x : number + + constructor() { + return; + } +} + +class E { +>E : E + + constructor(public x: number) { +>x : number + + return; + } +} + +class F { +>F : F +>T : T + + constructor(public x: T) { +>x : T +>T : T + + return; + } +} diff --git a/tests/baselines/reference/contextualSigInstantiationRestParams.types b/tests/baselines/reference/contextualSigInstantiationRestParams.types new file mode 100644 index 00000000000..76a00310fd9 --- /dev/null +++ b/tests/baselines/reference/contextualSigInstantiationRestParams.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/contextualSigInstantiationRestParams.ts === +declare function toInstantiate(a?: A, b?: B): B; +>toInstantiate : (a?: A, b?: B) => B +>A : A +>B : B +>a : A +>A : A +>b : B +>B : B +>B : B + +declare function contextual(...s: string[]): string +>contextual : (...s: string[]) => string +>s : string[] + +var sig: typeof contextual = toInstantiate; +>sig : (...s: string[]) => string +>contextual : (...s: string[]) => string +>toInstantiate : (a?: A, b?: B) => B + diff --git a/tests/baselines/reference/contextualSignatureInstantiation1.types b/tests/baselines/reference/contextualSignatureInstantiation1.types new file mode 100644 index 00000000000..3a95e87b76f --- /dev/null +++ b/tests/baselines/reference/contextualSignatureInstantiation1.types @@ -0,0 +1,60 @@ +=== tests/cases/compiler/contextualSignatureInstantiation1.ts === +declare function map(f: (x: S) => T): (a: S[]) => T[]; +>map : (f: (x: S) => T) => (a: S[]) => T[] +>S : S +>T : T +>f : (x: S) => T +>x : S +>S : S +>T : T +>a : S[] +>S : S +>T : T + +var e = (x: string, y?: K) => x.length; +>e : (x: string, y?: K) => number +>(x: string, y?: K) => x.length : (x: string, y?: K) => number +>K : K +>x : string +>y : K +>K : K +>x.length : number +>x : string +>length : number + +var r99 = map(e); // should be {}[] for S since a generic lambda is not inferentially typed +>r99 : (a: {}[]) => number[] +>map(e) : (a: {}[]) => number[] +>map : (f: (x: S) => T) => (a: S[]) => T[] +>e : (x: string, y?: K) => number + +declare function map2(f: (x: S) => T): (a: S[]) => T[]; +>map2 : (f: (x: S) => T) => (a: S[]) => T[] +>S : S +>length : number +>T : T +>f : (x: S) => T +>x : S +>S : S +>T : T +>a : S[] +>S : S +>T : T + +var e2 = (x: string, y?: K) => x.length; +>e2 : (x: string, y?: K) => number +>(x: string, y?: K) => x.length : (x: string, y?: K) => number +>K : K +>x : string +>y : K +>K : K +>x.length : number +>x : string +>length : number + +var r100 = map2(e2); // type arg inference should fail for S since a generic lambda is not inferentially typed. Falls back to { length: number } +>r100 : (a: { length: number; }[]) => number[] +>map2(e2) : (a: { length: number; }[]) => number[] +>map2 : (f: (x: S) => T) => (a: S[]) => T[] +>e2 : (x: string, y?: K) => number + diff --git a/tests/baselines/reference/contextualSignatureInstantiation2.types b/tests/baselines/reference/contextualSignatureInstantiation2.types new file mode 100644 index 00000000000..3c28c472517 --- /dev/null +++ b/tests/baselines/reference/contextualSignatureInstantiation2.types @@ -0,0 +1,61 @@ +=== tests/cases/compiler/contextualSignatureInstantiation2.ts === +// dot f g x = f(g(x)) +var dot: (f: (_: T) => S) => (g: (_: U) => T) => (_: U) => S; +>dot : (f: (_: T) => S) => (g: (_: U) => T) => (_: U) => S +>T : T +>S : S +>f : (_: T) => S +>_ : T +>T : T +>S : S +>U : U +>g : (_: U) => T +>_ : U +>U : U +>T : T +>_ : U +>U : U +>S : S + +dot = (f: (_: T) => S) => (g: (_: U) => T): (r:U) => S => (x) => f(g(x)); +>dot = (f: (_: T) => S) => (g: (_: U) => T): (r:U) => S => (x) => f(g(x)) : (f: (_: T) => S) => (g: (_: U) => T) => (r: U) => S +>dot : (f: (_: T) => S) => (g: (_: U) => T) => (_: U) => S +>(f: (_: T) => S) => (g: (_: U) => T): (r:U) => S => (x) => f(g(x)) : (f: (_: T) => S) => (g: (_: U) => T) => (r: U) => S +>T : T +>S : S +>f : (_: T) => S +>_ : T +>T : T +>S : S +>(g: (_: U) => T): (r:U) => S => (x) => f(g(x)) : (g: (_: U) => T) => (r: U) => S +>U : U +>g : (_: U) => T +>_ : U +>U : U +>T : T +>r : U +>U : U +>S : S +>(x) => f(g(x)) : (x: U) => S +>x : U +>f(g(x)) : S +>f : (_: T) => S +>g(x) : T +>g : (_: U) => T +>x : U + +var id: (x:T) => T; +>id : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +var r23 = dot(id)(id); +>r23 : (_: {}) => {} +>dot(id)(id) : (_: {}) => {} +>dot(id) : (g: (_: U) => {}) => (_: U) => {} +>dot : (f: (_: T) => S) => (g: (_: U) => T) => (_: U) => S +>id : (x: T) => T +>id : (x: T) => T + diff --git a/tests/baselines/reference/contextualSignatureInstantiation3.types b/tests/baselines/reference/contextualSignatureInstantiation3.types new file mode 100644 index 00000000000..c6ed5a7e97d --- /dev/null +++ b/tests/baselines/reference/contextualSignatureInstantiation3.types @@ -0,0 +1,83 @@ +=== tests/cases/compiler/contextualSignatureInstantiation3.ts === +function map(items: T[], f: (x: T) => U): U[]{ +>map : (items: T[], f: (x: T) => U) => U[] +>T : T +>U : U +>items : T[] +>T : T +>f : (x: T) => U +>x : T +>T : T +>U : U +>U : U + + return items.map(f); +>items.map(f) : U[] +>items.map : (callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any) => U[] +>items : T[] +>map : (callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any) => U[] +>f : (x: T) => U +} + +function identity(x: T) { +>identity : (x: T) => T +>T : T +>x : T +>T : T + + return x; +>x : T +} + +function singleton(x: T) { +>singleton : (x: T) => T[] +>T : T +>x : T +>T : T + + return [x]; +>[x] : T[] +>x : T +} + +var xs = [1, 2, 3]; +>xs : number[] +>[1, 2, 3] : number[] + +// Have compiler check that we get the correct types +var v1: number[]; +>v1 : number[] + +var v1 = xs.map(identity); // Error if not number[] +>v1 : number[] +>xs.map(identity) : number[] +>xs.map : (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[] +>xs : number[] +>map : (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[] +>identity : (x: T) => T + +var v1 = map(xs, identity); // Error if not number[] +>v1 : number[] +>map(xs, identity) : number[] +>map : (items: T[], f: (x: T) => U) => U[] +>xs : number[] +>identity : (x: T) => T + +var v2: number[][]; +>v2 : number[][] + +var v2 = xs.map(singleton); // Error if not number[][] +>v2 : number[][] +>xs.map(singleton) : number[][] +>xs.map : (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[] +>xs : number[] +>map : (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[] +>singleton : (x: T) => T[] + +var v2 = map(xs, singleton); // Error if not number[][] +>v2 : number[][] +>map(xs, singleton) : number[][] +>map : (items: T[], f: (x: T) => U) => U[] +>xs : number[] +>singleton : (x: T) => T[] + diff --git a/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.types b/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.types new file mode 100644 index 00000000000..89ea3028d94 --- /dev/null +++ b/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.types @@ -0,0 +1,35 @@ +=== tests/cases/compiler/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.ts === +function f() { +>f : () => (u: U) => U +>T : T + + function g(u: U): U { return null } +>g : (u: U) => U +>U : U +>T : T +>u : U +>U : U +>U : U + + return g; +>g : (u: U) => U +} +var h: (v: V, func: (v: V) => W) => W; +>h : (v: V, func: (v: V) => W) => W +>V : V +>W : W +>v : V +>V : V +>func : (v: V) => W +>v : V +>V : V +>W : W +>W : W + +var x = h("", f()); // Call should succeed and x should be string. All type parameters should be instantiated to string +>x : string +>h("", f()) : string +>h : (v: V, func: (v: V) => W) => W +>f() : (u: U) => U +>f : () => (u: U) => U + diff --git a/tests/baselines/reference/contextualSignatureInstatiationContravariance.types b/tests/baselines/reference/contextualSignatureInstatiationContravariance.types new file mode 100644 index 00000000000..d1d8a38dbc4 --- /dev/null +++ b/tests/baselines/reference/contextualSignatureInstatiationContravariance.types @@ -0,0 +1,48 @@ +=== tests/cases/compiler/contextualSignatureInstatiationContravariance.ts === +interface Animal { x } +>Animal : Animal +>x : any + +interface Giraffe extends Animal { y } +>Giraffe : Giraffe +>Animal : Animal +>y : any + +interface Elephant extends Animal { y2 } +>Elephant : Elephant +>Animal : Animal +>y2 : any + +var f2: (x: T, y: T) => void; +>f2 : (x: T, y: T) => void +>T : T +>Animal : Animal +>x : T +>T : T +>y : T +>T : T + +var g2: (g: Giraffe, e: Elephant) => void; +>g2 : (g: Giraffe, e: Elephant) => void +>g : Giraffe +>Giraffe : Giraffe +>e : Elephant +>Elephant : Elephant + +g2 = f2; // valid because both Giraffe and Elephant satisfy the constraint. T is Animal +>g2 = f2 : (x: T, y: T) => void +>g2 : (g: Giraffe, e: Elephant) => void +>f2 : (x: T, y: T) => void + +var h2: (g1: Giraffe, g2: Giraffe) => void; +>h2 : (g1: Giraffe, g2: Giraffe) => void +>g1 : Giraffe +>Giraffe : Giraffe +>g2 : Giraffe +>Giraffe : Giraffe + +h2 = f2; // valid because Giraffe satisfies the constraint. It is safe in the traditional contravariant fashion. +>h2 = f2 : (x: T, y: T) => void +>h2 : (g1: Giraffe, g2: Giraffe) => void +>f2 : (x: T, y: T) => void + diff --git a/tests/baselines/reference/contextualSignatureInstatiationCovariance.types b/tests/baselines/reference/contextualSignatureInstatiationCovariance.types new file mode 100644 index 00000000000..40ec11a473b --- /dev/null +++ b/tests/baselines/reference/contextualSignatureInstatiationCovariance.types @@ -0,0 +1,48 @@ +=== tests/cases/compiler/contextualSignatureInstatiationCovariance.ts === +interface Animal { x } +>Animal : Animal +>x : any + +interface TallThing { x2 } +>TallThing : TallThing +>x2 : any + +interface Giraffe extends Animal, TallThing { y } +>Giraffe : Giraffe +>Animal : Animal +>TallThing : TallThing +>y : any + +var f2: (x: T, y: T) => void; +>f2 : (x: T, y: T) => void +>T : T +>Giraffe : Giraffe +>x : T +>T : T +>y : T +>T : T + +var g2: (a: Animal, t: TallThing) => void; +>g2 : (a: Animal, t: TallThing) => void +>a : Animal +>Animal : Animal +>t : TallThing +>TallThing : TallThing + +g2 = f2; // While neither Animal nor TallThing satisfy the constraint, T is at worst a Giraffe and compatible with both via covariance. +>g2 = f2 : (x: T, y: T) => void +>g2 : (a: Animal, t: TallThing) => void +>f2 : (x: T, y: T) => void + +var h2: (a1: Animal, a2: Animal) => void; +>h2 : (a1: Animal, a2: Animal) => void +>a1 : Animal +>Animal : Animal +>a2 : Animal +>Animal : Animal + +h2 = f2; // Animal does not satisfy the constraint, but T is at worst a Giraffe and compatible with Animal via covariance. +>h2 = f2 : (x: T, y: T) => void +>h2 : (a1: Animal, a2: Animal) => void +>f2 : (x: T, y: T) => void + diff --git a/tests/baselines/reference/contextualTypeAny.types b/tests/baselines/reference/contextualTypeAny.types new file mode 100644 index 00000000000..9ea4c5c2139 --- /dev/null +++ b/tests/baselines/reference/contextualTypeAny.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/contextualTypeAny.ts === +var x: any; +>x : any + +var obj: { [s: string]: number } = { p: "", q: x }; +>obj : { [x: string]: number; } +>s : string +>{ p: "", q: x } : { [x: string]: any; p: string; q: any; } +>p : string +>q : any +>x : x + +var arr: number[] = ["", x]; +>arr : number[] +>["", x] : any[] +>x : any + diff --git a/tests/baselines/reference/contextualTypeAppliedToVarArgs.types b/tests/baselines/reference/contextualTypeAppliedToVarArgs.types new file mode 100644 index 00000000000..2ae7600faa5 --- /dev/null +++ b/tests/baselines/reference/contextualTypeAppliedToVarArgs.types @@ -0,0 +1,52 @@ +=== tests/cases/compiler/contextualTypeAppliedToVarArgs.ts === +function delegate(instance: any, method: (...args: any[]) => any, data?: any): (...args: any[]) => any { +>delegate : (instance: any, method: (...args: any[]) => any, data?: any) => (...args: any[]) => any +>instance : any +>method : (...args: any[]) => any +>args : any[] +>data : any +>args : any[] + + return function () { }; +>function () { } : () => void +} + +class Foo{ +>Foo : Foo + + + Bar() { +>Bar : () => void + + delegate(this, function (source, args2) +>delegate(this, function (source, args2) + { + var a = source.node; + var b = args2.node; + } ) : (...args: any[]) => any +>delegate : (instance: any, method: (...args: any[]) => any, data?: any) => (...args: any[]) => any +>this : Foo +>function (source, args2) + { + var a = source.node; + var b = args2.node; + } : (source: any, args2: any) => void +>source : any +>args2 : any + { + var a = source.node; +>a : any +>source.node : any +>source : any +>node : any + + var b = args2.node; +>b : any +>args2.node : any +>args2 : any +>node : any + + } ); + } +} + diff --git a/tests/baselines/reference/contextualTypeArrayReturnType.types b/tests/baselines/reference/contextualTypeArrayReturnType.types new file mode 100644 index 00000000000..62790f234ce --- /dev/null +++ b/tests/baselines/reference/contextualTypeArrayReturnType.types @@ -0,0 +1,57 @@ +=== tests/cases/compiler/contextualTypeArrayReturnType.ts === +interface IBookStyle { +>IBookStyle : IBookStyle + + initialLeftPageTransforms?: (width: number) => NamedTransform[]; +>initialLeftPageTransforms : (width: number) => NamedTransform[] +>width : number +>NamedTransform : NamedTransform +} + +interface NamedTransform { +>NamedTransform : NamedTransform + + [name: string]: Transform3D; +>name : string +>Transform3D : Transform3D +} + +interface Transform3D { +>Transform3D : Transform3D + + cachedCss: string; +>cachedCss : string +} + +var style: IBookStyle = { +>style : IBookStyle +>IBookStyle : IBookStyle +>{ + initialLeftPageTransforms: (width: number) => { + return [ + {'ry': null } + ]; + } +} : { initialLeftPageTransforms: (width: number) => NamedTransform[]; } + + initialLeftPageTransforms: (width: number) => { +>initialLeftPageTransforms : (width: number) => NamedTransform[] +>(width: number) => { + return [ + {'ry': null } + ]; + } : (width: number) => NamedTransform[] +>width : number + + return [ +>[ + {'ry': null } + ] : NamedTransform[] + + {'ry': null } +>{'ry': null } : { [x: string]: Transform3D; 'ry': null; } + + ]; + } +} + diff --git a/tests/baselines/reference/contextualTyping1.types b/tests/baselines/reference/contextualTyping1.types new file mode 100644 index 00000000000..a9d2f982569 --- /dev/null +++ b/tests/baselines/reference/contextualTyping1.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/contextualTyping1.ts === +var foo: {id:number;} = {id:4}; +>foo : { id: number; } +>id : number +>{id:4} : { id: number; } +>id : number + diff --git a/tests/baselines/reference/contextualTyping10.types b/tests/baselines/reference/contextualTyping10.types new file mode 100644 index 00000000000..e3a6c2bcf4a --- /dev/null +++ b/tests/baselines/reference/contextualTyping10.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/contextualTyping10.ts === +class foo { public bar:{id:number;}[] = [{id:1}, {id:2}]; } +>foo : foo +>bar : { id: number; }[] +>id : number +>[{id:1}, {id:2}] : { id: number; }[] +>{id:1} : { id: number; } +>id : number +>{id:2} : { id: number; } +>id : number + diff --git a/tests/baselines/reference/contextualTyping12.types b/tests/baselines/reference/contextualTyping12.types new file mode 100644 index 00000000000..31d4e990938 --- /dev/null +++ b/tests/baselines/reference/contextualTyping12.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/contextualTyping12.ts === +class foo { public bar:{id:number;}[] = [{id:1}, {id:2, name:"foo"}]; } +>foo : foo +>bar : { id: number; }[] +>id : number +>[{id:1}, {id:2, name:"foo"}] : { id: number; }[] +>{id:1} : { id: number; } +>id : number +>{id:2, name:"foo"} : { id: number; name: string; } +>id : number +>name : string + diff --git a/tests/baselines/reference/contextualTyping13.types b/tests/baselines/reference/contextualTyping13.types new file mode 100644 index 00000000000..5f7753970f3 --- /dev/null +++ b/tests/baselines/reference/contextualTyping13.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/contextualTyping13.ts === +var foo:(a:number)=>number = function(a){return a}; +>foo : (a: number) => number +>a : number +>function(a){return a} : (a: number) => number +>a : number +>a : number + diff --git a/tests/baselines/reference/contextualTyping14.types b/tests/baselines/reference/contextualTyping14.types new file mode 100644 index 00000000000..6602cc11cbc --- /dev/null +++ b/tests/baselines/reference/contextualTyping14.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/contextualTyping14.ts === +class foo { public bar:(a:number)=>number = function(a){return a}; } +>foo : foo +>bar : (a: number) => number +>a : number +>function(a){return a} : (a: number) => number +>a : number +>a : number + diff --git a/tests/baselines/reference/contextualTyping15.types b/tests/baselines/reference/contextualTyping15.types new file mode 100644 index 00000000000..c039504efbe --- /dev/null +++ b/tests/baselines/reference/contextualTyping15.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/contextualTyping15.ts === +class foo { public bar: { (): number; (i: number): number; } = function() { return 1 }; } +>foo : foo +>bar : { (): number; (i: number): number; } +>i : number +>function() { return 1 } : () => number + diff --git a/tests/baselines/reference/contextualTyping16.types b/tests/baselines/reference/contextualTyping16.types new file mode 100644 index 00000000000..9e11cd5bf3b --- /dev/null +++ b/tests/baselines/reference/contextualTyping16.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/contextualTyping16.ts === +var foo: {id:number;} = {id:4}; foo = {id:5}; +>foo : { id: number; } +>id : number +>{id:4} : { id: number; } +>id : number +>foo = {id:5} : { id: number; } +>foo : { id: number; } +>{id:5} : { id: number; } +>id : number + diff --git a/tests/baselines/reference/contextualTyping17.types b/tests/baselines/reference/contextualTyping17.types new file mode 100644 index 00000000000..63b18af94ab --- /dev/null +++ b/tests/baselines/reference/contextualTyping17.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/contextualTyping17.ts === +var foo: {id:number;} = {id:4}; foo = {id: 5, name:"foo"}; +>foo : { id: number; } +>id : number +>{id:4} : { id: number; } +>id : number +>foo = {id: 5, name:"foo"} : { id: number; name: string; } +>foo : { id: number; } +>{id: 5, name:"foo"} : { id: number; name: string; } +>id : number +>name : string + diff --git a/tests/baselines/reference/contextualTyping18.types b/tests/baselines/reference/contextualTyping18.types new file mode 100644 index 00000000000..0c3cd5fd963 --- /dev/null +++ b/tests/baselines/reference/contextualTyping18.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/contextualTyping18.ts === +var foo: {id:number;} = <{id:number;}>({ }); foo = {id: 5}; +>foo : { id: number; } +>id : number +><{id:number;}>({ }) : { id: number; } +>id : number +>({ }) : {} +>{ } : {} +>foo = {id: 5} : { id: number; } +>foo : { id: number; } +>{id: 5} : { id: number; } +>id : number + diff --git a/tests/baselines/reference/contextualTyping19.types b/tests/baselines/reference/contextualTyping19.types new file mode 100644 index 00000000000..6b07986e6e6 --- /dev/null +++ b/tests/baselines/reference/contextualTyping19.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/contextualTyping19.ts === +var foo:{id:number;}[] = [{id:1}]; foo = [{id:1}, {id:2}]; +>foo : { id: number; }[] +>id : number +>[{id:1}] : { id: number; }[] +>{id:1} : { id: number; } +>id : number +>foo = [{id:1}, {id:2}] : { id: number; }[] +>foo : { id: number; }[] +>[{id:1}, {id:2}] : { id: number; }[] +>{id:1} : { id: number; } +>id : number +>{id:2} : { id: number; } +>id : number + diff --git a/tests/baselines/reference/contextualTyping2.types b/tests/baselines/reference/contextualTyping2.types new file mode 100644 index 00000000000..3474a284982 --- /dev/null +++ b/tests/baselines/reference/contextualTyping2.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/contextualTyping2.ts === +var foo: {id:number;} = {id:4, name:"foo"}; +>foo : { id: number; } +>id : number +>{id:4, name:"foo"} : { id: number; name: string; } +>id : number +>name : string + diff --git a/tests/baselines/reference/contextualTyping20.types b/tests/baselines/reference/contextualTyping20.types new file mode 100644 index 00000000000..e233e745cc6 --- /dev/null +++ b/tests/baselines/reference/contextualTyping20.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/contextualTyping20.ts === +var foo:{id:number;}[] = [{id:1}]; foo = [{id:1}, {id:2, name:"foo"}]; +>foo : { id: number; }[] +>id : number +>[{id:1}] : { id: number; }[] +>{id:1} : { id: number; } +>id : number +>foo = [{id:1}, {id:2, name:"foo"}] : { id: number; }[] +>foo : { id: number; }[] +>[{id:1}, {id:2, name:"foo"}] : { id: number; }[] +>{id:1} : { id: number; } +>id : number +>{id:2, name:"foo"} : { id: number; name: string; } +>id : number +>name : string + diff --git a/tests/baselines/reference/contextualTyping22.types b/tests/baselines/reference/contextualTyping22.types new file mode 100644 index 00000000000..206dc668e8e --- /dev/null +++ b/tests/baselines/reference/contextualTyping22.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/contextualTyping22.ts === +var foo:(a:number)=>number = function(a){return a}; foo = function(b){return b}; +>foo : (a: number) => number +>a : number +>function(a){return a} : (a: number) => number +>a : number +>a : number +>foo = function(b){return b} : (b: number) => number +>foo : (a: number) => number +>function(b){return b} : (b: number) => number +>b : number +>b : number + diff --git a/tests/baselines/reference/contextualTyping23.types b/tests/baselines/reference/contextualTyping23.types new file mode 100644 index 00000000000..7e0d86920ea --- /dev/null +++ b/tests/baselines/reference/contextualTyping23.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/contextualTyping23.ts === +var foo:(a:{():number; (i:number):number; })=>number; foo = function(a){return 5}; +>foo : (a: { (): number; (i: number): number; }) => number +>a : { (): number; (i: number): number; } +>i : number +>foo = function(a){return 5} : (a: { (): number; (i: number): number; }) => number +>foo : (a: { (): number; (i: number): number; }) => number +>function(a){return 5} : (a: { (): number; (i: number): number; }) => number +>a : { (): number; (i: number): number; } + diff --git a/tests/baselines/reference/contextualTyping25.types b/tests/baselines/reference/contextualTyping25.types new file mode 100644 index 00000000000..3c6442739a2 --- /dev/null +++ b/tests/baselines/reference/contextualTyping25.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/contextualTyping25.ts === +function foo(param:{id:number;}){}; foo(<{id:number;}>({})); +>foo : (param: { id: number; }) => void +>param : { id: number; } +>id : number +>foo(<{id:number;}>({})) : void +>foo : (param: { id: number; }) => void +><{id:number;}>({}) : { id: number; } +>id : number +>({}) : {} +>{} : {} + diff --git a/tests/baselines/reference/contextualTyping26.types b/tests/baselines/reference/contextualTyping26.types new file mode 100644 index 00000000000..65a089f6082 --- /dev/null +++ b/tests/baselines/reference/contextualTyping26.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/contextualTyping26.ts === +function foo(param:{id:number;}){}; foo(<{id:number;}>({})); +>foo : (param: { id: number; }) => void +>param : { id: number; } +>id : number +>foo(<{id:number;}>({})) : void +>foo : (param: { id: number; }) => void +><{id:number;}>({}) : { id: number; } +>id : number +>({}) : {} +>{} : {} + diff --git a/tests/baselines/reference/contextualTyping27.types b/tests/baselines/reference/contextualTyping27.types new file mode 100644 index 00000000000..f668565e43d --- /dev/null +++ b/tests/baselines/reference/contextualTyping27.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/contextualTyping27.ts === +function foo(param:{id:number;}){}; foo(<{id:number;}>({})); +>foo : (param: { id: number; }) => void +>param : { id: number; } +>id : number +>foo(<{id:number;}>({})) : void +>foo : (param: { id: number; }) => void +><{id:number;}>({}) : { id: number; } +>id : number +>({}) : {} +>{} : {} + diff --git a/tests/baselines/reference/contextualTyping28.types b/tests/baselines/reference/contextualTyping28.types new file mode 100644 index 00000000000..6019fde4a6b --- /dev/null +++ b/tests/baselines/reference/contextualTyping28.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/contextualTyping28.ts === +function foo(param:number[]){}; foo([1]); +>foo : (param: number[]) => void +>param : number[] +>foo([1]) : void +>foo : (param: number[]) => void +>[1] : number[] + diff --git a/tests/baselines/reference/contextualTyping29.types b/tests/baselines/reference/contextualTyping29.types new file mode 100644 index 00000000000..9666e60e959 --- /dev/null +++ b/tests/baselines/reference/contextualTyping29.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/contextualTyping29.ts === +function foo(param:number[]){}; foo([1, 3]); +>foo : (param: number[]) => void +>param : number[] +>foo([1, 3]) : void +>foo : (param: number[]) => void +>[1, 3] : number[] + diff --git a/tests/baselines/reference/contextualTyping3.types b/tests/baselines/reference/contextualTyping3.types new file mode 100644 index 00000000000..ef00a78f5b4 --- /dev/null +++ b/tests/baselines/reference/contextualTyping3.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/contextualTyping3.ts === +class foo { public bar:{id:number;} = {id:5}; } +>foo : foo +>bar : { id: number; } +>id : number +>{id:5} : { id: number; } +>id : number + diff --git a/tests/baselines/reference/contextualTyping31.types b/tests/baselines/reference/contextualTyping31.types new file mode 100644 index 00000000000..e37bacd33f3 --- /dev/null +++ b/tests/baselines/reference/contextualTyping31.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/contextualTyping31.ts === +function foo(param:number[]){}; foo([1]); +>foo : (param: number[]) => void +>param : number[] +>foo([1]) : void +>foo : (param: number[]) => void +>[1] : number[] + diff --git a/tests/baselines/reference/contextualTyping32.types b/tests/baselines/reference/contextualTyping32.types new file mode 100644 index 00000000000..a9d41405b93 --- /dev/null +++ b/tests/baselines/reference/contextualTyping32.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/contextualTyping32.ts === +function foo(param: {():number; (i:number):number; }[]) { }; foo([function(){return 1;}, function(){return 4}]); +>foo : (param: { (): number; (i: number): number; }[]) => void +>param : { (): number; (i: number): number; }[] +>i : number +>foo([function(){return 1;}, function(){return 4}]) : void +>foo : (param: { (): number; (i: number): number; }[]) => void +>[function(){return 1;}, function(){return 4}] : { (): number; (i: number): number; }[] +>function(){return 1;} : () => number +>function(){return 4} : () => number + diff --git a/tests/baselines/reference/contextualTyping34.types b/tests/baselines/reference/contextualTyping34.types new file mode 100644 index 00000000000..dde11b7d4b1 --- /dev/null +++ b/tests/baselines/reference/contextualTyping34.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/contextualTyping34.ts === +var foo = <{ id: number;}> ({id:4}); +>foo : { id: number; } +><{ id: number;}> ({id:4}) : { id: number; } +>id : number +>({id:4}) : { id: number; } +>{id:4} : { id: number; } +>id : number + diff --git a/tests/baselines/reference/contextualTyping35.types b/tests/baselines/reference/contextualTyping35.types new file mode 100644 index 00000000000..ea07f429176 --- /dev/null +++ b/tests/baselines/reference/contextualTyping35.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/contextualTyping35.ts === +var foo = <{ id: number;}> {id:4, name: "as"}; +>foo : { id: number; } +><{ id: number;}> {id:4, name: "as"} : { id: number; } +>id : number +>{id:4, name: "as"} : { id: number; name: string; } +>id : number +>name : string + diff --git a/tests/baselines/reference/contextualTyping36.types b/tests/baselines/reference/contextualTyping36.types new file mode 100644 index 00000000000..8fb3f147f0a --- /dev/null +++ b/tests/baselines/reference/contextualTyping36.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/contextualTyping36.ts === +var foo = <{ id: number; }[]>[{ id: 4 }, <{ id: number; }>({ })]; +>foo : { id: number; }[] +><{ id: number; }[]>[{ id: 4 }, <{ id: number; }>({ })] : { id: number; }[] +>id : number +>[{ id: 4 }, <{ id: number; }>({ })] : { id: number; }[] +>{ id: 4 } : { id: number; } +>id : number +><{ id: number; }>({ }) : { id: number; } +>id : number +>({ }) : {} +>{ } : {} + diff --git a/tests/baselines/reference/contextualTyping37.types b/tests/baselines/reference/contextualTyping37.types new file mode 100644 index 00000000000..2180e74b5a1 --- /dev/null +++ b/tests/baselines/reference/contextualTyping37.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/contextualTyping37.ts === +var foo = <{ id: number; }[]>[{ foo: "s" }, { }]; +>foo : { id: number; }[] +><{ id: number; }[]>[{ foo: "s" }, { }] : { id: number; }[] +>id : number +>[{ foo: "s" }, { }] : {}[] +>{ foo: "s" } : { foo: string; } +>foo : string +>{ } : {} + diff --git a/tests/baselines/reference/contextualTyping38.types b/tests/baselines/reference/contextualTyping38.types new file mode 100644 index 00000000000..f838c0914f0 --- /dev/null +++ b/tests/baselines/reference/contextualTyping38.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/contextualTyping38.ts === +var foo = <{ (): number; }> function(a) { return a }; +>foo : () => number +><{ (): number; }> function(a) { return a } : () => number +>function(a) { return a } : (a: any) => any +>a : any +>a : any + diff --git a/tests/baselines/reference/contextualTyping4.types b/tests/baselines/reference/contextualTyping4.types new file mode 100644 index 00000000000..6af7adb86f3 --- /dev/null +++ b/tests/baselines/reference/contextualTyping4.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/contextualTyping4.ts === +class foo { public bar:{id:number;} = {id:5, name:"foo"}; } +>foo : foo +>bar : { id: number; } +>id : number +>{id:5, name:"foo"} : { id: number; name: string; } +>id : number +>name : string + diff --git a/tests/baselines/reference/contextualTyping40.types b/tests/baselines/reference/contextualTyping40.types new file mode 100644 index 00000000000..f659cdc8c92 --- /dev/null +++ b/tests/baselines/reference/contextualTyping40.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/contextualTyping40.ts === +var foo = <{():number; (i:number):number; }> function(){return 1;}; +>foo : { (): number; (i: number): number; } +><{():number; (i:number):number; }> function(){return 1;} : { (): number; (i: number): number; } +>i : number +>function(){return 1;} : () => number + diff --git a/tests/baselines/reference/contextualTyping6.types b/tests/baselines/reference/contextualTyping6.types new file mode 100644 index 00000000000..ab63159924f --- /dev/null +++ b/tests/baselines/reference/contextualTyping6.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/contextualTyping6.ts === +var foo:{id:number;}[] = [{id:1}, {id:2}]; +>foo : { id: number; }[] +>id : number +>[{id:1}, {id:2}] : { id: number; }[] +>{id:1} : { id: number; } +>id : number +>{id:2} : { id: number; } +>id : number + diff --git a/tests/baselines/reference/contextualTyping7.types b/tests/baselines/reference/contextualTyping7.types new file mode 100644 index 00000000000..3b239417e2e --- /dev/null +++ b/tests/baselines/reference/contextualTyping7.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/contextualTyping7.ts === +var foo:{id:number;}[] = [<{id:number;}>({})]; +>foo : { id: number; }[] +>id : number +>[<{id:number;}>({})] : { id: number; }[] +><{id:number;}>({}) : { id: number; } +>id : number +>({}) : {} +>{} : {} + diff --git a/tests/baselines/reference/contextualTyping8.types b/tests/baselines/reference/contextualTyping8.types new file mode 100644 index 00000000000..17ba999524c --- /dev/null +++ b/tests/baselines/reference/contextualTyping8.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/contextualTyping8.ts === +var foo:{id:number;}[] = [<{id:number;}>({})]; +>foo : { id: number; }[] +>id : number +>[<{id:number;}>({})] : { id: number; }[] +><{id:number;}>({}) : { id: number; } +>id : number +>({}) : {} +>{} : {} + diff --git a/tests/baselines/reference/contextualTyping9.types b/tests/baselines/reference/contextualTyping9.types new file mode 100644 index 00000000000..9d63203583d --- /dev/null +++ b/tests/baselines/reference/contextualTyping9.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/contextualTyping9.ts === +var foo:{id:number;}[] = [{id:1}, {id:2, name:"foo"}]; +>foo : { id: number; }[] +>id : number +>[{id:1}, {id:2, name:"foo"}] : { id: number; }[] +>{id:1} : { id: number; } +>id : number +>{id:2, name:"foo"} : { id: number; name: string; } +>id : number +>name : string + diff --git a/tests/baselines/reference/contextualTypingArrayOfLambdas.types b/tests/baselines/reference/contextualTypingArrayOfLambdas.types new file mode 100644 index 00000000000..f3bb8bab70f --- /dev/null +++ b/tests/baselines/reference/contextualTypingArrayOfLambdas.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/contextualTypingArrayOfLambdas.ts === +class A { +>A : A + + foo: string; +>foo : string +} + +class B extends A { +>B : B +>A : A + + bar: string; +>bar : string +} + +class C extends A { +>C : C +>A : A + + baz: string; +>baz : string +} + +var xs = [(x: A) => { }, (x: B) => { }, (x: C) => { }]; +>xs : { (x: A): void; }[] +>[(x: A) => { }, (x: B) => { }, (x: C) => { }] : { (x: A): void; }[] +>(x: A) => { } : (x: A) => void +>x : A +>A : A +>(x: B) => { } : (x: B) => void +>x : B +>B : B +>(x: C) => { } : (x: C) => void +>x : C +>C : C + diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression.types b/tests/baselines/reference/contextualTypingOfConditionalExpression.types new file mode 100644 index 00000000000..6c6f9b04457 --- /dev/null +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression.types @@ -0,0 +1,55 @@ +=== tests/cases/compiler/contextualTypingOfConditionalExpression.ts === +var x: (a: number) => void = true ? (a) => a.toExponential() : (b) => b.toFixed(); +>x : (a: number) => void +>a : number +>true ? (a) => a.toExponential() : (b) => b.toFixed() : (a: number) => void +>(a) => a.toExponential() : (a: number) => string +>a : number +>a.toExponential() : string +>a.toExponential : (fractionDigits?: number) => string +>a : number +>toExponential : (fractionDigits?: number) => string +>(b) => b.toFixed() : (b: number) => string +>b : number +>b.toFixed() : string +>b.toFixed : (fractionDigits?: number) => string +>b : number +>toFixed : (fractionDigits?: number) => string + +class A { +>A : A + + foo: number; +>foo : number +} +class B extends A { +>B : B +>A : A + + bar: number; +>bar : number +} +class C extends A { +>C : C +>A : A + + baz: number; +>baz : number +} + +var x2: (a: A) => void = true ? (a) => a.foo : (b) => b.foo; +>x2 : (a: A) => void +>a : A +>A : A +>true ? (a) => a.foo : (b) => b.foo : (a: A) => void +>(a) => a.foo : (a: A) => number +>a : A +>a.foo : number +>a : A +>foo : number +>(b) => b.foo : (b: A) => number +>b : A +>b.foo : number +>b : A +>foo : number + diff --git a/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures.types b/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures.types new file mode 100644 index 00000000000..485c7159b77 --- /dev/null +++ b/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/contextualTypingOfLambdaWithMultipleSignatures.ts === +interface Foo { +>Foo : Foo + + getFoo(n: number): void; +>getFoo : { (n: number): void; (s: string): void; } +>n : number + + getFoo(s: string): void; +>getFoo : { (n: number): void; (s: string): void; } +>s : string +} + +var foo: Foo; +>foo : Foo +>Foo : Foo + +foo.getFoo = bar => { }; +>foo.getFoo = bar => { } : (bar: any) => void +>foo.getFoo : { (n: number): void; (s: string): void; } +>foo : Foo +>getFoo : { (n: number): void; (s: string): void; } +>bar => { } : (bar: any) => void +>bar : any + diff --git a/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.types b/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.types new file mode 100644 index 00000000000..1b7f328b5f1 --- /dev/null +++ b/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/contextualTypingOfLambdaWithMultipleSignatures2.ts === +var f: { +>f : { (x: string): string; (x: number): string; } + + (x: string): string; +>x : string + + (x: number): string +>x : number + +}; + +f = (a) => { return a.asdf } +>f = (a) => { return a.asdf } : (a: any) => any +>f : { (x: string): string; (x: number): string; } +>(a) => { return a.asdf } : (a: any) => any +>a : any +>a.asdf : any +>a : any +>asdf : any + diff --git a/tests/baselines/reference/contextualTypingTwoInstancesOfSameTypeParameter.types b/tests/baselines/reference/contextualTypingTwoInstancesOfSameTypeParameter.types new file mode 100644 index 00000000000..0e5c25a9282 --- /dev/null +++ b/tests/baselines/reference/contextualTypingTwoInstancesOfSameTypeParameter.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/contextualTypingTwoInstancesOfSameTypeParameter.ts === +function f6(x: (a: T) => T) { +>f6 : (x: (a: T) => T) => any +>T : T +>x : (a: T) => T +>a : T +>T : T +>T : T + + return null; +} +f6(x => f6(y => x = y)); +>f6(x => f6(y => x = y)) : any +>f6 : (x: (a: T) => T) => any +>x => f6(y => x = y) : (x: {}) => any +>x : {} +>f6(y => x = y) : any +>f6 : (x: (a: T) => T) => any +>y => x = y : (y: {}) => {} +>y : {} +>x = y : {} +>x : {} +>y : {} + diff --git a/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.types b/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.types new file mode 100644 index 00000000000..ca6c5b35f3d --- /dev/null +++ b/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.types @@ -0,0 +1,55 @@ +=== tests/cases/compiler/contextualTypingWithGenericAndNonGenericSignature.ts === +//• If e is a FunctionExpression or ArrowFunctionExpression with no type parameters and no parameter or return type annotations, and T is a function type with EXACTLY ONE non - generic call signature, then any inferences made for type parameters referenced by the parameters of T’s call signature are fixed(section 4.12.2) and e is processed with the contextual type T, as described in section 4.9.3. + +var f2: { +>f2 : { (x: string, y: number): string; (x: T, y: U): T; } + + (x: string, y: number): string; +>x : string +>y : number + + (x: T, y: U): T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T + +}; + +f2 = (x, y) => { return x } +>f2 = (x, y) => { return x } : (x: any, y: any) => any +>f2 : { (x: string, y: number): string; (x: T, y: U): T; } +>(x, y) => { return x } : (x: any, y: any) => any +>x : any +>y : any +>x : any + +var f3: { +>f3 : { (x: T, y: U): T; (x: string, y: number): string; } + + (x: T, y: U): T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T + + (x: string, y: number): string; +>x : string +>y : number + +}; + +f3 = (x, y) => { return x } +>f3 = (x, y) => { return x } : (x: any, y: any) => any +>f3 : { (x: T, y: U): T; (x: string, y: number): string; } +>(x, y) => { return x } : (x: any, y: any) => any +>x : any +>y : any +>x : any + diff --git a/tests/baselines/reference/contextualTypingWithGenericSignature.types b/tests/baselines/reference/contextualTypingWithGenericSignature.types new file mode 100644 index 00000000000..68c5f3c422d --- /dev/null +++ b/tests/baselines/reference/contextualTypingWithGenericSignature.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/contextualTypingWithGenericSignature.ts === +// If e is a FunctionExpression or ArrowFunctionExpression with no type parameters and no parameter or return type annotations, and T is a function type with EXACTLY ONE non - generic call signature, then any inferences made for type parameters referenced by the parameters of T’s call signature are fixed(section 4.12.2) and e is processed with the contextual type T, as described in section 4.9.3. + +var f2: { +>f2 : (x: T, y: U) => T + + (x: T, y: U): T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T + +}; + +f2 = (x, y) => { return x } +>f2 = (x, y) => { return x } : (x: any, y: any) => any +>f2 : (x: T, y: U) => T +>(x, y) => { return x } : (x: any, y: any) => any +>x : any +>y : any +>x : any + diff --git a/tests/baselines/reference/contextuallyTypingOrOperator.types b/tests/baselines/reference/contextuallyTypingOrOperator.types new file mode 100644 index 00000000000..ee1ac4b0bba --- /dev/null +++ b/tests/baselines/reference/contextuallyTypingOrOperator.types @@ -0,0 +1,54 @@ +=== tests/cases/compiler/contextuallyTypingOrOperator.ts === +var v: { a: (_: string) => number } = { a: s => s.length } || { a: s => 1 }; +>v : { a: (_: string) => number; } +>a : (_: string) => number +>_ : string +>{ a: s => s.length } || { a: s => 1 } : { a: (_: string) => number; } +>{ a: s => s.length } : { a: (s: string) => number; } +>a : (s: string) => number +>s => s.length : (s: string) => number +>s : string +>s.length : number +>s : string +>length : number +>{ a: s => 1 } : { a: (s: string) => number; } +>a : (s: string) => number +>s => 1 : (s: string) => number +>s : string + +var v2 = (s: string) => s.length || function (s) { s.length }; +>v2 : (s: string) => {} +>(s: string) => s.length || function (s) { s.length } : (s: string) => {} +>s : string +>s.length || function (s) { s.length } : {} +>s.length : number +>s : string +>length : number +>function (s) { s.length } : (s: any) => void +>s : any +>s.length : any +>s : any +>length : any + +var v3 = (s: string) => s.length || function (s: number) { return 1 }; +>v3 : (s: string) => {} +>(s: string) => s.length || function (s: number) { return 1 } : (s: string) => {} +>s : string +>s.length || function (s: number) { return 1 } : {} +>s.length : number +>s : string +>length : number +>function (s: number) { return 1 } : (s: number) => number +>s : number + +var v4 = (s: number) => 1 || function (s: string) { return s.length }; +>v4 : (s: number) => {} +>(s: number) => 1 || function (s: string) { return s.length } : (s: number) => {} +>s : number +>1 || function (s: string) { return s.length } : {} +>function (s: string) { return s.length } : (s: string) => number +>s : string +>s.length : number +>s : string +>length : number + diff --git a/tests/baselines/reference/contextuallyTypingOrOperator2.types b/tests/baselines/reference/contextuallyTypingOrOperator2.types new file mode 100644 index 00000000000..57c9992436d --- /dev/null +++ b/tests/baselines/reference/contextuallyTypingOrOperator2.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/contextuallyTypingOrOperator2.ts === +var v: { a: (_: string) => number } = { a: s => s.length } || { a: s => 1 }; +>v : { a: (_: string) => number; } +>a : (_: string) => number +>_ : string +>{ a: s => s.length } || { a: s => 1 } : { a: (_: string) => number; } +>{ a: s => s.length } : { a: (s: string) => number; } +>a : (s: string) => number +>s => s.length : (s: string) => number +>s : string +>s.length : number +>s : string +>length : number +>{ a: s => 1 } : { a: (s: string) => number; } +>a : (s: string) => number +>s => 1 : (s: string) => number +>s : string + +var v2 = (s: string) => s.length || function (s) { s.aaa }; +>v2 : (s: string) => {} +>(s: string) => s.length || function (s) { s.aaa } : (s: string) => {} +>s : string +>s.length || function (s) { s.aaa } : {} +>s.length : number +>s : string +>length : number +>function (s) { s.aaa } : (s: any) => void +>s : any +>s.aaa : any +>s : any +>aaa : any + diff --git a/tests/baselines/reference/convertKeywords.types b/tests/baselines/reference/convertKeywords.types new file mode 100644 index 00000000000..776ef3c4416 --- /dev/null +++ b/tests/baselines/reference/convertKeywords.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/convertKeywords.ts === +var abstract; +>abstract : any + + + diff --git a/tests/baselines/reference/convertKeywordsYes.types b/tests/baselines/reference/convertKeywordsYes.types new file mode 100644 index 00000000000..839c5b5f580 --- /dev/null +++ b/tests/baselines/reference/convertKeywordsYes.types @@ -0,0 +1,936 @@ +=== tests/cases/compiler/convertKeywordsYes.ts === +// reserved ES5 future in strict mode + +var constructor = 0; +>constructor : number + +var any = 0; +>any : number + +var boolean = 0; +>boolean : number + +var implements = 0; +>implements : number + +var interface = 0; +>interface : number + +var let = 0; +>let : number + +var module = 0; +>module : number + +var number = 0; +>number : number + +var package = 0; +>package : number + +var private = 0; +>private : number + +var protected = 0; +>protected : number + +var public = 0; +>public : number + +var set = 0; +>set : number + +var static = 0; +>static : number + +var string = 0; +>string : number + +var get = 0; +>get : number + +var yield = 0; +>yield : number + +var declare = 0; +>declare : number + +function bigGeneric< +>bigGeneric : (c: constructor, a: any, b2: boolean, i: implements, i2: interface, l: let, m: module, n: number, p: package, p2: private, p3: protected, p4: public, s: set, s2: static, s3: string, g: get, y: yield, d: declare) => void + + constructor, +>constructor : constructor + + implements , +>implements : implements + + interface , +>interface : interface + + let, +>let : let + + module , +>module : module + + package, +>package : package + + private , +>private : private + + protected, +>protected : protected + + public , +>public : public + + set , +>set : set + + static , +>static : static + + get , +>get : get + + yield, +>yield : yield + + declare +>declare : declare + + >(c: constructor, +>c : constructor +>constructor : constructor + + a: any, +>a : any + + b2: boolean, +>b2 : boolean + + i: implements , +>i : implements +>implements : implements + + i2: interface , +>i2 : interface +>interface : interface + + l: let, +>l : let +>let : let + + m: module , +>m : module +>module : module + + n: number, +>n : number + + p: package, +>p : package +>package : package + + p2: private , +>p2 : private +>private : private + + p3: protected, +>p3 : protected +>protected : protected + + p4: public , +>p4 : public +>public : public + + s: set , +>s : set +>set : set + + s2: static , +>s2 : static +>static : static + + s3: string, +>s3 : string + + g: get , +>g : get +>get : get + + y: yield, +>y : yield +>yield : yield + + d: declare ) { } +>d : declare +>declare : declare + +var bigObject = { +>bigObject : { constructor: number; any: number; boolean: number; implements: number; interface: number; let: number; module: number; number: number; package: number; private: number; protected: number; public: number; set: number; static: number; string: number; get: number; yield: number; break: number; case: number; catch: number; class: number; continue: number; const: number; debugger: number; declare: number; default: number; delete: number; do: number; else: number; enum: number; export: number; extends: number; false: number; finally: number; for: number; function: number; if: number; import: number; in: number; instanceof: number; new: number; null: number; return: number; super: number; switch: number; this: number; throw: number; true: number; try: number; typeof: number; var: number; void: number; while: number; with: number; } +>{ + constructor: 0, + any: 0, + boolean: 0, + implements: 0, + interface: 0, + let: 0, + module: 0, + number: 0, + package: 0, + private: 0, + protected: 0, + public: 0, + set: 0, + static: 0, + string: 0, + get: 0, + yield: 0, + break: 0, + case: 0, + catch: 0, + class: 0, + continue: 0, + const: 0, + + debugger: 0, + declare: 0, + default: 0, + delete: 0, + do: 0, + else: 0, + enum: 0, + export: 0, + extends: 0, + false: 0, + finally: 0, + for: 0, + function: 0, + if: 0, + + import: 0, + in: 0, + instanceof: 0, + new: 0, + null: 0, + return: 0, + super: 0, + switch: 0, + this: 0, + throw: 0, + true: 0, + try: 0, + typeof: 0, + var: 0, + void: 0, + while: 0, + with: 0, +} : { constructor: number; any: number; boolean: number; implements: number; interface: number; let: number; module: number; number: number; package: number; private: number; protected: number; public: number; set: number; static: number; string: number; get: number; yield: number; break: number; case: number; catch: number; class: number; continue: number; const: number; debugger: number; declare: number; default: number; delete: number; do: number; else: number; enum: number; export: number; extends: number; false: number; finally: number; for: number; function: number; if: number; import: number; in: number; instanceof: number; new: number; null: number; return: number; super: number; switch: number; this: number; throw: number; true: number; try: number; typeof: number; var: number; void: number; while: number; with: number; } + + constructor: 0, +>constructor : number + + any: 0, +>any : number + + boolean: 0, +>boolean : number + + implements: 0, +>implements : number + + interface: 0, +>interface : number + + let: 0, +>let : number + + module: 0, +>module : number + + number: 0, +>number : number + + package: 0, +>package : number + + private: 0, +>private : number + + protected: 0, +>protected : number + + public: 0, +>public : number + + set: 0, +>set : number + + static: 0, +>static : number + + string: 0, +>string : number + + get: 0, +>get : number + + yield: 0, +>yield : number + + break: 0, +>break : number + + case: 0, +>case : number + + catch: 0, +>catch : number + + class: 0, +>class : number + + continue: 0, +>continue : number + + const: 0, +>const : number + + debugger: 0, +>debugger : number + + declare: 0, +>declare : number + + default: 0, +>default : number + + delete: 0, +>delete : number + + do: 0, +>do : number + + else: 0, +>else : number + + enum: 0, +>enum : number + + export: 0, +>export : number + + extends: 0, +>extends : number + + false: 0, +>false : number + + finally: 0, +>finally : number + + for: 0, +>for : number + + function: 0, +>function : number + + if: 0, +>if : number + + import: 0, +>import : number + + in: 0, +>in : number + + instanceof: 0, +>instanceof : number + + new: 0, +>new : number + + null: 0, +>null : number + + return: 0, +>return : number + + super: 0, +>super : number + + switch: 0, +>switch : number + + this: 0, +>this : number + + throw: 0, +>throw : number + + true: 0, +>true : number + + try: 0, +>try : number + + typeof: 0, +>typeof : number + + var: 0, +>var : number + + void: 0, +>void : number + + while: 0, +>while : number + + with: 0, +>with : number + +}; + +interface bigInterface { +>bigInterface : bigInterface + + constructor; +>constructor : any + + any; +>any : any + + boolean; +>boolean : any + + implements; +>implements : any + + interface; +>interface : any + + let; +>let : any + + module; +>module : any + + number; +>number : any + + package; +>package : any + + private; +>private : any + + protected; +>protected : any + + public; +>public : any + + set; +>set : any + + static; +>static : any + + string; +>string : any + + get; +>get : any + + yield; +>yield : any + + break; +>break : any + + case; +>case : any + + catch; +>catch : any + + class; +>class : any + + continue; +>continue : any + + const; +>const : any + + debugger; +>debugger : any + + declare; +>declare : any + + default; +>default : any + + delete; +>delete : any + + do; +>do : any + + else; +>else : any + + enum; +>enum : any + + export; +>export : any + + extends; +>extends : any + + false; +>false : any + + finally; +>finally : any + + for; +>for : any + + function; +>function : any + + if; +>if : any + + import; +>import : any + + in; +>in : any + + instanceof; +>instanceof : any + + new; +>new : any + + null; +>null : any + + return; +>return : any + + super; +>super : any + + switch; +>switch : any + + this; +>this : any + + throw; +>throw : any + + true; +>true : any + + try; +>try : any + + typeof; +>typeof : any + + var; +>var : any + + void; +>void : any + + while; +>while : any + + with; +>with : any +} + +class bigClass { +>bigClass : bigClass + + public "constructor" = 0; + public any = 0; +>any : number + + public boolean = 0; +>boolean : number + + public implements = 0; +>implements : number + + public interface = 0; +>interface : number + + public let = 0; +>let : number + + public module = 0; +>module : number + + public number = 0; +>number : number + + public package = 0; +>package : number + + public private = 0; +>private : number + + public protected = 0; +>protected : number + + public public = 0; +>public : number + + public set = 0; +>set : number + + public static = 0; +>static : number + + public string = 0; +>string : number + + public get = 0; +>get : number + + public yield = 0; +>yield : number + + public break = 0; +>break : number + + public case = 0; +>case : number + + public catch = 0; +>catch : number + + public class = 0; +>class : number + + public continue = 0; +>continue : number + + public const = 0; +>const : number + + public debugger = 0; +>debugger : number + + public declare = 0; +>declare : number + + public default = 0; +>default : number + + public delete = 0; +>delete : number + + public do = 0; +>do : number + + public else = 0; +>else : number + + public enum = 0; +>enum : number + + public export = 0; +>export : number + + public extends = 0; +>extends : number + + public false = 0; +>false : number + + public finally = 0; +>finally : number + + public for = 0; +>for : number + + public function = 0; +>function : number + + public if = 0; +>if : number + + public import = 0; +>import : number + + public in = 0; +>in : number + + public instanceof = 0; +>instanceof : number + + public new = 0; +>new : number + + public null = 0; +>null : number + + public return = 0; +>return : number + + public super = 0; +>super : number + + public switch = 0; +>switch : number + + public this = 0; +>this : number + + public throw = 0; +>throw : number + + public true = 0; +>true : number + + public try = 0; +>try : number + + public typeof = 0; +>typeof : number + + public var = 0; +>var : number + + public void = 0; +>void : number + + public while = 0; +>while : number + + public with = 0; +>with : number +} + +enum bigEnum { +>bigEnum : bigEnum + + constructor, +>constructor : bigEnum + + any, +>any : bigEnum + + boolean, +>boolean : bigEnum + + implements, +>implements : bigEnum + + interface, +>interface : bigEnum + + let, +>let : bigEnum + + module, +>module : bigEnum + + number, +>number : bigEnum + + package, +>package : bigEnum + + private, +>private : bigEnum + + protected, +>protected : bigEnum + + public, +>public : bigEnum + + set, +>set : bigEnum + + static, +>static : bigEnum + + string, +>string : bigEnum + + get, +>get : bigEnum + + yield, +>yield : bigEnum + + break, +>break : bigEnum + + case, +>case : bigEnum + + catch, +>catch : bigEnum + + class, +>class : bigEnum + + continue, +>continue : bigEnum + + const, +>const : bigEnum + + debugger, +>debugger : bigEnum + + declare, +>declare : bigEnum + + default, +>default : bigEnum + + delete, +>delete : bigEnum + + do, +>do : bigEnum + + else, +>else : bigEnum + + enum, +>enum : bigEnum + + export, +>export : bigEnum + + extends, +>extends : bigEnum + + false, +>false : bigEnum + + finally, +>finally : bigEnum + + for, +>for : bigEnum + + function, +>function : bigEnum + + if, +>if : bigEnum + + import, +>import : bigEnum + + in, +>in : bigEnum + + instanceof, +>instanceof : bigEnum + + new, +>new : bigEnum + + null, +>null : bigEnum + + return, +>return : bigEnum + + super, +>super : bigEnum + + switch, +>switch : bigEnum + + this, +>this : bigEnum + + throw, +>throw : bigEnum + + true, +>true : bigEnum + + try, +>try : bigEnum + + typeof, +>typeof : bigEnum + + var, +>var : bigEnum + + void, +>void : bigEnum + + while, +>while : bigEnum + + with, +>with : bigEnum +} + +module bigModule { +>bigModule : typeof bigModule + + class constructor { } +>constructor : constructor + + class implements { } +>implements : implements + + class interface { } +>interface : interface + + class let { } +>let : let + + class module { } +>module : module + + class package { } +>package : package + + class private { } +>private : private + + class protected { } +>protected : protected + + class public { } +>public : public + + class set { } +>set : set + + class static { } +>static : static + + class get { } +>get : get + + class yield { } +>yield : yield + + class declare { } +>declare : declare +} diff --git a/tests/baselines/reference/covariance1.types b/tests/baselines/reference/covariance1.types new file mode 100644 index 00000000000..44cdf018fee --- /dev/null +++ b/tests/baselines/reference/covariance1.types @@ -0,0 +1,47 @@ +=== tests/cases/compiler/covariance1.ts === +module M { +>M : typeof M + + interface X { m1:number; } +>X : X +>m1 : number + + export class XX implements X { constructor(public m1:number) { } } +>XX : XX +>X : X +>m1 : number + + interface Y { x:X; } +>Y : Y +>x : X +>X : X + + export function f(y:Y) { } +>f : (y: Y) => void +>y : Y +>Y : Y + + var a:X; +>a : X +>X : X + + f({x:a}); // ok +>f({x:a}) : void +>f : (y: Y) => void +>{x:a} : { x: X; } +>x : X +>a : a + + var b:XX; +>b : XX +>XX : XX + + f({x:b}); // ok covariant subtype +>f({x:b}) : void +>f : (y: Y) => void +>{x:b} : { x: XX; } +>x : XX +>b : b +} + + diff --git a/tests/baselines/reference/crashInResolveInterface.types b/tests/baselines/reference/crashInResolveInterface.types new file mode 100644 index 00000000000..0a3e8c08366 --- /dev/null +++ b/tests/baselines/reference/crashInResolveInterface.types @@ -0,0 +1,53 @@ +=== tests/cases/compiler/file2.ts === +/// +declare var c: C; +>c : C +>C : C + +interface C { +>C : C + + count(countTitle?: string): void; +>count : (countTitle?: string) => void +>countTitle : string +} +interface C { +>C : C + + log(message?: any, ...optionalParams: any[]): void; +>log : (message?: any, ...optionalParams: any[]) => void +>message : any +>optionalParams : any[] +} + +=== tests/cases/compiler/file1.ts === +interface Q { +>Q : Q +>T : T + + each(action: (item: T, index: number) => void): void; +>each : (action: (item: T, index: number) => void) => void +>action : (item: T, index: number) => void +>item : T +>T : T +>index : number +} +var q1: Q<{ a: number; }>; +>q1 : Q<{ a: number; }> +>Q : Q +>a : number + +var x = q1.each(x => c.log(x)); +>x : void +>q1.each(x => c.log(x)) : void +>q1.each : (action: (item: { a: number; }, index: number) => void) => void +>q1 : Q<{ a: number; }> +>each : (action: (item: { a: number; }, index: number) => void) => void +>x => c.log(x) : (x: { a: number; }) => void +>x : { a: number; } +>c.log(x) : void +>c.log : (message?: any, ...optionalParams: any[]) => void +>c : C +>log : (message?: any, ...optionalParams: any[]) => void +>x : { a: number; } + diff --git a/tests/baselines/reference/crashInresolveReturnStatement.types b/tests/baselines/reference/crashInresolveReturnStatement.types new file mode 100644 index 00000000000..6d31f15569b --- /dev/null +++ b/tests/baselines/reference/crashInresolveReturnStatement.types @@ -0,0 +1,42 @@ +=== tests/cases/compiler/crashInresolveReturnStatement.ts === +class WorkItemToolbar { +>WorkItemToolbar : WorkItemToolbar + + public onToolbarItemClick() { +>onToolbarItemClick : () => void + + WITDialogs.createCopyOfWorkItem(); +>WITDialogs.createCopyOfWorkItem() : void +>WITDialogs.createCopyOfWorkItem : () => void +>WITDialogs : typeof WITDialogs +>createCopyOfWorkItem : () => void + } +} +class CreateCopyOfWorkItemDialog { +>CreateCopyOfWorkItemDialog : CreateCopyOfWorkItemDialog + + public getDialogResult() { +>getDialogResult : () => any + + return null; + } +} +function createWorkItemDialog(dialogType: P0) { +>createWorkItemDialog : (dialogType: P0) => void +>P0 : P0 +>dialogType : P0 +>P0 : P0 +} +class WITDialogs { +>WITDialogs : WITDialogs + + public static createCopyOfWorkItem() { +>createCopyOfWorkItem : () => void + + createWorkItemDialog(CreateCopyOfWorkItemDialog); +>createWorkItemDialog(CreateCopyOfWorkItemDialog) : void +>createWorkItemDialog : (dialogType: P0) => void +>CreateCopyOfWorkItemDialog : typeof CreateCopyOfWorkItemDialog + } +} + diff --git a/tests/baselines/reference/cyclicModuleImport.types b/tests/baselines/reference/cyclicModuleImport.types new file mode 100644 index 00000000000..c581dd63c6d --- /dev/null +++ b/tests/baselines/reference/cyclicModuleImport.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/cyclicModuleImport.ts === +declare module "SubModule" { + import MainModule = require('MainModule'); +>MainModule : typeof MainModule + + class SubModule { +>SubModule : SubModule + + public static StaticVar: number; +>StaticVar : number + + public InstanceVar: number; +>InstanceVar : number + + public main: MainModule; +>main : MainModule +>MainModule : MainModule + + constructor(); + } + export = SubModule; +>SubModule : SubModule +} +declare module "MainModule" { + import SubModule = require('SubModule'); +>SubModule : typeof SubModule + + class MainModule { +>MainModule : MainModule + + public SubModule: SubModule; +>SubModule : SubModule +>SubModule : SubModule + + constructor(); + } + export = MainModule; +>MainModule : MainModule +} + diff --git a/tests/baselines/reference/debugger.types b/tests/baselines/reference/debugger.types new file mode 100644 index 00000000000..8d46931bf8f --- /dev/null +++ b/tests/baselines/reference/debugger.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/debugger.ts === +debugger; + +function foo() { +>foo : () => void + + debugger; + +} diff --git a/tests/baselines/reference/debuggerEmit.types b/tests/baselines/reference/debuggerEmit.types new file mode 100644 index 00000000000..dcc28e62501 --- /dev/null +++ b/tests/baselines/reference/debuggerEmit.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/debuggerEmit.ts === +var x = function () { debugger; } +>x : () => void +>function () { debugger; } : () => void + +x(); +>x() : void +>x : () => void + diff --git a/tests/baselines/reference/declFileAccessors.types b/tests/baselines/reference/declFileAccessors.types new file mode 100644 index 00000000000..2d8524a21c3 --- /dev/null +++ b/tests/baselines/reference/declFileAccessors.types @@ -0,0 +1,160 @@ +=== tests/cases/compiler/declFileAccessors_0.ts === + +/** This is comment for c1*/ +export class c1 { +>c1 : c1 + + /** getter property*/ + public get p3() { +>p3 : number + + return 10; + } + /** setter property*/ + public set p3(/** this is value*/value: number) { +>p3 : number +>value : number + } + /** private getter property*/ + private get pp3() { +>pp3 : number + + return 10; + } + /** private setter property*/ + private set pp3(/** this is value*/value: number) { +>pp3 : number +>value : number + } + /** static getter property*/ + static get s3() { +>s3 : number + + return 10; + } + /** setter property*/ + static set s3( /** this is value*/value: number) { +>s3 : number +>value : number + } + public get nc_p3() { +>nc_p3 : number + + return 10; + } + public set nc_p3(value: number) { +>nc_p3 : number +>value : number + } + private get nc_pp3() { +>nc_pp3 : number + + return 10; + } + private set nc_pp3(value: number) { +>nc_pp3 : number +>value : number + } + static get nc_s3() { +>nc_s3 : string + + return ""; + } + static set nc_s3(value: string) { +>nc_s3 : string +>value : string + } + + // Only getter property + public get onlyGetter() { +>onlyGetter : number + + return 10; + } + + // Only setter property + public set onlySetter(value: number) { +>onlySetter : number +>value : number + } +} + +=== tests/cases/compiler/declFileAccessors_1.ts === +/** This is comment for c2 - the global class*/ +class c2 { +>c2 : c2 + + /** getter property*/ + public get p3() { +>p3 : number + + return 10; + } + /** setter property*/ + public set p3(/** this is value*/value: number) { +>p3 : number +>value : number + } + /** private getter property*/ + private get pp3() { +>pp3 : number + + return 10; + } + /** private setter property*/ + private set pp3(/** this is value*/value: number) { +>pp3 : number +>value : number + } + /** static getter property*/ + static get s3() { +>s3 : number + + return 10; + } + /** setter property*/ + static set s3( /** this is value*/value: number) { +>s3 : number +>value : number + } + public get nc_p3() { +>nc_p3 : number + + return 10; + } + public set nc_p3(value: number) { +>nc_p3 : number +>value : number + } + private get nc_pp3() { +>nc_pp3 : number + + return 10; + } + private set nc_pp3(value: number) { +>nc_pp3 : number +>value : number + } + static get nc_s3() { +>nc_s3 : string + + return ""; + } + static set nc_s3(value: string) { +>nc_s3 : string +>value : string + } + + // Only getter property + public get onlyGetter() { +>onlyGetter : number + + return 10; + } + + // Only setter property + public set onlySetter(value: number) { +>onlySetter : number +>value : number + } +} diff --git a/tests/baselines/reference/declFileAmbientExternalModuleWithSingleExportedModule.types b/tests/baselines/reference/declFileAmbientExternalModuleWithSingleExportedModule.types new file mode 100644 index 00000000000..fb937443e85 --- /dev/null +++ b/tests/baselines/reference/declFileAmbientExternalModuleWithSingleExportedModule.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/declFileAmbientExternalModuleWithSingleExportedModule_1.ts === +/// +import SubModule = require('SubModule'); +>SubModule : typeof "SubModule" + +export var x: SubModule.m.m3.c; +>x : c +>SubModule : SubModule +>m : m +>m3 : m3 +>c : c + + +=== tests/cases/compiler/declFileAmbientExternalModuleWithSingleExportedModule_0.ts === + +declare module "SubModule" { + export module m { +>m : m + + export module m3 { +>m3 : m3 + + interface c { +>c : c + } + } + } +} + diff --git a/tests/baselines/reference/declFileCallSignatures.types b/tests/baselines/reference/declFileCallSignatures.types new file mode 100644 index 00000000000..0fc0757aee1 --- /dev/null +++ b/tests/baselines/reference/declFileCallSignatures.types @@ -0,0 +1,117 @@ +=== tests/cases/compiler/declFileCallSignatures_0.ts === + +export interface ICallSignature { +>ICallSignature : ICallSignature + + /** This comment should appear for foo*/ + (): string; +} + +export interface ICallSignatureWithParameters { +>ICallSignatureWithParameters : ICallSignatureWithParameters + + /** This is comment for function signature*/ + (/** this is comment about a*/a: string, +>a : string + + /** this is comment for b*/ + b: number): void; +>b : number +} + +export interface ICallSignatureWithRestParameters { +>ICallSignatureWithRestParameters : ICallSignatureWithRestParameters + + (a: string, ...rests: string[]): string; +>a : string +>rests : string[] +} + +export interface ICallSignatureWithOverloads { +>ICallSignatureWithOverloads : ICallSignatureWithOverloads + + (a: string): string; +>a : string + + (a: number): number; +>a : number +} + +export interface ICallSignatureWithTypeParameters { +>ICallSignatureWithTypeParameters : ICallSignatureWithTypeParameters +>T : T + + /** This comment should appear for foo*/ + (a: T): string; +>a : T +>T : T +} + +export interface ICallSignatureWithOwnTypeParametes { +>ICallSignatureWithOwnTypeParametes : ICallSignatureWithOwnTypeParametes + + (a: T): string; +>T : T +>ICallSignature : ICallSignature +>a : T +>T : T +} + +=== tests/cases/compiler/declFileCallSignatures_1.ts === +interface IGlobalCallSignature { +>IGlobalCallSignature : IGlobalCallSignature + + /** This comment should appear for foo*/ + (): string; +} + +interface IGlobalCallSignatureWithParameters { +>IGlobalCallSignatureWithParameters : IGlobalCallSignatureWithParameters + + /** This is comment for function signature*/ + (/** this is comment about a*/a: string, +>a : string + + /** this is comment for b*/ + b: number): void; +>b : number +} + +interface IGlobalCallSignatureWithRestParameters { +>IGlobalCallSignatureWithRestParameters : IGlobalCallSignatureWithRestParameters + + (a: string, ...rests: string[]): string; +>a : string +>rests : string[] + +} + +interface IGlobalCallSignatureWithOverloads { +>IGlobalCallSignatureWithOverloads : IGlobalCallSignatureWithOverloads + + (a: string): string; +>a : string + + (a: number): number; +>a : number +} + +interface IGlobalCallSignatureWithTypeParameters { +>IGlobalCallSignatureWithTypeParameters : IGlobalCallSignatureWithTypeParameters +>T : T + + /** This comment should appear for foo*/ + (a: T): string; +>a : T +>T : T +} + +interface IGlobalCallSignatureWithOwnTypeParametes { +>IGlobalCallSignatureWithOwnTypeParametes : IGlobalCallSignatureWithOwnTypeParametes + + (a: T): string; +>T : T +>IGlobalCallSignature : IGlobalCallSignature +>a : T +>T : T +} diff --git a/tests/baselines/reference/declFileClassWithIndexSignature.types b/tests/baselines/reference/declFileClassWithIndexSignature.types new file mode 100644 index 00000000000..16aa108c3c1 --- /dev/null +++ b/tests/baselines/reference/declFileClassWithIndexSignature.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/declFileClassWithIndexSignature.ts === + +class BlockIntrinsics { +>BlockIntrinsics : BlockIntrinsics + + [s: string]: string; +>s : string +} diff --git a/tests/baselines/reference/declFileClassWithStaticMethodReturningConstructor.types b/tests/baselines/reference/declFileClassWithStaticMethodReturningConstructor.types new file mode 100644 index 00000000000..0f1b21efc9e --- /dev/null +++ b/tests/baselines/reference/declFileClassWithStaticMethodReturningConstructor.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/declFileClassWithStaticMethodReturningConstructor.ts === + +export class Enhancement { +>Enhancement : Enhancement + + public static getType() { +>getType : () => typeof Enhancement + + return this; +>this : typeof Enhancement + } +} diff --git a/tests/baselines/reference/declFileConstructSignatures.types b/tests/baselines/reference/declFileConstructSignatures.types new file mode 100644 index 00000000000..6ee19bfdcf7 --- /dev/null +++ b/tests/baselines/reference/declFileConstructSignatures.types @@ -0,0 +1,121 @@ +=== tests/cases/compiler/declFileConstructSignatures_0.ts === + +export interface IConstructSignature { +>IConstructSignature : IConstructSignature + + /** This comment should appear for foo*/ + new (): string; +} + +export interface IConstructSignatureWithParameters { +>IConstructSignatureWithParameters : IConstructSignatureWithParameters + + /** This is comment for function signature*/ + new (/** this is comment about a*/a: string, +>a : string + + /** this is comment for b*/ + b: number); +>b : number +} + +export interface IConstructSignatureWithRestParameters { +>IConstructSignatureWithRestParameters : IConstructSignatureWithRestParameters + + new (a: string, ...rests: string[]): string; +>a : string +>rests : string[] +} + +export interface IConstructSignatureWithOverloads { +>IConstructSignatureWithOverloads : IConstructSignatureWithOverloads + + new (a: string): string; +>a : string + + new (a: number): number; +>a : number +} + +export interface IConstructSignatureWithTypeParameters { +>IConstructSignatureWithTypeParameters : IConstructSignatureWithTypeParameters +>T : T + + /** This comment should appear for foo*/ + new (a: T): T; +>a : T +>T : T +>T : T +} + +export interface IConstructSignatureWithOwnTypeParametes { +>IConstructSignatureWithOwnTypeParametes : IConstructSignatureWithOwnTypeParametes + + new (a: T): T; +>T : T +>IConstructSignature : IConstructSignature +>a : T +>T : T +>T : T +} + +=== tests/cases/compiler/declFileConstructSignatures_1.ts === +interface IGlobalConstructSignature { +>IGlobalConstructSignature : IGlobalConstructSignature + + /** This comment should appear for foo*/ + new (): string; +} + +interface IGlobalConstructSignatureWithParameters { +>IGlobalConstructSignatureWithParameters : IGlobalConstructSignatureWithParameters + + /** This is comment for function signature*/ + new (/** this is comment about a*/a: string, +>a : string + + /** this is comment for b*/ + b: number); +>b : number +} + +interface IGlobalConstructSignatureWithRestParameters { +>IGlobalConstructSignatureWithRestParameters : IGlobalConstructSignatureWithRestParameters + + new (a: string, ...rests: string[]): string; +>a : string +>rests : string[] + +} + +interface IGlobalConstructSignatureWithOverloads { +>IGlobalConstructSignatureWithOverloads : IGlobalConstructSignatureWithOverloads + + new (a: string): string; +>a : string + + new (a: number): number; +>a : number +} + +interface IGlobalConstructSignatureWithTypeParameters { +>IGlobalConstructSignatureWithTypeParameters : IGlobalConstructSignatureWithTypeParameters +>T : T + + /** This comment should appear for foo*/ + new (a: T): T; +>a : T +>T : T +>T : T +} + +interface IGlobalConstructSignatureWithOwnTypeParametes { +>IGlobalConstructSignatureWithOwnTypeParametes : IGlobalConstructSignatureWithOwnTypeParametes + + new (a: T): T; +>T : T +>IGlobalConstructSignature : IGlobalConstructSignature +>a : T +>T : T +>T : T +} diff --git a/tests/baselines/reference/declFileConstructors.types b/tests/baselines/reference/declFileConstructors.types new file mode 100644 index 00000000000..723830bdeea --- /dev/null +++ b/tests/baselines/reference/declFileConstructors.types @@ -0,0 +1,176 @@ +=== tests/cases/compiler/declFileConstructors_0.ts === + +export class SimpleConstructor { +>SimpleConstructor : SimpleConstructor + + /** This comment should appear for foo*/ + constructor() { + } +} +export class ConstructorWithParameters { +>ConstructorWithParameters : ConstructorWithParameters + + /** This is comment for function signature*/ + constructor(/** this is comment about a*/a: string, +>a : string + + /** this is comment for b*/ + b: number) { +>b : number + + var d = a; +>d : string +>a : string + } +} + +export class ConstructorWithRestParamters { +>ConstructorWithRestParamters : ConstructorWithRestParamters + + constructor(a: string, ...rests: string[]) { +>a : string +>rests : string[] + + return a + rests.join(""); +>a + rests.join("") : string +>a : string +>rests.join("") : string +>rests.join : (separator?: string) => string +>rests : string[] +>join : (separator?: string) => string + } +} + +export class ConstructorWithOverloads { +>ConstructorWithOverloads : ConstructorWithOverloads + + constructor(a: string); +>a : string + + constructor(a: number); +>a : number + + constructor(a: any) { +>a : any + } +} + +export class ConstructorWithPublicParameterProperty { +>ConstructorWithPublicParameterProperty : ConstructorWithPublicParameterProperty + + constructor(public x: string) { +>x : string + } +} + +export class ConstructorWithPrivateParameterProperty { +>ConstructorWithPrivateParameterProperty : ConstructorWithPrivateParameterProperty + + constructor(private x: string) { +>x : string + } +} + +export class ConstructorWithOptionalParameterProperty { +>ConstructorWithOptionalParameterProperty : ConstructorWithOptionalParameterProperty + + constructor(public x?: string) { +>x : string + } +} + +export class ConstructorWithParameterInitializer { +>ConstructorWithParameterInitializer : ConstructorWithParameterInitializer + + constructor(public x = "hello") { +>x : string + } +} + +=== tests/cases/compiler/declFileConstructors_1.ts === +class GlobalSimpleConstructor { +>GlobalSimpleConstructor : GlobalSimpleConstructor + + /** This comment should appear for foo*/ + constructor() { + } +} +class GlobalConstructorWithParameters { +>GlobalConstructorWithParameters : GlobalConstructorWithParameters + + /** This is comment for function signature*/ + constructor(/** this is comment about a*/a: string, +>a : string + + /** this is comment for b*/ + b: number) { +>b : number + + var d = a; +>d : string +>a : string + } +} + +class GlobalConstructorWithRestParamters { +>GlobalConstructorWithRestParamters : GlobalConstructorWithRestParamters + + constructor(a: string, ...rests: string[]) { +>a : string +>rests : string[] + + return a + rests.join(""); +>a + rests.join("") : string +>a : string +>rests.join("") : string +>rests.join : (separator?: string) => string +>rests : string[] +>join : (separator?: string) => string + } +} + +class GlobalConstructorWithOverloads { +>GlobalConstructorWithOverloads : GlobalConstructorWithOverloads + + constructor(a: string); +>a : string + + constructor(a: number); +>a : number + + constructor(a: any) { +>a : any + } +} + +class GlobalConstructorWithPublicParameterProperty { +>GlobalConstructorWithPublicParameterProperty : GlobalConstructorWithPublicParameterProperty + + constructor(public x: string) { +>x : string + } +} + +class GlobalConstructorWithPrivateParameterProperty { +>GlobalConstructorWithPrivateParameterProperty : GlobalConstructorWithPrivateParameterProperty + + constructor(private x: string) { +>x : string + } +} + +class GlobalConstructorWithOptionalParameterProperty { +>GlobalConstructorWithOptionalParameterProperty : GlobalConstructorWithOptionalParameterProperty + + constructor(public x?: string) { +>x : string + } +} + +class GlobalConstructorWithParameterInitializer { +>GlobalConstructorWithParameterInitializer : GlobalConstructorWithParameterInitializer + + constructor(public x = "hello") { +>x : string + } +} diff --git a/tests/baselines/reference/declFileEnumUsedAsValue.types b/tests/baselines/reference/declFileEnumUsedAsValue.types new file mode 100644 index 00000000000..19aa3de4331 --- /dev/null +++ b/tests/baselines/reference/declFileEnumUsedAsValue.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/declFileEnumUsedAsValue.ts === + +enum e { +>e : e + + a, +>a : e + + b, +>b : e + + c +>c : e +} +var x = e; +>x : typeof e +>e : typeof e + diff --git a/tests/baselines/reference/declFileEnums.types b/tests/baselines/reference/declFileEnums.types new file mode 100644 index 00000000000..d4d7230e930 --- /dev/null +++ b/tests/baselines/reference/declFileEnums.types @@ -0,0 +1,78 @@ +=== tests/cases/compiler/declFileEnums.ts === + +enum e1 { +>e1 : e1 + + a, +>a : e1 + + b, +>b : e1 + + c +>c : e1 +} + +enum e2 { +>e2 : e2 + + a = 10, +>a : e2 + + b = a + 2, +>b : e2 +>a + 2 : number +>a : e2 + + c = 10, +>c : e2 +} + +enum e3 { +>e3 : e3 + + a = 10, +>a : e3 + + b = Math.PI, +>b : e3 +>Math.PI : number +>Math : Math +>PI : number + + c = a + 3 +>c : e3 +>a + 3 : number +>a : e3 +} + +enum e4 { +>e4 : e4 + + a, +>a : e4 + + b, +>b : e4 + + c, +>c : e4 + + d = 10, +>d : e4 + + e +>e : e4 +} + +enum e5 { +>e5 : e5 + + "Friday", + "Saturday", + "Sunday", + "Weekend days" +} + + + diff --git a/tests/baselines/reference/declFileExportAssignmentImportInternalModule.types b/tests/baselines/reference/declFileExportAssignmentImportInternalModule.types new file mode 100644 index 00000000000..7a690b83de1 --- /dev/null +++ b/tests/baselines/reference/declFileExportAssignmentImportInternalModule.types @@ -0,0 +1,58 @@ +=== tests/cases/compiler/declFileExportAssignmentImportInternalModule.ts === +module m3 { +>m3 : typeof m3 + + export module m2 { +>m2 : m2 + + export interface connectModule { +>connectModule : connectModule + + (res, req, next): void; +>res : any +>req : any +>next : any + } + export interface connectExport { +>connectExport : connectExport + + use: (mod: connectModule) => connectExport; +>use : (mod: connectModule) => connectExport +>mod : connectModule +>connectModule : connectModule +>connectExport : connectExport + + listen: (port: number) => void; +>listen : (port: number) => void +>port : number + } + + } + + export var server: { +>server : { (): connectExport; test1: connectModule; test2(): connectModule; } + + (): m2.connectExport; +>m2 : m2 +>connectExport : connectExport + + test1: m2.connectModule; +>test1 : connectModule +>m2 : m2 +>connectModule : connectModule + + test2(): m2.connectModule; +>test2 : () => connectModule +>m2 : m2 +>connectModule : connectModule + + }; +} + +import m = m3 +>m : typeof m3 +>m3 : typeof m3 + +export = m; +>m : typeof m3 + diff --git a/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.types b/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.types new file mode 100644 index 00000000000..ebb7af61573 --- /dev/null +++ b/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/declFileExportAssignmentOfGenericInterface_1.ts === +import a = require('declFileExportAssignmentOfGenericInterface_0'); +>a : a + +export var x: a>; +>x : Foo> +>a : a +>a : a + +x.a; +>x.a : string +>x : Foo> +>a : string + +=== tests/cases/compiler/declFileExportAssignmentOfGenericInterface_0.ts === + +interface Foo { +>Foo : Foo +>T : T + + a: string; +>a : string +} +export = Foo; +>Foo : Foo + diff --git a/tests/baselines/reference/declFileExportImportChain.types b/tests/baselines/reference/declFileExportImportChain.types new file mode 100644 index 00000000000..8e72c07fb9f --- /dev/null +++ b/tests/baselines/reference/declFileExportImportChain.types @@ -0,0 +1,43 @@ +=== tests/cases/compiler/declFileExportImportChain_d.ts === +import c = require("declFileExportImportChain_c"); +>c : typeof "tests/cases/compiler/declFileExportImportChain_c" + +export var x: c.b1.a.m2.c1; +>x : c1 +>c : c +>b1 : b1 +>a : a +>m2 : m2 +>c1 : c1 + +=== tests/cases/compiler/declFileExportImportChain_a.ts === + +module m1 { +>m1 : typeof m1 + + export module m2 { +>m2 : typeof m2 + + export class c1 { +>c1 : c1 + } + } +} +export = m1; +>m1 : typeof m1 + +=== tests/cases/compiler/declFileExportImportChain_b.ts === +export import a = require("declFileExportImportChain_a"); +>a : typeof m1 + +=== tests/cases/compiler/declFileExportImportChain_b1.ts === +import b = require("declFileExportImportChain_b"); +>b : typeof "tests/cases/compiler/declFileExportImportChain_b" + +export = b; +>b : typeof "tests/cases/compiler/declFileExportImportChain_b" + +=== tests/cases/compiler/declFileExportImportChain_c.ts === +export import b1 = require("declFileExportImportChain_b1"); +>b1 : typeof "tests/cases/compiler/declFileExportImportChain_b" + diff --git a/tests/baselines/reference/declFileExportImportChain2.types b/tests/baselines/reference/declFileExportImportChain2.types new file mode 100644 index 00000000000..3c0c3f89837 --- /dev/null +++ b/tests/baselines/reference/declFileExportImportChain2.types @@ -0,0 +1,38 @@ +=== tests/cases/compiler/declFileExportImportChain2_d.ts === +import c = require("declFileExportImportChain2_c"); +>c : typeof "tests/cases/compiler/declFileExportImportChain2_c" + +export var x: c.b.m2.c1; +>x : c1 +>c : c +>b : b +>m2 : m2 +>c1 : c1 + +=== tests/cases/compiler/declFileExportImportChain2_a.ts === + +module m1 { +>m1 : typeof m1 + + export module m2 { +>m2 : typeof m2 + + export class c1 { +>c1 : c1 + } + } +} +export = m1; +>m1 : typeof m1 + +=== tests/cases/compiler/declFileExportImportChain2_b.ts === +import a = require("declFileExportImportChain2_a"); +>a : typeof m1 + +export = a; +>a : typeof m1 + +=== tests/cases/compiler/declFileExportImportChain2_c.ts === +export import b = require("declFileExportImportChain2_b"); +>b : typeof m1 + diff --git a/tests/baselines/reference/declFileForClassWithMultipleBaseClasses.types b/tests/baselines/reference/declFileForClassWithMultipleBaseClasses.types new file mode 100644 index 00000000000..0f7861d8b8e --- /dev/null +++ b/tests/baselines/reference/declFileForClassWithMultipleBaseClasses.types @@ -0,0 +1,54 @@ +=== tests/cases/compiler/declFileForClassWithMultipleBaseClasses.ts === + +class A { +>A : A + + foo() { } +>foo : () => void +} + +class B { +>B : B + + bar() { } +>bar : () => void +} + +interface I { +>I : I + + baz(); +>baz : () => any +} + +interface J { +>J : J + + bat(); +>bat : () => any +} + + +class D implements I, J { +>D : D +>I : I +>J : J + + baz() { } +>baz : () => void + + bat() { } +>bat : () => void + + foo() { } +>foo : () => void + + bar() { } +>bar : () => void +} + +interface I extends A, B { +>I : I +>A : A +>B : B +} diff --git a/tests/baselines/reference/declFileForClassWithPrivateOverloadedFunction.types b/tests/baselines/reference/declFileForClassWithPrivateOverloadedFunction.types new file mode 100644 index 00000000000..efdfde4574c --- /dev/null +++ b/tests/baselines/reference/declFileForClassWithPrivateOverloadedFunction.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/declFileForClassWithPrivateOverloadedFunction.ts === + +class C { +>C : C + + private foo(x: number); +>foo : { (x: number): any; (x: string): any; } +>x : number + + private foo(x: string); +>foo : { (x: number): any; (x: string): any; } +>x : string + + private foo(x: any) { } +>foo : { (x: number): any; (x: string): any; } +>x : any +} diff --git a/tests/baselines/reference/declFileForExportedImport.types b/tests/baselines/reference/declFileForExportedImport.types new file mode 100644 index 00000000000..95224208188 --- /dev/null +++ b/tests/baselines/reference/declFileForExportedImport.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/declFileForExportedImport_1.ts === +/// +export import a = require('declFileForExportedImport_0'); +>a : typeof "tests/cases/compiler/declFileForExportedImport_0" + +var y = a.x; +>y : number +>a.x : number +>a : typeof "tests/cases/compiler/declFileForExportedImport_0" +>x : number + +export import b = a; +>b : typeof "tests/cases/compiler/declFileForExportedImport_0" +>a : typeof "tests/cases/compiler/declFileForExportedImport_0" + +var z = b.x; +>z : number +>b.x : number +>b : typeof "tests/cases/compiler/declFileForExportedImport_0" +>x : number + +=== tests/cases/compiler/declFileForExportedImport_0.ts === +export var x: number; +>x : number + diff --git a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.types b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.types new file mode 100644 index 00000000000..63a88b23ede --- /dev/null +++ b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/declFileForFunctionTypeAsTypeParameter.ts === + +class X { +>X : X +>T : T +} +class C extends X<() => number> { +>C : C +>X : X +} +interface I extends X<() => number> { +>I : I +>X : X +} + + diff --git a/tests/baselines/reference/declFileForInterfaceWithOptionalFunction.types b/tests/baselines/reference/declFileForInterfaceWithOptionalFunction.types new file mode 100644 index 00000000000..fab33c939cf --- /dev/null +++ b/tests/baselines/reference/declFileForInterfaceWithOptionalFunction.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/declFileForInterfaceWithOptionalFunction.ts === + +interface I { +>I : I + + foo? (x?); +>foo : (x?: any) => any +>x : any + + foo2? (x?: number): number; +>foo2 : (x?: number) => number +>x : number +} diff --git a/tests/baselines/reference/declFileForInterfaceWithRestParams.types b/tests/baselines/reference/declFileForInterfaceWithRestParams.types new file mode 100644 index 00000000000..817e118fb6c --- /dev/null +++ b/tests/baselines/reference/declFileForInterfaceWithRestParams.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/declFileForInterfaceWithRestParams.ts === + +interface I { +>I : I + + foo(...x): typeof x; +>foo : (...x: any[]) => any[] +>x : any[] +>x : any[] + + foo2(a: number, ...x): typeof x; +>foo2 : (a: number, ...x: any[]) => any[] +>a : number +>x : any[] +>x : any[] + + foo3(b: string, ...x: string[]): typeof x; +>foo3 : (b: string, ...x: string[]) => string[] +>b : string +>x : string[] +>x : string[] +} diff --git a/tests/baselines/reference/declFileForTypeParameters.types b/tests/baselines/reference/declFileForTypeParameters.types new file mode 100644 index 00000000000..6308a0c92ba --- /dev/null +++ b/tests/baselines/reference/declFileForTypeParameters.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/declFileForTypeParameters.ts === + +class C { +>C : C +>T : T + + x: T; +>x : T +>T : T + + foo(a: T): T { +>foo : (a: T) => T +>a : T +>T : T +>T : T + + return this.x; +>this.x : T +>this : C +>x : T + } +} diff --git a/tests/baselines/reference/declFileForVarList.types b/tests/baselines/reference/declFileForVarList.types new file mode 100644 index 00000000000..6e148efa1c2 --- /dev/null +++ b/tests/baselines/reference/declFileForVarList.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/declFileForVarList.ts === + +var x, y, z = 1; +>x : any +>y : any +>z : number + +var x1 = 1, y2 = 2, z2 = 3; +>x1 : number +>y2 : number +>z2 : number + diff --git a/tests/baselines/reference/declFileFunctions.types b/tests/baselines/reference/declFileFunctions.types new file mode 100644 index 00000000000..46281813eb0 --- /dev/null +++ b/tests/baselines/reference/declFileFunctions.types @@ -0,0 +1,142 @@ +=== tests/cases/compiler/declFileFunctions_0.ts === + +/** This comment should appear for foo*/ +export function foo() { +>foo : () => void +} +/** This is comment for function signature*/ +export function fooWithParameters(/** this is comment about a*/a: string, +>fooWithParameters : (a: string, b: number) => void +>a : string + + /** this is comment for b*/ + b: number) { +>b : number + + var d = a; +>d : string +>a : string +} +export function fooWithRestParameters(a: string, ...rests: string[]) { +>fooWithRestParameters : (a: string, ...rests: string[]) => string +>a : string +>rests : string[] + + return a + rests.join(""); +>a + rests.join("") : string +>a : string +>rests.join("") : string +>rests.join : (separator?: string) => string +>rests : string[] +>join : (separator?: string) => string +} + +export function fooWithOverloads(a: string): string; +>fooWithOverloads : { (a: string): string; (a: number): number; } +>a : string + +export function fooWithOverloads(a: number): number; +>fooWithOverloads : { (a: string): string; (a: number): number; } +>a : number + +export function fooWithOverloads(a: any): any { +>fooWithOverloads : { (a: string): string; (a: number): number; } +>a : any + + return a; +>a : any +} + +/** This comment should appear for nonExportedFoo*/ +function nonExportedFoo() { +>nonExportedFoo : () => void +} +/** This is comment for function signature*/ +function nonExportedFooWithParameters(/** this is comment about a*/a: string, +>nonExportedFooWithParameters : (a: string, b: number) => void +>a : string + + /** this is comment for b*/ + b: number) { +>b : number + + var d = a; +>d : string +>a : string +} +function nonExportedFooWithRestParameters(a: string, ...rests: string[]) { +>nonExportedFooWithRestParameters : (a: string, ...rests: string[]) => string +>a : string +>rests : string[] + + return a + rests.join(""); +>a + rests.join("") : string +>a : string +>rests.join("") : string +>rests.join : (separator?: string) => string +>rests : string[] +>join : (separator?: string) => string +} + +function nonExportedFooWithOverloads(a: string): string; +>nonExportedFooWithOverloads : { (a: string): string; (a: number): number; } +>a : string + +function nonExportedFooWithOverloads(a: number): number; +>nonExportedFooWithOverloads : { (a: string): string; (a: number): number; } +>a : number + +function nonExportedFooWithOverloads(a: any): any { +>nonExportedFooWithOverloads : { (a: string): string; (a: number): number; } +>a : any + + return a; +>a : any +} + +=== tests/cases/compiler/declFileFunctions_1.ts === +/** This comment should appear for foo*/ +function globalfoo() { +>globalfoo : () => void +} +/** This is comment for function signature*/ +function globalfooWithParameters(/** this is comment about a*/a: string, +>globalfooWithParameters : (a: string, b: number) => void +>a : string + + /** this is comment for b*/ + b: number) { +>b : number + + var d = a; +>d : string +>a : string +} +function globalfooWithRestParameters(a: string, ...rests: string[]) { +>globalfooWithRestParameters : (a: string, ...rests: string[]) => string +>a : string +>rests : string[] + + return a + rests.join(""); +>a + rests.join("") : string +>a : string +>rests.join("") : string +>rests.join : (separator?: string) => string +>rests : string[] +>join : (separator?: string) => string +} +function globalfooWithOverloads(a: string): string; +>globalfooWithOverloads : { (a: string): string; (a: number): number; } +>a : string + +function globalfooWithOverloads(a: number): number; +>globalfooWithOverloads : { (a: string): string; (a: number): number; } +>a : number + +function globalfooWithOverloads(a: any): any { +>globalfooWithOverloads : { (a: string): string; (a: number): number; } +>a : any + + return a; +>a : any +} diff --git a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.types b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.types new file mode 100644 index 00000000000..9b0ee715472 --- /dev/null +++ b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.types @@ -0,0 +1,38 @@ +=== tests/cases/compiler/declFileGenericClassWithGenericExtendedClass.ts === +interface IFoo { +>IFoo : IFoo + + baz: Baz; +>baz : Baz +>Baz : Baz +} +class Base { } +>Base : Base +>T : T + +class Derived extends Base { } +>Derived : Derived +>T : T +>Base : Base +>T : T + +interface IBar { +>IBar : IBar +>T : T + + derived: Derived; +>derived : Derived +>Derived : Derived +>T : T +} +class Baz implements IBar { +>Baz : Baz +>IBar : IBar +>Baz : Baz + + derived: Derived; +>derived : Derived +>Derived : Derived +>Baz : Baz +} + diff --git a/tests/baselines/reference/declFileGenericType.types b/tests/baselines/reference/declFileGenericType.types new file mode 100644 index 00000000000..646e0d89e1a --- /dev/null +++ b/tests/baselines/reference/declFileGenericType.types @@ -0,0 +1,167 @@ +=== tests/cases/compiler/declFileGenericType.ts === +export module C { +>C : typeof C + + export class A{ } +>A : A +>T : T + + export class B { } +>B : B + + export function F(x: T): A { return null; } +>F : (x: T) => A +>T : T +>x : T +>T : T +>A : A +>B : B + + export function F2(x: T): C.A { return null; } +>F2 : (x: T) => A +>T : T +>x : T +>T : T +>C : C +>A : A +>C : C +>B : B + + export function F3(x: T): C.A[] { return null; } +>F3 : (x: T) => A[] +>T : T +>x : T +>T : T +>C : C +>A : A +>C : C +>B : B + + export function F4>(x: T): Array> { return null; } +>F4 : >(x: T) => A[] +>T : T +>A : A +>B : B +>x : T +>T : T +>Array : Array +>C : C +>A : A +>C : C +>B : B + + export function F5(): T { return null; } +>F5 : () => T +>T : T +>T : T + + export function F6>(x: T): T { return null; } +>F6 : >(x: T) => T +>T : T +>A : A +>B : B +>x : T +>T : T +>T : T + + export class D{ +>D : D +>T : T + + constructor(public val: T) { } +>val : T +>T : T + + } +} + +export var a: C.A; +>a : A +>C : C +>A : A +>C : C +>B : B + +export var b = C.F; +>b : (x: T) => A +>C.F : (x: T) => A +>C : typeof C +>F : (x: T) => A + +export var c = C.F2; +>c : (x: T) => A +>C.F2 : (x: T) => A +>C : typeof C +>F2 : (x: T) => A + +export var d = C.F3; +>d : (x: T) => A[] +>C.F3 : (x: T) => A[] +>C : typeof C +>F3 : (x: T) => A[] + +export var e = C.F4; +>e : >(x: T) => A[] +>C.F4 : >(x: T) => A[] +>C : typeof C +>F4 : >(x: T) => A[] + +export var x = (new C.D>(new C.A())).val; +>x : A +>(new C.D>(new C.A())).val : A +>(new C.D>(new C.A())) : D> +>new C.D>(new C.A()) : D> +>C.D : typeof D +>C : typeof C +>D : typeof D +>C : C +>A : A +>C : C +>B : B +>new C.A() : A +>C.A : typeof A +>C : typeof C +>A : typeof A +>C : C +>B : B +>val : A + +export function f>() { } +>f : >() => void +>T : T +>C : C +>A : A +>C : C +>B : B + +export var g = C.F5>(); +>g : A +>C.F5>() : A +>C.F5 : () => T +>C : typeof C +>F5 : () => T +>C : C +>A : A +>C : C +>B : B + +export class h extends C.A{ } +>h : h +>C : C +>A : A +>C : C +>B : B + +export interface i extends C.A { } +>i : i +>C : C +>A : A +>C : C +>B : B + +export var j = C.F6; +>j : >(x: T) => T +>C.F6 : >(x: T) => T +>C : typeof C +>F6 : >(x: T) => T + diff --git a/tests/baselines/reference/declFileGenericType2.types b/tests/baselines/reference/declFileGenericType2.types new file mode 100644 index 00000000000..e6037eaac15 --- /dev/null +++ b/tests/baselines/reference/declFileGenericType2.types @@ -0,0 +1,140 @@ +=== tests/cases/compiler/declFileGenericType2.ts === + +declare module templa.mvc { +>templa : typeof templa +>mvc : typeof mvc + + interface IModel { +>IModel : IModel + } +} +declare module templa.mvc { +>templa : typeof templa +>mvc : typeof mvc + + interface IController { +>IController : IController +>ModelType : ModelType +>templa : templa +>mvc : mvc +>IModel : IModel + } +} +declare module templa.mvc { +>templa : typeof templa +>mvc : typeof mvc + + class AbstractController implements mvc.IController { +>AbstractController : AbstractController +>ModelType : ModelType +>templa : templa +>mvc : mvc +>IModel : IModel +>mvc : mvc +>IController : IController +>ModelType : ModelType + } +} +declare module templa.mvc.composite { +>templa : typeof templa +>mvc : typeof mvc +>composite : composite + + interface ICompositeControllerModel extends mvc.IModel { +>ICompositeControllerModel : ICompositeControllerModel +>mvc : mvc +>IModel : IModel + + getControllers(): mvc.IController[]; +>getControllers : () => IController[] +>mvc : mvc +>IController : IController +>mvc : mvc +>IModel : IModel + } +} +module templa.dom.mvc { +>templa : typeof templa +>dom : typeof dom +>mvc : typeof mvc + + export interface IElementController extends templa.mvc.IController { +>IElementController : IElementController +>ModelType : ModelType +>templa : templa +>mvc : mvc +>IModel : IModel +>templa : templa +>mvc : mvc +>IController : IController +>ModelType : ModelType + } +} +// Module +module templa.dom.mvc { +>templa : typeof templa +>dom : typeof dom +>mvc : typeof mvc + + export class AbstractElementController extends templa.mvc.AbstractController implements IElementController { +>AbstractElementController : AbstractElementController +>ModelType : ModelType +>templa : templa +>mvc : mvc +>IModel : IModel +>templa : templa +>mvc : mvc +>AbstractController : AbstractController +>ModelType : ModelType +>IElementController : IElementController +>ModelType : ModelType + + constructor() { + super(); +>super() : void + } + } +} +// Module +module templa.dom.mvc.composite { +>templa : typeof templa +>dom : typeof dom +>mvc : typeof mvc +>composite : typeof composite + + export class AbstractCompositeElementController extends templa.dom.mvc.AbstractElementController { +>AbstractCompositeElementController : AbstractCompositeElementController +>ModelType : ModelType +>templa : templa +>mvc : mvc +>composite : composite +>ICompositeControllerModel : ICompositeControllerModel +>templa : templa +>dom : dom +>mvc : mvc +>AbstractElementController : AbstractElementController +>ModelType : ModelType + + public _controllers: templa.mvc.IController[]; +>_controllers : IController[] +>templa : templa +>mvc : mvc +>IController : IController +>templa : templa +>mvc : mvc +>IModel : IModel + + constructor() { + super(); +>super() : void + + this._controllers = []; +>this._controllers = [] : IController[] +>this._controllers : IController[] +>this : AbstractCompositeElementController +>_controllers : IController[] +>[] : IController[] + } + } +} + diff --git a/tests/baselines/reference/declFileImportModuleWithExportAssignment.types b/tests/baselines/reference/declFileImportModuleWithExportAssignment.types new file mode 100644 index 00000000000..328760ed096 --- /dev/null +++ b/tests/baselines/reference/declFileImportModuleWithExportAssignment.types @@ -0,0 +1,64 @@ +=== tests/cases/compiler/declFileImportModuleWithExportAssignment_1.ts === +/**This is on import declaration*/ +import a1 = require("declFileImportModuleWithExportAssignment_0"); +>a1 : { (): connectExport; test1: connectModule; test2(): connectModule; } + +export var a = a1; +>a : { (): connectExport; test1: connectModule; test2(): connectModule; } +>a1 : { (): connectExport; test1: connectModule; test2(): connectModule; } + +a.test1(null, null, null); +>a.test1(null, null, null) : void +>a.test1 : connectModule +>a : { (): connectExport; test1: connectModule; test2(): connectModule; } +>test1 : connectModule + +=== tests/cases/compiler/declFileImportModuleWithExportAssignment_0.ts === + +module m2 { +>m2 : { (): connectExport; test1: connectModule; test2(): connectModule; } + + export interface connectModule { +>connectModule : connectModule + + (res, req, next): void; +>res : any +>req : any +>next : any + } + export interface connectExport { +>connectExport : connectExport + + use: (mod: connectModule) => connectExport; +>use : (mod: connectModule) => connectExport +>mod : connectModule +>connectModule : connectModule +>connectExport : connectExport + + listen: (port: number) => void; +>listen : (port: number) => void +>port : number + } + +} +var m2: { +>m2 : { (): connectExport; test1: connectModule; test2(): connectModule; } + + (): m2.connectExport; +>m2 : m2 +>connectExport : connectExport + + test1: m2.connectModule; +>test1 : connectModule +>m2 : m2 +>connectModule : connectModule + + test2(): m2.connectModule; +>test2 : () => connectModule +>m2 : m2 +>connectModule : connectModule + +}; +export = m2; +>m2 : { (): connectExport; test1: connectModule; test2(): connectModule; } + diff --git a/tests/baselines/reference/declFileImportedTypeUseInTypeArgPosition.types b/tests/baselines/reference/declFileImportedTypeUseInTypeArgPosition.types new file mode 100644 index 00000000000..eb9da5c2094 --- /dev/null +++ b/tests/baselines/reference/declFileImportedTypeUseInTypeArgPosition.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/declFileImportedTypeUseInTypeArgPosition.ts === +class List { } +>List : List +>T : T + +declare module 'mod1' { + class Foo { +>Foo : Foo + } +} + +declare module 'moo' { + import x = require('mod1'); +>x : typeof 'mod1' + + export var p: List; +>p : List +>List : List +>x : x +>Foo : Foo +} + + + diff --git a/tests/baselines/reference/declFileIndexSignatures.types b/tests/baselines/reference/declFileIndexSignatures.types new file mode 100644 index 00000000000..c971fb4aeb0 --- /dev/null +++ b/tests/baselines/reference/declFileIndexSignatures.types @@ -0,0 +1,66 @@ +=== tests/cases/compiler/declFileIndexSignatures_0.ts === + +export interface IStringIndexSignature { +>IStringIndexSignature : IStringIndexSignature + + [s: string]: string; +>s : string +} +export interface INumberIndexSignature { +>INumberIndexSignature : INumberIndexSignature + + [n: number]: number; +>n : number +} + +export interface IBothIndexSignature { +>IBothIndexSignature : IBothIndexSignature + + [s: string]: any; +>s : string + + [n: number]: number; +>n : number +} + +export interface IIndexSignatureWithTypeParameter { +>IIndexSignatureWithTypeParameter : IIndexSignatureWithTypeParameter +>T : T + + [a: string]: T; +>a : string +>T : T +} + +=== tests/cases/compiler/declFileIndexSignatures_1.ts === +interface IGlobalStringIndexSignature { +>IGlobalStringIndexSignature : IGlobalStringIndexSignature + + [s: string]: string; +>s : string +} +interface IGlobalNumberIndexSignature { +>IGlobalNumberIndexSignature : IGlobalNumberIndexSignature + + [n: number]: number; +>n : number +} + +interface IGlobalBothIndexSignature { +>IGlobalBothIndexSignature : IGlobalBothIndexSignature + + [s: string]: any; +>s : string + + [n: number]: number; +>n : number +} + +interface IGlobalIndexSignatureWithTypeParameter { +>IGlobalIndexSignatureWithTypeParameter : IGlobalIndexSignatureWithTypeParameter +>T : T + + [a: string]: T; +>a : string +>T : T +} diff --git a/tests/baselines/reference/declFileInternalAliases.types b/tests/baselines/reference/declFileInternalAliases.types new file mode 100644 index 00000000000..2c50d084b9e --- /dev/null +++ b/tests/baselines/reference/declFileInternalAliases.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/declFileInternalAliases.ts === +module m { +>m : typeof m + + export class c { +>c : c + } +} +module m1 { +>m1 : typeof m1 + + import x = m.c; +>x : typeof c +>m : c +>c : c + + export var d = new x(); // emit the type as m.c +>d : c +>new x() : c +>x : typeof c +} +module m2 { +>m2 : typeof m2 + + export import x = m.c; +>x : typeof c +>m : c +>c : c + + export var d = new x(); // emit the type as x +>d : c +>new x() : c +>x : typeof c +} diff --git a/tests/baselines/reference/declFileMethods.types b/tests/baselines/reference/declFileMethods.types new file mode 100644 index 00000000000..6432540f5a4 --- /dev/null +++ b/tests/baselines/reference/declFileMethods.types @@ -0,0 +1,447 @@ +=== tests/cases/compiler/declFileMethods_0.ts === + +export class c1 { +>c1 : c1 + + /** This comment should appear for foo*/ + public foo() { +>foo : () => void + } + /** This is comment for function signature*/ + public fooWithParameters(/** this is comment about a*/a: string, +>fooWithParameters : (a: string, b: number) => void +>a : string + + /** this is comment for b*/ + b: number) { +>b : number + + var d = a; +>d : string +>a : string + } + public fooWithRestParameters(a: string, ...rests: string[]) { +>fooWithRestParameters : (a: string, ...rests: string[]) => string +>a : string +>rests : string[] + + return a + rests.join(""); +>a + rests.join("") : string +>a : string +>rests.join("") : string +>rests.join : (separator?: string) => string +>rests : string[] +>join : (separator?: string) => string + } + + public fooWithOverloads(a: string): string; +>fooWithOverloads : { (a: string): string; (a: number): number; } +>a : string + + public fooWithOverloads(a: number): number; +>fooWithOverloads : { (a: string): string; (a: number): number; } +>a : number + + public fooWithOverloads(a: any): any { +>fooWithOverloads : { (a: string): string; (a: number): number; } +>a : any + + return a; +>a : any + } + + + /** This comment should appear for privateFoo*/ + private privateFoo() { +>privateFoo : () => void + } + /** This is comment for function signature*/ + private privateFooWithParameters(/** this is comment about a*/a: string, +>privateFooWithParameters : (a: string, b: number) => void +>a : string + + /** this is comment for b*/ + b: number) { +>b : number + + var d = a; +>d : string +>a : string + } + private privateFooWithRestParameters(a: string, ...rests: string[]) { +>privateFooWithRestParameters : (a: string, ...rests: string[]) => string +>a : string +>rests : string[] + + return a + rests.join(""); +>a + rests.join("") : string +>a : string +>rests.join("") : string +>rests.join : (separator?: string) => string +>rests : string[] +>join : (separator?: string) => string + } + private privateFooWithOverloads(a: string): string; +>privateFooWithOverloads : { (a: string): string; (a: number): number; } +>a : string + + private privateFooWithOverloads(a: number): number; +>privateFooWithOverloads : { (a: string): string; (a: number): number; } +>a : number + + private privateFooWithOverloads(a: any): any { +>privateFooWithOverloads : { (a: string): string; (a: number): number; } +>a : any + + return a; +>a : any + } + + + /** This comment should appear for static foo*/ + static staticFoo() { +>staticFoo : () => void + } + /** This is comment for function signature*/ + static staticFooWithParameters(/** this is comment about a*/a: string, +>staticFooWithParameters : (a: string, b: number) => void +>a : string + + /** this is comment for b*/ + b: number) { +>b : number + + var d = a; +>d : string +>a : string + } + static staticFooWithRestParameters(a: string, ...rests: string[]) { +>staticFooWithRestParameters : (a: string, ...rests: string[]) => string +>a : string +>rests : string[] + + return a + rests.join(""); +>a + rests.join("") : string +>a : string +>rests.join("") : string +>rests.join : (separator?: string) => string +>rests : string[] +>join : (separator?: string) => string + } + static staticFooWithOverloads(a: string): string; +>staticFooWithOverloads : { (a: string): string; (a: number): number; } +>a : string + + static staticFooWithOverloads(a: number): number; +>staticFooWithOverloads : { (a: string): string; (a: number): number; } +>a : number + + static staticFooWithOverloads(a: any): any { +>staticFooWithOverloads : { (a: string): string; (a: number): number; } +>a : any + + return a; +>a : any + } + + + /** This comment should appear for privateStaticFoo*/ + private static privateStaticFoo() { +>privateStaticFoo : () => void + } + /** This is comment for function signature*/ + private static privateStaticFooWithParameters(/** this is comment about a*/a: string, +>privateStaticFooWithParameters : (a: string, b: number) => void +>a : string + + /** this is comment for b*/ + b: number) { +>b : number + + var d = a; +>d : string +>a : string + } + private static privateStaticFooWithRestParameters(a: string, ...rests: string[]) { +>privateStaticFooWithRestParameters : (a: string, ...rests: string[]) => string +>a : string +>rests : string[] + + return a + rests.join(""); +>a + rests.join("") : string +>a : string +>rests.join("") : string +>rests.join : (separator?: string) => string +>rests : string[] +>join : (separator?: string) => string + } + private static privateStaticFooWithOverloads(a: string): string; +>privateStaticFooWithOverloads : { (a: string): string; (a: number): number; } +>a : string + + private static privateStaticFooWithOverloads(a: number): number; +>privateStaticFooWithOverloads : { (a: string): string; (a: number): number; } +>a : number + + private static privateStaticFooWithOverloads(a: any): any { +>privateStaticFooWithOverloads : { (a: string): string; (a: number): number; } +>a : any + + return a; +>a : any + } +} + +export interface I1 { +>I1 : I1 + + /** This comment should appear for foo*/ + foo(): string; +>foo : () => string + + /** This is comment for function signature*/ + fooWithParameters(/** this is comment about a*/a: string, +>fooWithParameters : (a: string, b: number) => void +>a : string + + /** this is comment for b*/ + b: number): void; +>b : number + + fooWithRestParameters(a: string, ...rests: string[]): string; +>fooWithRestParameters : (a: string, ...rests: string[]) => string +>a : string +>rests : string[] + + fooWithOverloads(a: string): string; +>fooWithOverloads : { (a: string): string; (a: number): number; } +>a : string + + fooWithOverloads(a: number): number; +>fooWithOverloads : { (a: string): string; (a: number): number; } +>a : number +} + +=== tests/cases/compiler/declFileMethods_1.ts === +class c2 { +>c2 : c2 + + /** This comment should appear for foo*/ + public foo() { +>foo : () => void + } + /** This is comment for function signature*/ + public fooWithParameters(/** this is comment about a*/a: string, +>fooWithParameters : (a: string, b: number) => void +>a : string + + /** this is comment for b*/ + b: number) { +>b : number + + var d = a; +>d : string +>a : string + } + public fooWithRestParameters(a: string, ...rests: string[]) { +>fooWithRestParameters : (a: string, ...rests: string[]) => string +>a : string +>rests : string[] + + return a + rests.join(""); +>a + rests.join("") : string +>a : string +>rests.join("") : string +>rests.join : (separator?: string) => string +>rests : string[] +>join : (separator?: string) => string + } + + public fooWithOverloads(a: string): string; +>fooWithOverloads : { (a: string): string; (a: number): number; } +>a : string + + public fooWithOverloads(a: number): number; +>fooWithOverloads : { (a: string): string; (a: number): number; } +>a : number + + public fooWithOverloads(a: any): any { +>fooWithOverloads : { (a: string): string; (a: number): number; } +>a : any + + return a; +>a : any + } + + + /** This comment should appear for privateFoo*/ + private privateFoo() { +>privateFoo : () => void + } + /** This is comment for function signature*/ + private privateFooWithParameters(/** this is comment about a*/a: string, +>privateFooWithParameters : (a: string, b: number) => void +>a : string + + /** this is comment for b*/ + b: number) { +>b : number + + var d = a; +>d : string +>a : string + } + private privateFooWithRestParameters(a: string, ...rests: string[]) { +>privateFooWithRestParameters : (a: string, ...rests: string[]) => string +>a : string +>rests : string[] + + return a + rests.join(""); +>a + rests.join("") : string +>a : string +>rests.join("") : string +>rests.join : (separator?: string) => string +>rests : string[] +>join : (separator?: string) => string + } + private privateFooWithOverloads(a: string): string; +>privateFooWithOverloads : { (a: string): string; (a: number): number; } +>a : string + + private privateFooWithOverloads(a: number): number; +>privateFooWithOverloads : { (a: string): string; (a: number): number; } +>a : number + + private privateFooWithOverloads(a: any): any { +>privateFooWithOverloads : { (a: string): string; (a: number): number; } +>a : any + + return a; +>a : any + } + + + /** This comment should appear for static foo*/ + static staticFoo() { +>staticFoo : () => void + } + /** This is comment for function signature*/ + static staticFooWithParameters(/** this is comment about a*/a: string, +>staticFooWithParameters : (a: string, b: number) => void +>a : string + + /** this is comment for b*/ + b: number) { +>b : number + + var d = a; +>d : string +>a : string + } + static staticFooWithRestParameters(a: string, ...rests: string[]) { +>staticFooWithRestParameters : (a: string, ...rests: string[]) => string +>a : string +>rests : string[] + + return a + rests.join(""); +>a + rests.join("") : string +>a : string +>rests.join("") : string +>rests.join : (separator?: string) => string +>rests : string[] +>join : (separator?: string) => string + } + static staticFooWithOverloads(a: string): string; +>staticFooWithOverloads : { (a: string): string; (a: number): number; } +>a : string + + static staticFooWithOverloads(a: number): number; +>staticFooWithOverloads : { (a: string): string; (a: number): number; } +>a : number + + static staticFooWithOverloads(a: any): any { +>staticFooWithOverloads : { (a: string): string; (a: number): number; } +>a : any + + return a; +>a : any + } + + + /** This comment should appear for privateStaticFoo*/ + private static privateStaticFoo() { +>privateStaticFoo : () => void + } + /** This is comment for function signature*/ + private static privateStaticFooWithParameters(/** this is comment about a*/a: string, +>privateStaticFooWithParameters : (a: string, b: number) => void +>a : string + + /** this is comment for b*/ + b: number) { +>b : number + + var d = a; +>d : string +>a : string + } + private static privateStaticFooWithRestParameters(a: string, ...rests: string[]) { +>privateStaticFooWithRestParameters : (a: string, ...rests: string[]) => string +>a : string +>rests : string[] + + return a + rests.join(""); +>a + rests.join("") : string +>a : string +>rests.join("") : string +>rests.join : (separator?: string) => string +>rests : string[] +>join : (separator?: string) => string + } + private static privateStaticFooWithOverloads(a: string): string; +>privateStaticFooWithOverloads : { (a: string): string; (a: number): number; } +>a : string + + private static privateStaticFooWithOverloads(a: number): number; +>privateStaticFooWithOverloads : { (a: string): string; (a: number): number; } +>a : number + + private static privateStaticFooWithOverloads(a: any): any { +>privateStaticFooWithOverloads : { (a: string): string; (a: number): number; } +>a : any + + return a; +>a : any + } +} + +interface I2 { +>I2 : I2 + + /** This comment should appear for foo*/ + foo(): string; +>foo : () => string + + /** This is comment for function signature*/ + fooWithParameters(/** this is comment about a*/a: string, +>fooWithParameters : (a: string, b: number) => void +>a : string + + /** this is comment for b*/ + b: number): void; +>b : number + + fooWithRestParameters(a: string, ...rests: string[]): string; +>fooWithRestParameters : (a: string, ...rests: string[]) => string +>a : string +>rests : string[] + + fooWithOverloads(a: string): string; +>fooWithOverloads : { (a: string): string; (a: number): number; } +>a : string + + fooWithOverloads(a: number): number; +>fooWithOverloads : { (a: string): string; (a: number): number; } +>a : number +} + diff --git a/tests/baselines/reference/declFileModuleAssignmentInObjectLiteralProperty.types b/tests/baselines/reference/declFileModuleAssignmentInObjectLiteralProperty.types new file mode 100644 index 00000000000..f13397b1806 --- /dev/null +++ b/tests/baselines/reference/declFileModuleAssignmentInObjectLiteralProperty.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/declFileModuleAssignmentInObjectLiteralProperty.ts === + +module m1 { +>m1 : typeof m1 + + export class c { +>c : c + } +} +var d = { +>d : { m1: { m: typeof m1; }; m2: { c: typeof c; }; } +>{ + m1: { m: m1 }, + m2: { c: m1.c }, +} : { m1: { m: typeof m1; }; m2: { c: typeof c; }; } + + m1: { m: m1 }, +>m1 : { m: typeof m1; } +>{ m: m1 } : { m: typeof m1; } +>m : typeof m1 +>m1 : m1 + + m2: { c: m1.c }, +>m2 : { c: typeof c; } +>{ c: m1.c } : { c: typeof c; } +>c : typeof c +>m1.c : typeof c +>m1 : typeof m1 +>c : typeof c + +}; diff --git a/tests/baselines/reference/declFileModuleContinuation.types b/tests/baselines/reference/declFileModuleContinuation.types new file mode 100644 index 00000000000..06eb82a1933 --- /dev/null +++ b/tests/baselines/reference/declFileModuleContinuation.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/declFileModuleContinuation.ts === +module A.C { +>A : typeof A +>C : C + + export interface Z { +>Z : Z + } +} + +module A.B.C { +>A : typeof A +>B : typeof B +>C : typeof C + + export class W implements A.C.Z { +>W : W +>A : A +>C : C +>Z : Z + } +} diff --git a/tests/baselines/reference/declFileModuleWithPropertyOfTypeModule.types b/tests/baselines/reference/declFileModuleWithPropertyOfTypeModule.types new file mode 100644 index 00000000000..ecdc4396df4 --- /dev/null +++ b/tests/baselines/reference/declFileModuleWithPropertyOfTypeModule.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/declFileModuleWithPropertyOfTypeModule.ts === + +module m { +>m : typeof m + + export class c { +>c : c + } + + export var a = m; +>a : typeof m +>m : typeof m +} diff --git a/tests/baselines/reference/declFileOptionalInterfaceMethod.types b/tests/baselines/reference/declFileOptionalInterfaceMethod.types new file mode 100644 index 00000000000..c42c14f4fe5 --- /dev/null +++ b/tests/baselines/reference/declFileOptionalInterfaceMethod.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/declFileOptionalInterfaceMethod.ts === +interface X { +>X : X + + f? (); +>f : () => any +>T : T +} + diff --git a/tests/baselines/reference/declFileRegressionTests.types b/tests/baselines/reference/declFileRegressionTests.types new file mode 100644 index 00000000000..f230d93f0dd --- /dev/null +++ b/tests/baselines/reference/declFileRegressionTests.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/declFileRegressionTests.ts === +// 'null' not converted to 'any' in d.ts +// function types not piped through correctly +var n = { w: null, x: '', y: () => { }, z: 32 }; +>n : { w: any; x: string; y: () => void; z: number; } +>{ w: null, x: '', y: () => { }, z: 32 } : { w: null; x: string; y: () => void; z: number; } +>w : any +>x : string +>y : () => void +>() => { } : () => void +>z : number + + diff --git a/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.types b/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.types new file mode 100644 index 00000000000..ecb7c002089 --- /dev/null +++ b/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/declFileRestParametersOfFunctionAndFunctionType.ts === + +function f1(...args) { } +>f1 : (...args: any[]) => void +>args : any[] + +function f2(x: (...args) => void) { } +>f2 : (x: (...args: any[]) => void) => void +>x : (...args: any[]) => void +>args : any[] + +function f3(x: { (...args): void }) { } +>f3 : (x: (...args: any[]) => void) => void +>x : (...args: any[]) => void +>args : any[] + +function f4 void>() { } +>f4 : void>() => void +>T : T +>args : any[] + +function f5() { } +>f5 : void>() => void +>T : T +>args : any[] + +var f6 = () => { return [10]; } +>f6 : () => any[] +>() => { return [10]; } : () => any[] +>[10] : any[] +>10 : any + + + diff --git a/tests/baselines/reference/declFileTypeofClass.types b/tests/baselines/reference/declFileTypeofClass.types new file mode 100644 index 00000000000..119ad9bb7d4 --- /dev/null +++ b/tests/baselines/reference/declFileTypeofClass.types @@ -0,0 +1,39 @@ +=== tests/cases/compiler/declFileTypeofClass.ts === + +class c { +>c : c + + static x : string; +>x : string + + private static y: number; +>y : number + + private x3: string; +>x3 : string + + public y3: number; +>y3 : number +} + +var x: c; +>x : c +>c : c + +var y = c; +>y : typeof c +>c : typeof c + +var z: typeof c; +>z : typeof c +>c : typeof c + +class genericC +>genericC : genericC +>T : T +{ +} +var genericX = genericC; +>genericX : typeof genericC +>genericC : typeof genericC + diff --git a/tests/baselines/reference/declFileTypeofEnum.types b/tests/baselines/reference/declFileTypeofEnum.types new file mode 100644 index 00000000000..1c900a453b7 --- /dev/null +++ b/tests/baselines/reference/declFileTypeofEnum.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/declFileTypeofEnum.ts === + +enum days { +>days : days + + monday, +>monday : days + + tuesday, +>tuesday : days + + wednesday, +>wednesday : days + + thursday, +>thursday : days + + friday, +>friday : days + + saturday, +>saturday : days + + sunday +>sunday : days +} + +var weekendDay = days.saturday; +>weekendDay : days +>days.saturday : days +>days : typeof days +>saturday : days + +var daysOfMonth = days; +>daysOfMonth : typeof days +>days : typeof days + +var daysOfYear: typeof days; +>daysOfYear : typeof days +>days : typeof days + diff --git a/tests/baselines/reference/declFileTypeofFunction.types b/tests/baselines/reference/declFileTypeofFunction.types new file mode 100644 index 00000000000..a157f80074c --- /dev/null +++ b/tests/baselines/reference/declFileTypeofFunction.types @@ -0,0 +1,88 @@ +=== tests/cases/compiler/declFileTypeofFunction.ts === + +function f(n: typeof f): string; +>f : { (n: typeof f): string; (n: { (n: typeof g): number; (n: typeof f): number; }): string; } +>n : { (n: typeof f): string; (n: { (n: typeof g): number; (n: typeof f): number; }): string; } +>f : { (n: typeof f): string; (n: { (n: typeof g): number; (n: typeof f): number; }): string; } + +function f(n: typeof g): string; +>f : { (n: typeof f): string; (n: { (n: typeof g): number; (n: typeof f): number; }): string; } +>n : { (n: typeof g): number; (n: { (n: typeof f): string; (n: typeof g): string; }): number; } +>g : { (n: typeof g): number; (n: { (n: typeof f): string; (n: typeof g): string; }): number; } + +function f() { return undefined; } +>f : { (n: typeof f): string; (n: { (n: typeof g): number; (n: typeof f): number; }): string; } +>undefined : undefined + +function g(n: typeof g): number; +>g : { (n: typeof g): number; (n: { (n: typeof f): string; (n: typeof g): string; }): number; } +>n : { (n: typeof g): number; (n: { (n: typeof f): string; (n: typeof g): string; }): number; } +>g : { (n: typeof g): number; (n: { (n: typeof f): string; (n: typeof g): string; }): number; } + +function g(n: typeof f): number; +>g : { (n: typeof g): number; (n: { (n: typeof f): string; (n: typeof g): string; }): number; } +>n : { (n: typeof f): string; (n: { (n: typeof g): number; (n: typeof f): number; }): string; } +>f : { (n: typeof f): string; (n: { (n: typeof g): number; (n: typeof f): number; }): string; } + +function g() { return undefined; } +>g : { (n: typeof g): number; (n: { (n: typeof f): string; (n: typeof g): string; }): number; } +>undefined : undefined + +var b: () => typeof b; +>b : any +>b : any + +function b1() { +>b1 : () => typeof b1 + + return b1; +>b1 : () => typeof b1 +} + +function foo(): typeof foo { +>foo : () => typeof foo +>foo : () => typeof foo + + return null; +} +var foo1: typeof foo; +>foo1 : () => typeof foo +>foo : () => typeof foo + +var foo2 = foo; +>foo2 : () => typeof foo +>foo : () => typeof foo + +var foo3 = function () { +>foo3 : any +>function () { + return foo3; +} : () => any + + return foo3; +>foo3 : any +} +var x = () => { +>x : any +>() => { + return x; +} : () => any + + return x; +>x : any +} + +function foo5(x: number) { +>foo5 : (x: number) => (x: number) => number +>x : number + + function bar(x: number) { +>bar : (x: number) => number +>x : number + + return x; +>x : number + } + return bar; +>bar : (x: number) => number +} diff --git a/tests/baselines/reference/declFileTypeofInAnonymousType.types b/tests/baselines/reference/declFileTypeofInAnonymousType.types new file mode 100644 index 00000000000..f029dc22048 --- /dev/null +++ b/tests/baselines/reference/declFileTypeofInAnonymousType.types @@ -0,0 +1,91 @@ +=== tests/cases/compiler/declFileTypeofInAnonymousType.ts === + +module m1 { +>m1 : typeof m1 + + export class c { +>c : c + } + export enum e { +>e : e + + weekday, +>weekday : e + + weekend, +>weekend : e + + holiday +>holiday : e + } +} +var a: { c: m1.c; }; +>a : { c: c; } +>c : c +>m1 : m1 +>c : c + +var b = { +>b : { c: typeof c; m1: typeof m1; } +>{ + c: m1.c, + m1: m1 +} : { c: typeof c; m1: typeof m1; } + + c: m1.c, +>c : typeof c +>m1.c : typeof c +>m1 : typeof m1 +>c : typeof c + + m1: m1 +>m1 : typeof m1 +>m1 : m1 + +}; +var c = { m1: m1 }; +>c : { m1: typeof m1; } +>{ m1: m1 } : { m1: typeof m1; } +>m1 : typeof m1 +>m1 : m1 + +var d = { +>d : { m: { mod: typeof m1; }; mc: { cl: typeof c; }; me: { en: typeof e; }; mh: e; } +>{ + m: { mod: m1 }, + mc: { cl: m1.c }, + me: { en: m1.e }, + mh: m1.e.holiday +} : { m: { mod: typeof m1; }; mc: { cl: typeof c; }; me: { en: typeof e; }; mh: e; } + + m: { mod: m1 }, +>m : { mod: typeof m1; } +>{ mod: m1 } : { mod: typeof m1; } +>mod : typeof m1 +>m1 : m1 + + mc: { cl: m1.c }, +>mc : { cl: typeof c; } +>{ cl: m1.c } : { cl: typeof c; } +>cl : typeof c +>m1.c : typeof c +>m1 : typeof m1 +>c : typeof c + + me: { en: m1.e }, +>me : { en: typeof e; } +>{ en: m1.e } : { en: typeof e; } +>en : typeof e +>m1.e : typeof e +>m1 : typeof m1 +>e : typeof e + + mh: m1.e.holiday +>mh : e +>m1.e.holiday : e +>m1.e : typeof e +>m1 : typeof m1 +>e : typeof e +>holiday : e + +}; diff --git a/tests/baselines/reference/declFileTypeofModule.types b/tests/baselines/reference/declFileTypeofModule.types new file mode 100644 index 00000000000..ef4238bf2c5 --- /dev/null +++ b/tests/baselines/reference/declFileTypeofModule.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/declFileTypeofModule.ts === + +module m1 { +>m1 : typeof m1 + + export var c: string; +>c : string +} +var m1_1 = m1; +>m1_1 : typeof m1 +>m1 : typeof m1 + +var m1_2: typeof m1; +>m1_2 : typeof m1 +>m1 : typeof m1 + +module m2 { +>m2 : typeof m2 + + export var d: typeof m2; +>d : typeof m2 +>m2 : typeof m2 +} + +var m2_1 = m2; +>m2_1 : typeof m2 +>m2 : typeof m2 + +var m2_2: typeof m2; +>m2_2 : typeof m2 +>m2 : typeof m2 + diff --git a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.types b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.types new file mode 100644 index 00000000000..4da4b703f5f --- /dev/null +++ b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.types @@ -0,0 +1,50 @@ +=== tests/cases/compiler/declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts === + +declare module A.B.Base { +>A : typeof A +>B : typeof B +>Base : typeof Base + + export class W { +>W : W + + id: number; +>id : number + } +} +module X.Y.base { +>X : typeof X +>Y : typeof Y +>base : typeof base + + export class W extends A.B.Base.W { +>W : W +>A : A +>B : B +>Base : Base +>W : W + + name: string; +>name : string + } +} + +module X.Y.base.Z { +>X : typeof X +>Y : typeof Y +>base : typeof base +>Z : typeof Z + + export class W extends X.Y.base.W { +>W : W +>TValue : TValue +>X : X +>Y : Y +>base : base +>W : W + + value: boolean; +>value : boolean + } +} + diff --git a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.types b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.types new file mode 100644 index 00000000000..4dae0d42c53 --- /dev/null +++ b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.types @@ -0,0 +1,38 @@ +=== tests/cases/compiler/declFileWithExtendsClauseThatHasItsContainerNameConflict.ts === + +declare module A.B.C { +>A : typeof A +>B : typeof B +>C : typeof C + + class B { +>B : B + } +} + +module A.B { +>A : typeof A +>B : typeof B + + export class EventManager { +>EventManager : EventManager + + id: number; +>id : number + + } +} + +module A.B.C { +>A : typeof A +>B : typeof B +>C : typeof C + + export class ContextMenu extends EventManager { +>ContextMenu : ContextMenu +>EventManager : EventManager + + name: string; +>name : string + } +} diff --git a/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause1.types b/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause1.types new file mode 100644 index 00000000000..3f0c7d37e58 --- /dev/null +++ b/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause1.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/declFileWithInternalModuleNameConflictsInExtendsClause1.ts === + +module X.A.C { +>X : typeof X +>A : typeof A +>C : C + + export interface Z { +>Z : Z + } +} +module X.A.B.C { +>X : typeof X +>A : typeof A +>B : typeof B +>C : typeof C + + module A { +>A : A + } + export class W implements X.A.C.Z { // This needs to be refered as X.A.C.Z as A has conflict +>W : W +>X : X +>A : A +>C : C +>Z : Z + } +} diff --git a/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause2.types b/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause2.types new file mode 100644 index 00000000000..8041383332c --- /dev/null +++ b/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause2.types @@ -0,0 +1,35 @@ +=== tests/cases/compiler/declFileWithInternalModuleNameConflictsInExtendsClause2.ts === + +module X.A.C { +>X : typeof X +>A : typeof A +>C : C + + export interface Z { +>Z : Z + } +} +module X.A.B.C { +>X : typeof X +>A : typeof A +>B : typeof B +>C : typeof C + + export class W implements A.C.Z { // This can refer to it as A.C.Z +>W : W +>A : A +>C : C +>Z : Z + } +} + +module X.A.B.C { +>X : typeof X +>A : typeof A +>B : typeof B +>C : typeof C + + module A { +>A : A + } +} diff --git a/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause3.types b/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause3.types new file mode 100644 index 00000000000..023f4d81465 --- /dev/null +++ b/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause3.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/declFileWithInternalModuleNameConflictsInExtendsClause3.ts === + +module X.A.C { +>X : typeof X +>A : typeof A +>C : C + + export interface Z { +>Z : Z + } +} +module X.A.B.C { +>X : typeof X +>A : typeof A +>B : typeof B +>C : typeof C + + export class W implements X.A.C.Z { // This needs to be refered as X.A.C.Z as A has conflict +>W : W +>X : X +>A : A +>C : C +>Z : Z + } +} + +module X.A.B.C { +>X : typeof X +>A : typeof A +>B : typeof B +>C : typeof C + + export module A { +>A : A + } +} diff --git a/tests/baselines/reference/declInput-2.types b/tests/baselines/reference/declInput-2.types new file mode 100644 index 00000000000..98c5686bbe3 --- /dev/null +++ b/tests/baselines/reference/declInput-2.types @@ -0,0 +1,74 @@ +=== tests/cases/compiler/declInput-2.ts === +module M { +>M : typeof M + + class C { } +>C : C + + export class E {} +>E : E + + export interface I1 {} +>I1 : I1 + + interface I2 {} +>I2 : I2 + + export class D { +>D : D + + private c: C; // don't generate +>c : C +>C : C + + public m1: number; +>m1 : number + + public m2: string; +>m2 : string + + public m22: C; // don't generate +>m22 : C +>C : C + + public m23: E; +>m23 : E +>E : E + + public m24: I1; +>m24 : I1 +>I1 : I1 + + public m25: I2; // don't generate +>m25 : I2 +>I2 : I2 + + public m232(): E { return null;} +>m232 : () => E +>E : E + + public m242(): I1 { return null; } +>m242 : () => I1 +>I1 : I1 + + public m252(): I2 { return null; } // don't generate +>m252 : () => I2 +>I2 : I2 + + public m26(i:I1) {} +>m26 : (i: I1) => void +>i : I1 +>I1 : I1 + + public m262(i:I2) {} +>m262 : (i: I2) => void +>i : I2 +>I2 : I2 + + public m3():C { return new C(); } +>m3 : () => C +>C : C +>new C() : C +>C : typeof C + } +} diff --git a/tests/baselines/reference/declInput3.types b/tests/baselines/reference/declInput3.types new file mode 100644 index 00000000000..4147396b26d --- /dev/null +++ b/tests/baselines/reference/declInput3.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/declInput3.ts === +interface bar2 { +>bar2 : bar2 + +} + +class bar { +>bar : bar + + public f() { return ''; } +>f : () => string + + public g() { return {a: null, b: undefined, c: void 4 }; } +>g : () => { a: bar; b: any; c: any; } +>{a: null, b: undefined, c: void 4 } : { a: bar; b: undefined; c: undefined; } +>a : bar +>null : bar +>bar : bar +>b : any +>undefined : undefined +>c : any +>void 4 : undefined + + public h(x = 4, y = null, z = '') { x++; } +>h : (x?: number, y?: any, z?: string) => void +>x : number +>y : any +>z : string +>x++ : number +>x : number +} + diff --git a/tests/baselines/reference/declInput4.types b/tests/baselines/reference/declInput4.types new file mode 100644 index 00000000000..7f5c5a81197 --- /dev/null +++ b/tests/baselines/reference/declInput4.types @@ -0,0 +1,47 @@ +=== tests/cases/compiler/declInput4.ts === +module M { +>M : typeof M + + class C { } +>C : C + + export class E {} +>E : E + + export interface I1 {} +>I1 : I1 + + interface I2 {} +>I2 : I2 + + export class D { +>D : D + + public m1: number; +>m1 : number + + public m2: string; +>m2 : string + + public m23: E; +>m23 : E +>E : E + + public m24: I1; +>m24 : I1 +>I1 : I1 + + public m232(): E { return null;} +>m232 : () => E +>E : E + + public m242(): I1 { return null; } +>m242 : () => I1 +>I1 : I1 + + public m26(i:I1) {} +>m26 : (i: I1) => void +>i : I1 +>I1 : I1 + } +} diff --git a/tests/baselines/reference/declarationEmit_array-types-from-generic-array-usage.types b/tests/baselines/reference/declarationEmit_array-types-from-generic-array-usage.types new file mode 100644 index 00000000000..b68080c4082 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_array-types-from-generic-array-usage.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/declarationEmit_array-types-from-generic-array-usage.ts === +interface A extends Array { } +>A : A +>Array : Array + diff --git a/tests/baselines/reference/declarationEmit_nameConflicts.types b/tests/baselines/reference/declarationEmit_nameConflicts.types new file mode 100644 index 00000000000..07c39f34c9c --- /dev/null +++ b/tests/baselines/reference/declarationEmit_nameConflicts.types @@ -0,0 +1,149 @@ +=== tests/cases/compiler/declarationEmit_nameConflicts_0.ts === +import im = require('declarationEmit_nameConflicts_1'); +>im : typeof f + +export module M { +>M : typeof M + + export function f() { } +>f : () => void + + export class C { } +>C : C + + export module N { +>N : typeof N + + export function g() { }; +>g : () => void + + export interface I { } +>I : I + } + + export import a = M.f; +>a : () => void +>M : () => void +>f : () => void + + export import b = M.C; +>b : typeof C +>M : C +>C : C + + export import c = N; +>c : typeof N +>N : typeof N + + export import d = im; +>d : typeof f +>im : typeof f +} + +export module M.P { +>M : typeof M +>P : typeof P + + export function f() { } +>f : () => void + + export class C { } +>C : C + + export module N { +>N : typeof N + + export function g() { }; +>g : () => void + + export interface I { } +>I : I + } + export import im = M.P.f; +>im : () => void +>M : () => void +>P : () => void +>f : () => void + + // Bug 887180: Invalid .d.ts when an aliased entity is referenced, and a different entity is closer in scope + export var a = M.a; // emitted incorrectly as typeof f +>a : () => void +>M.a : () => void +>M : typeof M +>a : () => void + + export var b = M.b; // ok +>b : typeof C +>M.b : typeof C +>M : typeof M +>b : typeof C + + export var c = M.c; // ok +>c : typeof N +>M.c : typeof N +>M : typeof M +>c : typeof N + + export var g = M.c.g; // ok +>g : () => void +>M.c.g : () => void +>M.c : typeof N +>M : typeof M +>c : typeof N +>g : () => void + + export var d = M.d; // emitted incorrectly as typeof im +>d : typeof f +>M.d : typeof f +>M : typeof M +>d : typeof f +} + +export module M.Q { +>M : typeof M +>Q : typeof Q + + export function f() { } +>f : () => void + + export class C { } +>C : C + + export module N { +>N : typeof N + + export function g() { }; +>g : () => void + + export interface I { } +>I : I + } + export interface b extends M.b { } // ok +>b : b +>M : M +>b : b + + export interface I extends M.c.I { } // ok +>I : I +>M : M +>c : c +>I : I + + export module c { +>c : c + + export interface I extends M.c.I { } // ok +>I : I +>M : M +>c : c +>I : I + } +} +=== tests/cases/compiler/declarationEmit_nameConflicts_1.ts === +module f { export class c { } } +>f : typeof f +>c : c + +export = f; +>f : typeof f + diff --git a/tests/baselines/reference/declarationEmit_nameConflicts2.types b/tests/baselines/reference/declarationEmit_nameConflicts2.types new file mode 100644 index 00000000000..e73c0cea4c4 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_nameConflicts2.types @@ -0,0 +1,69 @@ +=== tests/cases/compiler/declarationEmit_nameConflicts2.ts === +module X.Y.base { +>X : typeof X +>Y : typeof Y +>base : typeof base + + export function f() { } +>f : () => void + + export class C { } +>C : C + + export module M { +>M : typeof M + + export var v; +>v : any + } + export enum E { } +>E : E +} + +module X.Y.base.Z { +>X : typeof X +>Y : typeof Y +>base : typeof base +>Z : typeof Z + + // Bug 887180 + export var f = X.Y.base.f; // Should be base.f +>f : () => void +>X.Y.base.f : () => void +>X.Y.base : typeof base +>X.Y : typeof Y +>X : typeof X +>Y : typeof Y +>base : typeof base +>f : () => void + + export var C = X.Y.base.C; // Should be base.C +>C : typeof C +>X.Y.base.C : typeof C +>X.Y.base : typeof base +>X.Y : typeof Y +>X : typeof X +>Y : typeof Y +>base : typeof base +>C : typeof C + + export var M = X.Y.base.M; // Should be base.M +>M : typeof M +>X.Y.base.M : typeof M +>X.Y.base : typeof base +>X.Y : typeof Y +>X : typeof X +>Y : typeof Y +>base : typeof base +>M : typeof M + + export var E = X.Y.base.E; // Should be base.E +>E : typeof E +>X.Y.base.E : typeof E +>X.Y.base : typeof base +>X.Y : typeof Y +>X : typeof X +>Y : typeof Y +>base : typeof base +>E : typeof E +} diff --git a/tests/baselines/reference/declarationEmit_nameConflicts3.types b/tests/baselines/reference/declarationEmit_nameConflicts3.types new file mode 100644 index 00000000000..477a7f2c2c7 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_nameConflicts3.types @@ -0,0 +1,77 @@ +=== tests/cases/compiler/declarationEmit_nameConflicts3.ts === +module M { +>M : typeof M + + export interface D { } +>D : D + + export module D { +>D : typeof D + + export function f() { } +>f : () => void + } + export module C { +>C : typeof C + + export function f() { } +>f : () => void + } + export module E { +>E : typeof E + + export function f() { } +>f : () => void + } +} + +module M.P { +>M : typeof M +>P : typeof P + + export class C { +>C : C + + static f() { } +>f : () => void + } + export class E extends C { } +>E : E +>C : C + + export enum D { +>D : D + + f +>f : D + } + // Bug 887180 + export var v: M.D; // ok +>v : D +>M : M +>D : D + + export var w = M.D.f; // error, should be typeof M.D.f +>w : () => void +>M.D.f : () => void +>M.D : typeof D +>M : typeof M +>D : typeof D +>f : () => void + + export var x = M.C.f; // error, should be typeof M.C.f +>x : () => void +>M.C.f : () => void +>M.C : typeof C +>M : typeof M +>C : typeof C +>f : () => void + + export var x = M.E.f; // error, should be typeof M.E.f +>x : () => void +>M.E.f : () => void +>M.E : typeof E +>M : typeof M +>E : typeof E +>f : () => void +} diff --git a/tests/baselines/reference/declarationEmit_nameConflictsWithAlias.types b/tests/baselines/reference/declarationEmit_nameConflictsWithAlias.types new file mode 100644 index 00000000000..2985bb71719 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_nameConflictsWithAlias.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/declarationEmit_nameConflictsWithAlias.ts === +// Bug 887180 +export module C { export interface I { } } +>C : C +>I : I + +export import v = C; +>v : v +>C : C + +export module M { +>M : typeof M + + export module C { export interface I { } } +>C : C +>I : I + + export var w: v.I; // Gets emitted as C.I, which is the wrong interface +>w : I +>v : v +>I : I +} diff --git a/tests/baselines/reference/declareDottedExtend.types b/tests/baselines/reference/declareDottedExtend.types new file mode 100644 index 00000000000..45a03ef0fbe --- /dev/null +++ b/tests/baselines/reference/declareDottedExtend.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/declareDottedExtend.ts === +declare module A.B +>A : typeof A +>B : typeof B +{ + export class C{ } +>C : C +} + +import ab = A.B; +>ab : typeof B +>A : typeof B +>B : typeof B + +class D extends ab.C{ } +>D : D +>ab : ab +>C : C + +class E extends A.B.C{ } +>E : E +>A : A +>B : B +>C : C + diff --git a/tests/baselines/reference/declareDottedModuleName.types b/tests/baselines/reference/declareDottedModuleName.types new file mode 100644 index 00000000000..2a579cfb1f8 --- /dev/null +++ b/tests/baselines/reference/declareDottedModuleName.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/declareDottedModuleName.ts === +module M { +>M : M + + module P.Q { } // This shouldnt be emitted +>P : P +>Q : Q +} + +module M { +>M : M + + export module R.S { } //This should be emitted +>R : R +>S : S +} + +module T.U { // This needs to be emitted +>T : T +>U : U +} diff --git a/tests/baselines/reference/declareExternalModuleWithExportAssignedFundule.types b/tests/baselines/reference/declareExternalModuleWithExportAssignedFundule.types new file mode 100644 index 00000000000..f9f1211c2a7 --- /dev/null +++ b/tests/baselines/reference/declareExternalModuleWithExportAssignedFundule.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/declareExternalModuleWithExportAssignedFundule.ts === +declare module "express" { + + export = express; +>express : typeof express + + function express(): express.ExpressServer; +>express : typeof express +>express : express +>ExpressServer : ExpressServer + + module express { +>express : typeof express + + export interface ExpressServer { +>ExpressServer : ExpressServer + + enable(name: string): ExpressServer; +>enable : (name: string) => ExpressServer +>name : string +>ExpressServer : ExpressServer + + post(path: RegExp, handler: (req: Function) => void ): void; +>post : (path: RegExp, handler: (req: Function) => void) => void +>path : RegExp +>RegExp : RegExp +>handler : (req: Function) => void +>req : Function +>Function : Function + + } + + export class ExpressServerRequest { +>ExpressServerRequest : ExpressServerRequest + + } + + } + +} + diff --git a/tests/baselines/reference/declareFileExportAssignment.types b/tests/baselines/reference/declareFileExportAssignment.types new file mode 100644 index 00000000000..613a4cc2071 --- /dev/null +++ b/tests/baselines/reference/declareFileExportAssignment.types @@ -0,0 +1,50 @@ +=== tests/cases/compiler/declareFileExportAssignment.ts === +module m2 { +>m2 : { (): connectExport; test1: connectModule; test2(): connectModule; } + + export interface connectModule { +>connectModule : connectModule + + (res, req, next): void; +>res : any +>req : any +>next : any + } + export interface connectExport { +>connectExport : connectExport + + use: (mod: connectModule) => connectExport; +>use : (mod: connectModule) => connectExport +>mod : connectModule +>connectModule : connectModule +>connectExport : connectExport + + listen: (port: number) => void; +>listen : (port: number) => void +>port : number + } + +} + +var m2: { +>m2 : { (): connectExport; test1: connectModule; test2(): connectModule; } + + (): m2.connectExport; +>m2 : m2 +>connectExport : connectExport + + test1: m2.connectModule; +>test1 : connectModule +>m2 : m2 +>connectModule : connectModule + + test2(): m2.connectModule; +>test2 : () => connectModule +>m2 : m2 +>connectModule : connectModule + +}; + +export = m2; +>m2 : { (): connectExport; test1: connectModule; test2(): connectModule; } + diff --git a/tests/baselines/reference/declareFileExportAssignmentWithVarFromVariableStatement.types b/tests/baselines/reference/declareFileExportAssignmentWithVarFromVariableStatement.types new file mode 100644 index 00000000000..0b173f89f16 --- /dev/null +++ b/tests/baselines/reference/declareFileExportAssignmentWithVarFromVariableStatement.types @@ -0,0 +1,51 @@ +=== tests/cases/compiler/declareFileExportAssignmentWithVarFromVariableStatement.ts === +module m2 { +>m2 : { (): connectExport; test1: connectModule; test2(): connectModule; } + + export interface connectModule { +>connectModule : connectModule + + (res, req, next): void; +>res : any +>req : any +>next : any + } + export interface connectExport { +>connectExport : connectExport + + use: (mod: connectModule) => connectExport; +>use : (mod: connectModule) => connectExport +>mod : connectModule +>connectModule : connectModule +>connectExport : connectExport + + listen: (port: number) => void; +>listen : (port: number) => void +>port : number + } + +} + +var x = 10, m2: { +>x : number +>m2 : { (): connectExport; test1: connectModule; test2(): connectModule; } + + (): m2.connectExport; +>m2 : m2 +>connectExport : connectExport + + test1: m2.connectModule; +>test1 : connectModule +>m2 : m2 +>connectModule : connectModule + + test2(): m2.connectModule; +>test2 : () => connectModule +>m2 : m2 +>connectModule : connectModule + +}; + +export = m2; +>m2 : { (): connectExport; test1: connectModule; test2(): connectModule; } + diff --git a/tests/baselines/reference/declaredExternalModule.types b/tests/baselines/reference/declaredExternalModule.types new file mode 100644 index 00000000000..5ce504e7f4b --- /dev/null +++ b/tests/baselines/reference/declaredExternalModule.types @@ -0,0 +1,45 @@ +=== tests/cases/compiler/declaredExternalModule.ts === +declare module 'connect' { + + interface connectModule { +>connectModule : connectModule + + (res, req, next): void; +>res : any +>req : any +>next : any + + } + + interface connectExport { +>connectExport : connectExport + + use: (mod: connectModule) => connectExport; +>use : (mod: connectModule) => connectExport +>mod : connectModule +>connectModule : connectModule +>connectExport : connectExport + + listen: (port: number) => void; +>listen : (port: number) => void +>port : number + + } + + var server: { +>server : { (): connectExport; test1: connectModule; test2(): connectModule; } + + (): connectExport; +>connectExport : connectExport + + test1: connectModule; // No error +>test1 : connectModule +>connectModule : connectModule + + test2(): connectModule; // ERROR: Return type of method from exported interface has or is using private type ''connect'.connectModule'. +>test2 : () => connectModule +>connectModule : connectModule + + }; +} + diff --git a/tests/baselines/reference/declaredExternalModuleWithExportAssignment.types b/tests/baselines/reference/declaredExternalModuleWithExportAssignment.types new file mode 100644 index 00000000000..e550e8ee13d --- /dev/null +++ b/tests/baselines/reference/declaredExternalModuleWithExportAssignment.types @@ -0,0 +1,44 @@ +=== tests/cases/compiler/declaredExternalModuleWithExportAssignment.ts === +declare module 'connect' { + interface connectModule { +>connectModule : connectModule + + (res, req, next): void; +>res : any +>req : any +>next : any + } + + interface connectExport { +>connectExport : connectExport + + use: (mod: connectModule) => connectExport; +>use : (mod: connectModule) => connectExport +>mod : connectModule +>connectModule : connectModule +>connectExport : connectExport + + listen: (port: number) => void; +>listen : (port: number) => void +>port : number + } + + var server: { +>server : { (): connectExport; test1: connectModule; test2(): connectModule; } + + (): connectExport; +>connectExport : connectExport + + test1: connectModule; +>test1 : connectModule +>connectModule : connectModule + + test2(): connectModule; +>test2 : () => connectModule +>connectModule : connectModule + + }; + export = server; +>server : { (): connectExport; test1: connectModule; test2(): connectModule; } +} + diff --git a/tests/baselines/reference/decrementOperatorWithAnyOtherType.types b/tests/baselines/reference/decrementOperatorWithAnyOtherType.types new file mode 100644 index 00000000000..1a4aea0d507 --- /dev/null +++ b/tests/baselines/reference/decrementOperatorWithAnyOtherType.types @@ -0,0 +1,191 @@ +=== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherType.ts === +// -- operator on any type + +var ANY: any; +>ANY : any + +var ANY1; +>ANY1 : any + +var ANY2: any[] = ["", ""]; +>ANY2 : any[] +>["", ""] : any[] + +var obj = {x:1,y:null}; +>obj : { x: number; y: any; } +>{x:1,y:null} : { x: number; y: null; } +>x : number +>y : any + +class A { +>A : A + + public a: any; +>a : any +} +module M { +>M : typeof M + + export var n: any; +>n : any +} +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// any type var +var ResultIsNumber1 = --ANY; +>ResultIsNumber1 : number +>--ANY : number +>ANY : any + +var ResultIsNumber2 = --ANY1; +>ResultIsNumber2 : number +>--ANY1 : number +>ANY1 : any + +var ResultIsNumber3 = ANY1--; +>ResultIsNumber3 : number +>ANY1-- : number +>ANY1 : any + +var ResultIsNumber4 = ANY1--; +>ResultIsNumber4 : number +>ANY1-- : number +>ANY1 : any + +// expressions +var ResultIsNumber5 = --ANY2[0]; +>ResultIsNumber5 : number +>--ANY2[0] : number +>ANY2[0] : any +>ANY2 : any[] + +var ResultIsNumber6 = --obj.x; +>ResultIsNumber6 : number +>--obj.x : number +>obj.x : number +>obj : { x: number; y: any; } +>x : number + +var ResultIsNumber7 = --obj.y; +>ResultIsNumber7 : number +>--obj.y : number +>obj.y : any +>obj : { x: number; y: any; } +>y : any + +var ResultIsNumber8 = --objA.a; +>ResultIsNumber8 : number +>--objA.a : number +>objA.a : any +>objA : A +>a : any + +var ResultIsNumber = --M.n; +>ResultIsNumber : number +>--M.n : number +>M.n : any +>M : typeof M +>n : any + +var ResultIsNumber9 = ANY2[0]--; +>ResultIsNumber9 : number +>ANY2[0]-- : number +>ANY2[0] : any +>ANY2 : any[] + +var ResultIsNumber10 = obj.x--; +>ResultIsNumber10 : number +>obj.x-- : number +>obj.x : number +>obj : { x: number; y: any; } +>x : number + +var ResultIsNumber11 = obj.y--; +>ResultIsNumber11 : number +>obj.y-- : number +>obj.y : any +>obj : { x: number; y: any; } +>y : any + +var ResultIsNumber12 = objA.a--; +>ResultIsNumber12 : number +>objA.a-- : number +>objA.a : any +>objA : A +>a : any + +var ResultIsNumber13 = M.n--; +>ResultIsNumber13 : number +>M.n-- : number +>M.n : any +>M : typeof M +>n : any + +// miss assignment opertors +--ANY; +>--ANY : number +>ANY : any + +--ANY1; +>--ANY1 : number +>ANY1 : any + +--ANY2[0]; +>--ANY2[0] : number +>ANY2[0] : any +>ANY2 : any[] + +--ANY, --ANY1; +>--ANY, --ANY1 : number +>--ANY : number +>ANY : any +>--ANY1 : number +>ANY1 : any + +--objA.a; +>--objA.a : number +>objA.a : any +>objA : A +>a : any + +--M.n; +>--M.n : number +>M.n : any +>M : typeof M +>n : any + +ANY--; +>ANY-- : number +>ANY : any + +ANY1--; +>ANY1-- : number +>ANY1 : any + +ANY2[0]--; +>ANY2[0]-- : number +>ANY2[0] : any +>ANY2 : any[] + +ANY--, ANY1--; +>ANY--, ANY1-- : number +>ANY-- : number +>ANY : any +>ANY1-- : number +>ANY1 : any + +objA.a--; +>objA.a-- : number +>objA.a : any +>objA : A +>a : any + +M.n--; +>M.n-- : number +>M.n : any +>M : typeof M +>n : any + diff --git a/tests/baselines/reference/decrementOperatorWithEnumType.types b/tests/baselines/reference/decrementOperatorWithEnumType.types new file mode 100644 index 00000000000..fc670ddc6f7 --- /dev/null +++ b/tests/baselines/reference/decrementOperatorWithEnumType.types @@ -0,0 +1,30 @@ +=== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts === +// -- operator on enum type + +enum ENUM1 { 1, 2, "" }; +>ENUM1 : ENUM1 + +// expression +var ResultIsNumber1 = --ENUM1[1]; +>ResultIsNumber1 : number +>--ENUM1[1] : number +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 + +var ResultIsNumber2 = ENUM1[1]--; +>ResultIsNumber2 : number +>ENUM1[1]-- : number +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 + +// miss assignment operator +--ENUM1[1]; +>--ENUM1[1] : number +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 + +ENUM1[1]--; +>ENUM1[1]-- : number +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 + diff --git a/tests/baselines/reference/decrementOperatorWithNumberType.types b/tests/baselines/reference/decrementOperatorWithNumberType.types new file mode 100644 index 00000000000..d619db84e46 --- /dev/null +++ b/tests/baselines/reference/decrementOperatorWithNumberType.types @@ -0,0 +1,137 @@ +=== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberType.ts === +// -- operator on number type +var NUMBER: number; +>NUMBER : number + +var NUMBER1: number[] = [1, 2]; +>NUMBER1 : number[] +>[1, 2] : number[] + +class A { +>A : A + + public a: number; +>a : number +} +module M { +>M : typeof M + + export var n: number; +>n : number +} + +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// number type var +var ResultIsNumber1 = --NUMBER; +>ResultIsNumber1 : number +>--NUMBER : number +>NUMBER : number + +var ResultIsNumber2 = NUMBER--; +>ResultIsNumber2 : number +>NUMBER-- : number +>NUMBER : number + +// expressions +var ResultIsNumber3 = --objA.a; +>ResultIsNumber3 : number +>--objA.a : number +>objA.a : number +>objA : A +>a : number + +var ResultIsNumber4 = --M.n; +>ResultIsNumber4 : number +>--M.n : number +>M.n : number +>M : typeof M +>n : number + +var ResultIsNumber5 = objA.a--; +>ResultIsNumber5 : number +>objA.a-- : number +>objA.a : number +>objA : A +>a : number + +var ResultIsNumber6 = M.n--; +>ResultIsNumber6 : number +>M.n-- : number +>M.n : number +>M : typeof M +>n : number + +var ResultIsNumber7 = NUMBER1[0]--; +>ResultIsNumber7 : number +>NUMBER1[0]-- : number +>NUMBER1[0] : number +>NUMBER1 : number[] + +// miss assignment operators +--NUMBER; +>--NUMBER : number +>NUMBER : number + +--NUMBER1[0]; +>--NUMBER1[0] : number +>NUMBER1[0] : number +>NUMBER1 : number[] + +--objA.a; +>--objA.a : number +>objA.a : number +>objA : A +>a : number + +--M.n; +>--M.n : number +>M.n : number +>M : typeof M +>n : number + +--objA.a, M.n; +>--objA.a, M.n : number +>--objA.a : number +>objA.a : number +>objA : A +>a : number +>M.n : number +>M : typeof M +>n : number + +NUMBER--; +>NUMBER-- : number +>NUMBER : number + +NUMBER1[0]--; +>NUMBER1[0]-- : number +>NUMBER1[0] : number +>NUMBER1 : number[] + +objA.a--; +>objA.a-- : number +>objA.a : number +>objA : A +>a : number + +M.n--; +>M.n-- : number +>M.n : number +>M : typeof M +>n : number + +objA.a--, M.n--; +>objA.a--, M.n-- : number +>objA.a-- : number +>objA.a : number +>objA : A +>a : number +>M.n-- : number +>M.n : number +>M : typeof M +>n : number + diff --git a/tests/baselines/reference/defaultIndexProps1.types b/tests/baselines/reference/defaultIndexProps1.types new file mode 100644 index 00000000000..9bb9c4a32c2 --- /dev/null +++ b/tests/baselines/reference/defaultIndexProps1.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/defaultIndexProps1.ts === +class Foo { +>Foo : Foo + + public v = "Yo"; +>v : string +} + +var f = new Foo(); +>f : Foo +>new Foo() : Foo +>Foo : typeof Foo + +var q = f["v"]; +>q : string +>f["v"] : string +>f : Foo + +var o = {v:"Yo2"}; +>o : { v: string; } +>{v:"Yo2"} : { v: string; } +>v : string + +var q2 = o["v"]; +>q2 : string +>o["v"] : string +>o : { v: string; } + diff --git a/tests/baselines/reference/defaultIndexProps2.types b/tests/baselines/reference/defaultIndexProps2.types new file mode 100644 index 00000000000..26850bd1456 --- /dev/null +++ b/tests/baselines/reference/defaultIndexProps2.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/defaultIndexProps2.ts === +class Foo { +>Foo : Foo + + public v = "Yo"; +>v : string +} + +var f = new Foo(); +>f : Foo +>new Foo() : Foo +>Foo : typeof Foo + +// WScript.Echo(f[0]); + +var o = {v:"Yo2"}; +>o : { v: string; } +>{v:"Yo2"} : { v: string; } +>v : string + +// WScript.Echo(o[0]); + +1[0]; +>1[0] : any + +var q = "s"[0]; +>q : string +>"s"[0] : string + diff --git a/tests/baselines/reference/deleteOperatorWithBooleanType.types b/tests/baselines/reference/deleteOperatorWithBooleanType.types new file mode 100644 index 00000000000..fa8c375b0a5 --- /dev/null +++ b/tests/baselines/reference/deleteOperatorWithBooleanType.types @@ -0,0 +1,112 @@ +=== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts === +// delete operator on boolean type +var BOOLEAN: boolean; +>BOOLEAN : boolean + +function foo(): boolean { return true; } +>foo : () => boolean + +class A { +>A : A + + public a: boolean; +>a : boolean + + static foo() { return false; } +>foo : () => boolean +} +module M { +>M : typeof M + + export var n: boolean; +>n : boolean +} + +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// boolean type var +var ResultIsBoolean1 = delete BOOLEAN; +>ResultIsBoolean1 : boolean +>delete BOOLEAN : boolean +>BOOLEAN : boolean + +// boolean type literal +var ResultIsBoolean2 = delete true; +>ResultIsBoolean2 : boolean +>delete true : boolean + +var ResultIsBoolean3 = delete { x: true, y: false }; +>ResultIsBoolean3 : boolean +>delete { x: true, y: false } : boolean +>{ x: true, y: false } : { x: boolean; y: boolean; } +>x : boolean +>y : boolean + +// boolean type expressions +var ResultIsBoolean4 = delete objA.a; +>ResultIsBoolean4 : boolean +>delete objA.a : boolean +>objA.a : boolean +>objA : A +>a : boolean + +var ResultIsBoolean5 = delete M.n; +>ResultIsBoolean5 : boolean +>delete M.n : boolean +>M.n : boolean +>M : typeof M +>n : boolean + +var ResultIsBoolean6 = delete foo(); +>ResultIsBoolean6 : boolean +>delete foo() : boolean +>foo() : boolean +>foo : () => boolean + +var ResultIsBoolean7 = delete A.foo(); +>ResultIsBoolean7 : boolean +>delete A.foo() : boolean +>A.foo() : boolean +>A.foo : () => boolean +>A : typeof A +>foo : () => boolean + +// multiple delete operator +var ResultIsBoolean8 = delete delete BOOLEAN; +>ResultIsBoolean8 : boolean +>delete delete BOOLEAN : boolean +>delete BOOLEAN : boolean +>BOOLEAN : boolean + +// miss assignment operators +delete true; +>delete true : boolean + +delete BOOLEAN; +>delete BOOLEAN : boolean +>BOOLEAN : boolean + +delete foo(); +>delete foo() : boolean +>foo() : boolean +>foo : () => boolean + +delete true, false; +>delete true, false : boolean +>delete true : boolean + +delete objA.a; +>delete objA.a : boolean +>objA.a : boolean +>objA : A +>a : boolean + +delete M.n; +>delete M.n : boolean +>M.n : boolean +>M : typeof M +>n : boolean + diff --git a/tests/baselines/reference/deleteOperatorWithEnumType.types b/tests/baselines/reference/deleteOperatorWithEnumType.types new file mode 100644 index 00000000000..d356693616f --- /dev/null +++ b/tests/baselines/reference/deleteOperatorWithEnumType.types @@ -0,0 +1,76 @@ +=== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts === +// delete operator on enum type + +enum ENUM { }; +>ENUM : ENUM + +enum ENUM1 { 1, 2, "" }; +>ENUM1 : ENUM1 + +// enum type var +var ResultIsBoolean1 = delete ENUM; +>ResultIsBoolean1 : boolean +>delete ENUM : boolean +>ENUM : typeof ENUM + +var ResultIsBoolean2 = delete ENUM1; +>ResultIsBoolean2 : boolean +>delete ENUM1 : boolean +>ENUM1 : typeof ENUM1 + +// enum type expressions +var ResultIsBoolean3 = delete ENUM1[0]; +>ResultIsBoolean3 : boolean +>delete ENUM1[0] : boolean +>ENUM1[0] : string +>ENUM1 : typeof ENUM1 + +var ResultIsBoolean4 = delete (ENUM[0] + ENUM1[1]); +>ResultIsBoolean4 : boolean +>delete (ENUM[0] + ENUM1[1]) : boolean +>(ENUM[0] + ENUM1[1]) : string +>ENUM[0] + ENUM1[1] : string +>ENUM[0] : string +>ENUM : typeof ENUM +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 + +// multiple delete operators +var ResultIsBoolean5 = delete delete ENUM; +>ResultIsBoolean5 : boolean +>delete delete ENUM : boolean +>delete ENUM : boolean +>ENUM : typeof ENUM + +var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1[1]); +>ResultIsBoolean6 : boolean +>delete delete delete (ENUM[0] + ENUM1[1]) : boolean +>delete delete (ENUM[0] + ENUM1[1]) : boolean +>delete (ENUM[0] + ENUM1[1]) : boolean +>(ENUM[0] + ENUM1[1]) : string +>ENUM[0] + ENUM1[1] : string +>ENUM[0] : string +>ENUM : typeof ENUM +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 + +// miss assignment operators +delete ENUM; +>delete ENUM : boolean +>ENUM : typeof ENUM + +delete ENUM1; +>delete ENUM1 : boolean +>ENUM1 : typeof ENUM1 + +delete ENUM1[1]; +>delete ENUM1[1] : boolean +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 + +delete ENUM, ENUM1; +>delete ENUM, ENUM1 : typeof ENUM1 +>delete ENUM : boolean +>ENUM : typeof ENUM +>ENUM1 : typeof ENUM1 + diff --git a/tests/baselines/reference/deleteOperatorWithNumberType.types b/tests/baselines/reference/deleteOperatorWithNumberType.types new file mode 100644 index 00000000000..542efe04c34 --- /dev/null +++ b/tests/baselines/reference/deleteOperatorWithNumberType.types @@ -0,0 +1,165 @@ +=== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts === +// delete operator on number type +var NUMBER: number; +>NUMBER : number + +var NUMBER1: number[] = [1, 2]; +>NUMBER1 : number[] +>[1, 2] : number[] + +function foo(): number { return 1; } +>foo : () => number + +class A { +>A : A + + public a: number; +>a : number + + static foo() { return 1; } +>foo : () => number +} +module M { +>M : typeof M + + export var n: number; +>n : number +} + +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// number type var +var ResultIsBoolean1 = delete NUMBER; +>ResultIsBoolean1 : boolean +>delete NUMBER : boolean +>NUMBER : number + +var ResultIsBoolean2 = delete NUMBER1; +>ResultIsBoolean2 : boolean +>delete NUMBER1 : boolean +>NUMBER1 : number[] + +// number type literal +var ResultIsBoolean3 = delete 1; +>ResultIsBoolean3 : boolean +>delete 1 : boolean + +var ResultIsBoolean4 = delete { x: 1, y: 2}; +>ResultIsBoolean4 : boolean +>delete { x: 1, y: 2} : boolean +>{ x: 1, y: 2} : { x: number; y: number; } +>x : number +>y : number + +var ResultIsBoolean5 = delete { x: 1, y: (n: number) => { return n; } }; +>ResultIsBoolean5 : boolean +>delete { x: 1, y: (n: number) => { return n; } } : boolean +>{ x: 1, y: (n: number) => { return n; } } : { x: number; y: (n: number) => number; } +>x : number +>y : (n: number) => number +>(n: number) => { return n; } : (n: number) => number +>n : number +>n : number + +// number type expressions +var ResultIsBoolean6 = delete objA.a; +>ResultIsBoolean6 : boolean +>delete objA.a : boolean +>objA.a : number +>objA : A +>a : number + +var ResultIsBoolean7 = delete M.n; +>ResultIsBoolean7 : boolean +>delete M.n : boolean +>M.n : number +>M : typeof M +>n : number + +var ResultIsBoolean8 = delete NUMBER1[0]; +>ResultIsBoolean8 : boolean +>delete NUMBER1[0] : boolean +>NUMBER1[0] : number +>NUMBER1 : number[] + +var ResultIsBoolean9 = delete foo(); +>ResultIsBoolean9 : boolean +>delete foo() : boolean +>foo() : number +>foo : () => number + +var ResultIsBoolean10 = delete A.foo(); +>ResultIsBoolean10 : boolean +>delete A.foo() : boolean +>A.foo() : number +>A.foo : () => number +>A : typeof A +>foo : () => number + +var ResultIsBoolean11 = delete (NUMBER + NUMBER); +>ResultIsBoolean11 : boolean +>delete (NUMBER + NUMBER) : boolean +>(NUMBER + NUMBER) : number +>NUMBER + NUMBER : number +>NUMBER : number +>NUMBER : number + +// multiple delete operator +var ResultIsBoolean12 = delete delete NUMBER; +>ResultIsBoolean12 : boolean +>delete delete NUMBER : boolean +>delete NUMBER : boolean +>NUMBER : number + +var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); +>ResultIsBoolean13 : boolean +>delete delete delete (NUMBER + NUMBER) : boolean +>delete delete (NUMBER + NUMBER) : boolean +>delete (NUMBER + NUMBER) : boolean +>(NUMBER + NUMBER) : number +>NUMBER + NUMBER : number +>NUMBER : number +>NUMBER : number + +// miss assignment operators +delete 1; +>delete 1 : boolean + +delete NUMBER; +>delete NUMBER : boolean +>NUMBER : number + +delete NUMBER1; +>delete NUMBER1 : boolean +>NUMBER1 : number[] + +delete foo(); +>delete foo() : boolean +>foo() : number +>foo : () => number + +delete objA.a; +>delete objA.a : boolean +>objA.a : number +>objA : A +>a : number + +delete M.n; +>delete M.n : boolean +>M.n : number +>M : typeof M +>n : number + +delete objA.a, M.n; +>delete objA.a, M.n : number +>delete objA.a : boolean +>objA.a : number +>objA : A +>a : number +>M.n : number +>M : typeof M +>n : number + diff --git a/tests/baselines/reference/deleteOperatorWithStringType.types b/tests/baselines/reference/deleteOperatorWithStringType.types new file mode 100644 index 00000000000..f86afc39c49 --- /dev/null +++ b/tests/baselines/reference/deleteOperatorWithStringType.types @@ -0,0 +1,161 @@ +=== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts === +// delete operator on string type +var STRING: string; +>STRING : string + +var STRING1: string[] = ["", "abc"]; +>STRING1 : string[] +>["", "abc"] : string[] + +function foo(): string { return "abc"; } +>foo : () => string + +class A { +>A : A + + public a: string; +>a : string + + static foo() { return ""; } +>foo : () => string +} +module M { +>M : typeof M + + export var n: string; +>n : string +} + +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// string type var +var ResultIsBoolean1 = delete STRING; +>ResultIsBoolean1 : boolean +>delete STRING : boolean +>STRING : string + +var ResultIsBoolean2 = delete STRING1; +>ResultIsBoolean2 : boolean +>delete STRING1 : boolean +>STRING1 : string[] + +// string type literal +var ResultIsBoolean3 = delete ""; +>ResultIsBoolean3 : boolean +>delete "" : boolean + +var ResultIsBoolean4 = delete { x: "", y: "" }; +>ResultIsBoolean4 : boolean +>delete { x: "", y: "" } : boolean +>{ x: "", y: "" } : { x: string; y: string; } +>x : string +>y : string + +var ResultIsBoolean5 = delete { x: "", y: (s: string) => { return s; } }; +>ResultIsBoolean5 : boolean +>delete { x: "", y: (s: string) => { return s; } } : boolean +>{ x: "", y: (s: string) => { return s; } } : { x: string; y: (s: string) => string; } +>x : string +>y : (s: string) => string +>(s: string) => { return s; } : (s: string) => string +>s : string +>s : string + +// string type expressions +var ResultIsBoolean6 = delete objA.a; +>ResultIsBoolean6 : boolean +>delete objA.a : boolean +>objA.a : string +>objA : A +>a : string + +var ResultIsBoolean7 = delete M.n; +>ResultIsBoolean7 : boolean +>delete M.n : boolean +>M.n : string +>M : typeof M +>n : string + +var ResultIsBoolean8 = delete STRING1[0]; +>ResultIsBoolean8 : boolean +>delete STRING1[0] : boolean +>STRING1[0] : string +>STRING1 : string[] + +var ResultIsBoolean9 = delete foo(); +>ResultIsBoolean9 : boolean +>delete foo() : boolean +>foo() : string +>foo : () => string + +var ResultIsBoolean10 = delete A.foo(); +>ResultIsBoolean10 : boolean +>delete A.foo() : boolean +>A.foo() : string +>A.foo : () => string +>A : typeof A +>foo : () => string + +var ResultIsBoolean11 = delete (STRING + STRING); +>ResultIsBoolean11 : boolean +>delete (STRING + STRING) : boolean +>(STRING + STRING) : string +>STRING + STRING : string +>STRING : string +>STRING : string + +var ResultIsBoolean12 = delete STRING.charAt(0); +>ResultIsBoolean12 : boolean +>delete STRING.charAt(0) : boolean +>STRING.charAt(0) : string +>STRING.charAt : (pos: number) => string +>STRING : string +>charAt : (pos: number) => string + +// multiple delete operator +var ResultIsBoolean13 = delete delete STRING; +>ResultIsBoolean13 : boolean +>delete delete STRING : boolean +>delete STRING : boolean +>STRING : string + +var ResultIsBoolean14 = delete delete delete (STRING + STRING); +>ResultIsBoolean14 : boolean +>delete delete delete (STRING + STRING) : boolean +>delete delete (STRING + STRING) : boolean +>delete (STRING + STRING) : boolean +>(STRING + STRING) : string +>STRING + STRING : string +>STRING : string +>STRING : string + +// miss assignment operators +delete ""; +>delete "" : boolean + +delete STRING; +>delete STRING : boolean +>STRING : string + +delete STRING1; +>delete STRING1 : boolean +>STRING1 : string[] + +delete foo(); +>delete foo() : boolean +>foo() : string +>foo : () => string + +delete objA.a,M.n; +>delete objA.a,M.n : string +>delete objA.a : boolean +>objA.a : string +>objA : A +>a : string +>M.n : string +>M : typeof M +>n : string + diff --git a/tests/baselines/reference/dependencyViaImportAlias.types b/tests/baselines/reference/dependencyViaImportAlias.types new file mode 100644 index 00000000000..3e9b453bd73 --- /dev/null +++ b/tests/baselines/reference/dependencyViaImportAlias.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/B.ts === +import a = require('A'); +>a : typeof "tests/cases/compiler/A" + +import A = a.A; +>A : typeof A +>a : A +>A : A + +export = A; +>A : A + +=== tests/cases/compiler/A.ts === +export class A { +>A : A +} diff --git a/tests/baselines/reference/deprecatedBool.types b/tests/baselines/reference/deprecatedBool.types new file mode 100644 index 00000000000..d8c70d56e50 --- /dev/null +++ b/tests/baselines/reference/deprecatedBool.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/deprecatedBool.ts === +var b4: boolean; +>b4 : boolean + +var bool: boolean; +>bool : boolean + diff --git a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.types b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.types new file mode 100644 index 00000000000..97940edc6e7 --- /dev/null +++ b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.types @@ -0,0 +1,34 @@ +=== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesIndexersWithAssignmentCompatibility.ts === +class Base { +>Base : Base + + [x: string]: Object; +>x : string +>Object : Object +} + +// ok, use assignment compatibility +class Derived extends Base { +>Derived : Derived +>Base : Base + + [x: string]: any; +>x : string +} + +class Base2 { +>Base2 : Base2 + + [x: number]: Object; +>x : number +>Object : Object +} + +// ok, use assignment compatibility +class Derived2 extends Base2 { +>Derived2 : Derived2 +>Base2 : Base2 + + [x: number]: any; +>x : number +} diff --git a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.types b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.types new file mode 100644 index 00000000000..a46c8efa408 --- /dev/null +++ b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.types @@ -0,0 +1,46 @@ +=== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesWithoutSubtype.ts === +class Base { +>Base : Base + + x: { +>x : { foo: string; } + + foo: string; +>foo : string + } +} + +class Derived extends Base { +>Derived : Derived +>Base : Base + + x: { +>x : { foo: any; } + + foo: any; +>foo : any + } +} + +class Base2 { +>Base2 : Base2 + + static y: { +>y : { foo: string; } + + foo: string; +>foo : string + } +} + +class Derived2 extends Base2 { +>Derived2 : Derived2 +>Base2 : Base2 + + static y: { +>y : { foo: any; } + + foo: any; +>foo : any + } +} diff --git a/tests/baselines/reference/derivedClasses.types b/tests/baselines/reference/derivedClasses.types new file mode 100644 index 00000000000..ce054b99223 --- /dev/null +++ b/tests/baselines/reference/derivedClasses.types @@ -0,0 +1,91 @@ +=== tests/cases/compiler/derivedClasses.ts === +class Red extends Color { +>Red : Red +>Color : Color + + public shade() { +>shade : () => string + + var getHue = () => { return this.hue(); }; +>getHue : () => string +>() => { return this.hue(); } : () => string +>this.hue() : string +>this.hue : () => string +>this : Red +>hue : () => string + + return getHue() + " red"; +>getHue() + " red" : string +>getHue() : string +>getHue : () => string + } +} + +class Color { +>Color : Color + + public shade() { return "some shade"; } +>shade : () => string + + public hue() { return "some hue"; } +>hue : () => string +} + +class Blue extends Color { +>Blue : Blue +>Color : Color + + public shade() { +>shade : () => string + + var getHue = () => { return this.hue(); }; +>getHue : () => string +>() => { return this.hue(); } : () => string +>this.hue() : string +>this.hue : () => string +>this : Blue +>hue : () => string + + return getHue() + " blue"; +>getHue() + " blue" : string +>getHue() : string +>getHue : () => string + } +} + +var r = new Red(); +>r : Red +>new Red() : Red +>Red : typeof Red + +var b = new Blue(); +>b : Blue +>new Blue() : Blue +>Blue : typeof Blue + +r.shade(); +>r.shade() : string +>r.shade : () => string +>r : Red +>shade : () => string + +r.hue(); +>r.hue() : string +>r.hue : () => string +>r : Red +>hue : () => string + +b.shade(); +>b.shade() : string +>b.shade : () => string +>b : Blue +>shade : () => string + +b.hue(); +>b.hue() : string +>b.hue : () => string +>b : Blue +>hue : () => string + + + diff --git a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.types b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.types new file mode 100644 index 00000000000..e9a24afdba2 --- /dev/null +++ b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.types @@ -0,0 +1,60 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts === +class Base { +>Base : Base + + foo(x: { a: number }): { a: number } { +>foo : (x: { a: number; }) => { a: number; } +>x : { a: number; } +>a : number +>a : number + + return null; + } +} + +class Derived extends Base { +>Derived : Derived +>Base : Base + + foo(x: { a: number; b: number }): { a: number; b: number } { +>foo : (x: { a: number; b: number; }) => { a: number; b: number; } +>x : { a: number; b: number; } +>a : number +>b : number +>a : number +>b : number + + return null; + } + + bar() { +>bar : () => void + + var r = super.foo({ a: 1 }); // { a: number } +>r : { a: number; } +>super.foo({ a: 1 }) : { a: number; } +>super.foo : (x: { a: number; }) => { a: number; } +>foo : (x: { a: number; }) => { a: number; } +>{ a: 1 } : { a: number; } +>a : number + + var r2 = super.foo({ a: 1, b: 2 }); // { a: number } +>r2 : { a: number; } +>super.foo({ a: 1, b: 2 }) : { a: number; } +>super.foo : (x: { a: number; }) => { a: number; } +>foo : (x: { a: number; }) => { a: number; } +>{ a: 1, b: 2 } : { a: number; b: number; } +>a : number +>b : number + + var r3 = this.foo({ a: 1, b: 2 }); // { a: number; b: number; } +>r3 : { a: number; b: number; } +>this.foo({ a: 1, b: 2 }) : { a: number; b: number; } +>this.foo : (x: { a: number; b: number; }) => { a: number; b: number; } +>this : Derived +>foo : (x: { a: number; b: number; }) => { a: number; b: number; } +>{ a: 1, b: 2 } : { a: number; b: number; } +>a : number +>b : number + } +} diff --git a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.types b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.types new file mode 100644 index 00000000000..9821ff91123 --- /dev/null +++ b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.types @@ -0,0 +1,55 @@ +=== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/derivedTypeDoesNotRequireExtendsClause.ts === +class Base { +>Base : Base + + foo: string; +>foo : string +} + +class Derived { +>Derived : Derived + + foo: string; +>foo : string + + bar: number; +>bar : number +} + +class Derived2 extends Base { +>Derived2 : Derived2 +>Base : Base + + bar: string; +>bar : string +} + +var b: Base; +>b : Base +>Base : Base + +var d1: Derived; +>d1 : Derived +>Derived : Derived + +var d2: Derived2; +>d2 : Derived2 +>Derived2 : Derived2 + +b = d1; +>b = d1 : Derived +>b : Base +>d1 : Derived + +b = d2; +>b = d2 : Derived2 +>b : Base +>d2 : Derived2 + +var r: Base[] = [d1, d2]; +>r : Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived +>d2 : Derived2 + diff --git a/tests/baselines/reference/doNotWidenAtObjectLiteralPropertyAssignment.types b/tests/baselines/reference/doNotWidenAtObjectLiteralPropertyAssignment.types new file mode 100644 index 00000000000..24eafce8cde --- /dev/null +++ b/tests/baselines/reference/doNotWidenAtObjectLiteralPropertyAssignment.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/doNotWidenAtObjectLiteralPropertyAssignment.ts === +interface ITestEventInterval { +>ITestEventInterval : ITestEventInterval + + begin: number; +>begin : number +} + +interface IIntervalTreeNode { +>IIntervalTreeNode : IIntervalTreeNode + + interval: ITestEventInterval; +>interval : ITestEventInterval +>ITestEventInterval : ITestEventInterval + + children?: IIntervalTreeNode[]; +>children : IIntervalTreeNode[] +>IIntervalTreeNode : IIntervalTreeNode +} + +var test: IIntervalTreeNode[] = [{ interval: { begin: 0 }, children: null }]; // was error here because best common type is {} +>test : IIntervalTreeNode[] +>IIntervalTreeNode : IIntervalTreeNode +>[{ interval: { begin: 0 }, children: null }] : IIntervalTreeNode[] +>{ interval: { begin: 0 }, children: null } : { interval: { begin: number; }; children: null; } +>interval : { begin: number; } +>{ begin: 0 } : { begin: number; } +>begin : number +>children : any + diff --git a/tests/baselines/reference/doWhileBreakStatements.types b/tests/baselines/reference/doWhileBreakStatements.types new file mode 100644 index 00000000000..c32adda7f4b --- /dev/null +++ b/tests/baselines/reference/doWhileBreakStatements.types @@ -0,0 +1,42 @@ +=== tests/cases/conformance/statements/breakStatements/doWhileBreakStatements.ts === +do { + break; +} while(true) + +ONE: +do { + break ONE; +} +while (true) + +TWO: +THREE: +do { + break THREE; +}while (true) + +FOUR: +do { + FIVE: + do { + break FOUR; + }while (true) +}while (true) + +do { + SIX: + do break SIX; while(true) +}while (true) + +SEVEN: +do do do break SEVEN; while (true) while (true) while (true) + +EIGHT: +do{ + var fn = function () { } +>fn : () => void +>function () { } : () => void + + break EIGHT; +}while(true) + diff --git a/tests/baselines/reference/doWhileContinueStatements.types b/tests/baselines/reference/doWhileContinueStatements.types new file mode 100644 index 00000000000..398a8508e31 --- /dev/null +++ b/tests/baselines/reference/doWhileContinueStatements.types @@ -0,0 +1,42 @@ +=== tests/cases/conformance/statements/continueStatements/doWhileContinueStatements.ts === +do { + continue; +} while(true) + +ONE: +do { + continue ONE; +} +while (true) + +TWO: +THREE: +do { + continue THREE; +}while (true) + +FOUR: +do { + FIVE: + do { + continue FOUR; + }while (true) +}while (true) + +do { + SIX: + do continue SIX; while(true) +}while (true) + +SEVEN: +do do do continue SEVEN; while (true) while (true) while (true) + +EIGHT: +do{ + var fn = function () { } +>fn : () => void +>function () { } : () => void + + continue EIGHT; +}while(true) + diff --git a/tests/baselines/reference/doWhileLoop.types b/tests/baselines/reference/doWhileLoop.types new file mode 100644 index 00000000000..93f17659c64 --- /dev/null +++ b/tests/baselines/reference/doWhileLoop.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/doWhileLoop.ts === +do { } while (false); +var n; +>n : any + diff --git a/tests/baselines/reference/dottedModuleName2.types b/tests/baselines/reference/dottedModuleName2.types new file mode 100644 index 00000000000..e06bcd1577f --- /dev/null +++ b/tests/baselines/reference/dottedModuleName2.types @@ -0,0 +1,76 @@ +=== tests/cases/compiler/dottedModuleName2.ts === +module A.B { +>A : typeof A +>B : typeof B + + export var x = 1; +>x : number + +} + + + +module AA { export module B { +>AA : typeof AA +>B : typeof B + + export var x = 1; +>x : number + +} } + + + +var tmpOK = AA.B.x; +>tmpOK : number +>AA.B.x : number +>AA.B : typeof B +>AA : typeof AA +>B : typeof B +>x : number + +var tmpError = A.B.x; +>tmpError : number +>A.B.x : number +>A.B : typeof B +>A : typeof A +>B : typeof B +>x : number + + +module A.B.C +>A : typeof A +>B : typeof B +>C : typeof C + +{ + + export var x = 1; +>x : number + +} + + + +module M +>M : M + +{ + + import X1 = A; +>X1 : typeof A +>A : typeof A + + import X2 = A.B; +>X2 : typeof B +>A : typeof B +>B : typeof B + + import X3 = A.B.C; +>X3 : typeof C +>A : typeof C +>B : typeof C +>C : typeof C + +} + diff --git a/tests/baselines/reference/dottedSymbolResolution1.types b/tests/baselines/reference/dottedSymbolResolution1.types new file mode 100644 index 00000000000..5155d067c41 --- /dev/null +++ b/tests/baselines/reference/dottedSymbolResolution1.types @@ -0,0 +1,92 @@ +=== tests/cases/compiler/dottedSymbolResolution1.ts === +interface JQuery { +>JQuery : JQuery + + find(selector: string): JQuery; +>find : (selector: string) => JQuery +>selector : string +>JQuery : JQuery +} + +interface JQueryStatic { +>JQueryStatic : JQueryStatic + + (selector: string): JQuery; +>selector : string +>JQuery : JQuery + + (object: JQuery): JQuery; +>object : JQuery +>JQuery : JQuery +>JQuery : JQuery +} + +class Base { foo() { } } +>Base : Base +>foo : () => void + +function each(collection: string, callback: (indexInArray: any, valueOfElement: any) => any): any; +>each : { (collection: string, callback: (indexInArray: any, valueOfElement: any) => any): any; (collection: JQuery, callback: (indexInArray: number, valueOfElement: Base) => any): any; } +>collection : string +>callback : (indexInArray: any, valueOfElement: any) => any +>indexInArray : any +>valueOfElement : any + +function each(collection: JQuery, callback: (indexInArray: number, valueOfElement: Base) => any): any; +>each : { (collection: string, callback: (indexInArray: any, valueOfElement: any) => any): any; (collection: JQuery, callback: (indexInArray: number, valueOfElement: Base) => any): any; } +>collection : JQuery +>JQuery : JQuery +>callback : (indexInArray: number, valueOfElement: Base) => any +>indexInArray : number +>valueOfElement : Base +>Base : Base + +function each(collection: any, callback: (indexInArray: any, valueOfElement: any) => any): any { +>each : { (collection: string, callback: (indexInArray: any, valueOfElement: any) => any): any; (collection: JQuery, callback: (indexInArray: number, valueOfElement: Base) => any): any; } +>collection : any +>callback : (indexInArray: any, valueOfElement: any) => any +>indexInArray : any +>valueOfElement : any + + return null; +} + +function _setBarAndText(): void { +>_setBarAndText : () => void + + var x: JQuery, $: JQueryStatic +>x : JQuery +>JQuery : JQuery +>$ : JQueryStatic +>JQueryStatic : JQueryStatic + + each(x.find(" "), function () { +>each(x.find(" "), function () { + var $this: JQuery = $(''), + thisBar = $this.find(".fx-usagebars-calloutbar-this"); // bug lead to 'could not find dotted symbol' here + } ) : any +>each : { (collection: string, callback: (indexInArray: any, valueOfElement: any) => any): any; (collection: JQuery, callback: (indexInArray: number, valueOfElement: Base) => any): any; } +>x.find(" ") : JQuery +>x.find : (selector: string) => JQuery +>x : JQuery +>find : (selector: string) => JQuery +>function () { + var $this: JQuery = $(''), + thisBar = $this.find(".fx-usagebars-calloutbar-this"); // bug lead to 'could not find dotted symbol' here + } : () => void + + var $this: JQuery = $(''), +>$this : JQuery +>JQuery : JQuery +>$('') : JQuery +>$ : JQueryStatic + + thisBar = $this.find(".fx-usagebars-calloutbar-this"); // bug lead to 'could not find dotted symbol' here +>thisBar : JQuery +>$this.find(".fx-usagebars-calloutbar-this") : JQuery +>$this.find : (selector: string) => JQuery +>$this : JQuery +>find : (selector: string) => JQuery + + } ); +} diff --git a/tests/baselines/reference/duplicateAnonymousInners1.types b/tests/baselines/reference/duplicateAnonymousInners1.types new file mode 100644 index 00000000000..7c63fb4163b --- /dev/null +++ b/tests/baselines/reference/duplicateAnonymousInners1.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/duplicateAnonymousInners1.ts === +module Foo { +>Foo : typeof Foo + + class Helper { +>Helper : Helper + + } + + class Inner {} +>Inner : Inner + + // Inner should show up in intellisense + + export var Outer=0; +>Outer : number +} + + +module Foo { +>Foo : typeof Foo + + // Should not be an error + class Helper { +>Helper : Helper + + } + + // Inner should not show up in intellisense + // Outer should show up in intellisense + +} + diff --git a/tests/baselines/reference/duplicateAnonymousModuleClasses.types b/tests/baselines/reference/duplicateAnonymousModuleClasses.types new file mode 100644 index 00000000000..eebe5f721d9 --- /dev/null +++ b/tests/baselines/reference/duplicateAnonymousModuleClasses.types @@ -0,0 +1,71 @@ +=== tests/cases/compiler/duplicateAnonymousModuleClasses.ts === +module F { +>F : typeof F + + class Helper { +>Helper : Helper + + } + +} + + +module F { +>F : typeof F + + // Should not be an error + class Helper { +>Helper : Helper + + } + +} + +module Foo { +>Foo : typeof Foo + + class Helper { +>Helper : Helper + + } + +} + + +module Foo { +>Foo : typeof Foo + + // Should not be an error + class Helper { +>Helper : Helper + + } + +} + +module Gar { +>Gar : typeof Gar + + module Foo { +>Foo : typeof Foo + + class Helper { +>Helper : Helper + + } + + } + + + module Foo { +>Foo : typeof Foo + + // Should not be an error + class Helper { +>Helper : Helper + + } + + } +} + diff --git a/tests/baselines/reference/duplicateConstructSignature.types b/tests/baselines/reference/duplicateConstructSignature.types new file mode 100644 index 00000000000..5c33f09f8d6 --- /dev/null +++ b/tests/baselines/reference/duplicateConstructSignature.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/duplicateConstructSignature.ts === +interface I { +>I : I + + (): number; + (): string; +} diff --git a/tests/baselines/reference/duplicateConstructSignature2.types b/tests/baselines/reference/duplicateConstructSignature2.types new file mode 100644 index 00000000000..94628665963 --- /dev/null +++ b/tests/baselines/reference/duplicateConstructSignature2.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/duplicateConstructSignature2.ts === +interface I { +>I : I +>T : T + + (x: T): number; +>x : T +>T : T + + (x: T): string; +>x : T +>T : T +} diff --git a/tests/baselines/reference/duplicateConstructorOverloadSignature.types b/tests/baselines/reference/duplicateConstructorOverloadSignature.types new file mode 100644 index 00000000000..45df269706a --- /dev/null +++ b/tests/baselines/reference/duplicateConstructorOverloadSignature.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/duplicateConstructorOverloadSignature.ts === +class C { +>C : C + + constructor(x: number); +>x : number + + constructor(x: number); +>x : number + + constructor(x: any) { } +>x : any +} diff --git a/tests/baselines/reference/duplicateConstructorOverloadSignature2.types b/tests/baselines/reference/duplicateConstructorOverloadSignature2.types new file mode 100644 index 00000000000..780774e2545 --- /dev/null +++ b/tests/baselines/reference/duplicateConstructorOverloadSignature2.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/duplicateConstructorOverloadSignature2.ts === +class C { +>C : C +>T : T + + constructor(x: T); +>x : T +>T : T + + constructor(x: T); +>x : T +>T : T + + constructor(x: any) { } +>x : any +} diff --git a/tests/baselines/reference/duplicateIdentifierShouldNotShortCircuitBaseTypeBinding.types b/tests/baselines/reference/duplicateIdentifierShouldNotShortCircuitBaseTypeBinding.types new file mode 100644 index 00000000000..61cc569b965 --- /dev/null +++ b/tests/baselines/reference/duplicateIdentifierShouldNotShortCircuitBaseTypeBinding.types @@ -0,0 +1,3 @@ +=== tests/cases/compiler/duplicateIdentifierShouldNotShortCircuitBaseTypeBinding.ts === + +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/duplicateOverloadInTypeAugmentation1.types b/tests/baselines/reference/duplicateOverloadInTypeAugmentation1.types new file mode 100644 index 00000000000..63351ae0b23 --- /dev/null +++ b/tests/baselines/reference/duplicateOverloadInTypeAugmentation1.types @@ -0,0 +1,57 @@ +=== tests/cases/compiler/duplicateOverloadInTypeAugmentation1.ts === +interface Array { +>Array : T[] +>T : T + + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, +>reduce : { (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; (callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; (callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } +>callbackfn : (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T +>previousValue : T +>T : T +>currentValue : T +>T : T +>currentIndex : number +>array : T[] +>T : T +>T : T + + initialValue?: T): T; +>initialValue : T +>T : T +>T : T + + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, +>reduce : { (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; (callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; (callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } +>U : U +>callbackfn : (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U +>previousValue : U +>U : U +>currentValue : T +>T : T +>currentIndex : number +>array : T[] +>T : T +>U : U + + initialValue: U): U; +>initialValue : U +>U : U +>U : U +} +var a: Array; +>a : string[] +>Array : Array + +var r5 = a.reduce((x, y) => x + y); +>r5 : string +>a.reduce((x, y) => x + y) : string +>a.reduce : { (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue?: string): string; (callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U; (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue?: string): string; (callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U; } +>a : string[] +>reduce : { (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue?: string): string; (callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U; (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue?: string): string; (callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U; } +>(x, y) => x + y : (x: string, y: string) => string +>x : string +>y : string +>x + y : string +>x : string +>y : string + diff --git a/tests/baselines/reference/duplicateVarAndImport.types b/tests/baselines/reference/duplicateVarAndImport.types new file mode 100644 index 00000000000..b0a63664993 --- /dev/null +++ b/tests/baselines/reference/duplicateVarAndImport.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/duplicateVarAndImport.ts === +// no error since module is not instantiated + +var a; +>a : any + +module M { } +>M : M + +import a = M; +>a : any +>M : any + diff --git a/tests/baselines/reference/duplicateVariableDeclaration1.types b/tests/baselines/reference/duplicateVariableDeclaration1.types new file mode 100644 index 00000000000..0da31840cfd --- /dev/null +++ b/tests/baselines/reference/duplicateVariableDeclaration1.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/duplicateVariableDeclaration1.ts === +var v +>v : any + +var v +>v : any + diff --git a/tests/baselines/reference/duplicateVariablesByScope.types b/tests/baselines/reference/duplicateVariablesByScope.types new file mode 100644 index 00000000000..ec20d665ad8 --- /dev/null +++ b/tests/baselines/reference/duplicateVariablesByScope.types @@ -0,0 +1,60 @@ +=== tests/cases/compiler/duplicateVariablesByScope.ts === +// duplicate local variables are only reported at global scope + +module M { +>M : typeof M + + for (var j = 0; j < 10; j++) { +>j : number +>j < 10 : boolean +>j : number +>j++ : number +>j : number + } + + for (var j = 0; j < 10; j++) { +>j : number +>j < 10 : boolean +>j : number +>j++ : number +>j : number + } +} + +function foo() { +>foo : () => void + + var x = 2; +>x : number + + var x = 1; +>x : number + + if (true) { + var result = 1; +>result : number + } + else { + var result = 2; +>result : number + } +} + +class C { +>C : C + + foo() { +>foo : () => void + + try { + var x = 1; +>x : number + } + catch (e) { +>e : any + + var x = 2; +>x : number + } + } +} diff --git a/tests/baselines/reference/dynamicModuleTypecheckError.types b/tests/baselines/reference/dynamicModuleTypecheckError.types new file mode 100644 index 00000000000..c7d213d1661 --- /dev/null +++ b/tests/baselines/reference/dynamicModuleTypecheckError.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/dynamicModuleTypecheckError.ts === +export var x = 1; +>x : number + +for(var i = 0; i < 30; i++) { +>i : number +>i < 30 : boolean +>i : number +>i++ : number +>i : number + + x = i * 1000; // should not be an error here +>x = i * 1000 : number +>x : number +>i * 1000 : number +>i : number + +} + diff --git a/tests/baselines/reference/emitBOM.types b/tests/baselines/reference/emitBOM.types new file mode 100644 index 00000000000..b38fd19c8f4 --- /dev/null +++ b/tests/baselines/reference/emitBOM.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/emitBOM.ts === + +// JS and d.ts output should have a BOM but not the sourcemap +var x; +>x : any + diff --git a/tests/baselines/reference/emitCommentsOnlyFile.types b/tests/baselines/reference/emitCommentsOnlyFile.types new file mode 100644 index 00000000000..38b23eb128d --- /dev/null +++ b/tests/baselines/reference/emitCommentsOnlyFile.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/emitCommentsOnlyFile.ts === + +No type information for this code./** +No type information for this code.* @name Foo +No type information for this code.* @class +No type information for this code.*/ +No type information for this code./**#@+ +No type information for this code.* @memberOf Foo# +No type information for this code.* @field +No type information for this code.*/ +No type information for this code./** +No type information for this code.* @name bar +No type information for this code.* @type Object[] +No type information for this code.*/ +No type information for this code./**#@-*/ +No type information for this code./** +No type information for this code.* @name Foo2 +No type information for this code.* @class +No type information for this code.*/ +No type information for this code./**#@+ +No type information for this code.* @memberOf Foo2# +No type information for this code.* @field +No type information for this code.*/ +No type information for this code./** +No type information for this code.* @name bar +No type information for this code.* @type Object[] +No type information for this code.*/ +No type information for this code./**#@-*/ +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/emitMemberAccessExpression.types b/tests/baselines/reference/emitMemberAccessExpression.types new file mode 100644 index 00000000000..9f7c98332e9 --- /dev/null +++ b/tests/baselines/reference/emitMemberAccessExpression.types @@ -0,0 +1,43 @@ +=== tests/cases/compiler/emitMemberAccessExpression_file3.ts === +/// +/// +declare var OData: any; +>OData : any + +module Microsoft.PeopleAtWork.Model { +>Microsoft : typeof Microsoft +>PeopleAtWork : typeof PeopleAtWork +>Model : typeof Model + + export class KnockoutExtentions { +>KnockoutExtentions : KnockoutExtentions + } +} +=== tests/cases/compiler/emitMemberAccessExpression_file1.ts === +/// +No type information for this code."use strict"; +No type information for this code. +No type information for this code.=== tests/cases/compiler/emitMemberAccessExpression_file2.ts === +/// +"use strict"; +module Microsoft.PeopleAtWork.Model { +>Microsoft : typeof Microsoft +>PeopleAtWork : typeof PeopleAtWork +>Model : typeof Model + + export class _Person { +>_Person : _Person + + public populate(raw: any) { +>populate : (raw: any) => void +>raw : any + + var res = Model.KnockoutExtentions; +>res : typeof KnockoutExtentions +>Model.KnockoutExtentions : typeof KnockoutExtentions +>Model : typeof Model +>KnockoutExtentions : typeof KnockoutExtentions + } + } +} + diff --git a/tests/baselines/reference/emitPostComments.types b/tests/baselines/reference/emitPostComments.types new file mode 100644 index 00000000000..4173e584031 --- /dev/null +++ b/tests/baselines/reference/emitPostComments.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/emitPostComments.ts === + +var y = 10; +>y : number + +/** +* @name Foo +* @class +*/ +/**#@+ +* @memberOf Foo# +* @field +*/ +/** +* @name bar +* @type Object[] +*/ +/**#@-*/ +/** +* @name Foo2 +* @class +*/ +/**#@+ +* @memberOf Foo2# +* @field +*/ +/** +* @name bar +* @type Object[] +*/ +/**#@-*/ + diff --git a/tests/baselines/reference/emitPreComments.types b/tests/baselines/reference/emitPreComments.types new file mode 100644 index 00000000000..6ab0c7b1bf9 --- /dev/null +++ b/tests/baselines/reference/emitPreComments.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/emitPreComments.ts === + +// This is pre comment +var y = 10; +>y : number + +/** +* @name Foo +* @class +*/ +/**#@+ +* @memberOf Foo# +* @field +*/ +/** +* @name bar +* @type Object[] +*/ +/**#@-*/ +/** +* @name Foo2 +* @class +*/ +/**#@+ +* @memberOf Foo2# +* @field +*/ +/** +* @name bar +* @type Object[] +*/ +/**#@-*/ + diff --git a/tests/baselines/reference/emptyEnum.types b/tests/baselines/reference/emptyEnum.types new file mode 100644 index 00000000000..000434dcc48 --- /dev/null +++ b/tests/baselines/reference/emptyEnum.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/emptyEnum.ts === +enum E { +>E : E +} diff --git a/tests/baselines/reference/emptyExpr.types b/tests/baselines/reference/emptyExpr.types new file mode 100644 index 00000000000..a8c4a6047a2 --- /dev/null +++ b/tests/baselines/reference/emptyExpr.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/emptyExpr.ts === +[{},] +>[{},] : {}[] +>{} : {} + diff --git a/tests/baselines/reference/emptyFile-declaration.types b/tests/baselines/reference/emptyFile-declaration.types new file mode 100644 index 00000000000..496fbbb807d --- /dev/null +++ b/tests/baselines/reference/emptyFile-declaration.types @@ -0,0 +1,3 @@ +=== tests/cases/compiler/emptyFile-declaration.ts === + +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/emptyFile-souremap.types b/tests/baselines/reference/emptyFile-souremap.types new file mode 100644 index 00000000000..5c7f48cfb49 --- /dev/null +++ b/tests/baselines/reference/emptyFile-souremap.types @@ -0,0 +1,3 @@ +=== tests/cases/compiler/emptyFile-souremap.ts === + +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/emptyFile.types b/tests/baselines/reference/emptyFile.types new file mode 100644 index 00000000000..95478466b8a --- /dev/null +++ b/tests/baselines/reference/emptyFile.types @@ -0,0 +1,3 @@ +=== tests/cases/compiler/emptyFile.ts === + +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/emptyIndexer.types b/tests/baselines/reference/emptyIndexer.types new file mode 100644 index 00000000000..949e7370e78 --- /dev/null +++ b/tests/baselines/reference/emptyIndexer.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/emptyIndexer.ts === +interface I1 { +>I1 : I1 + + m(): number; +>m : () => number +} + +interface I2 { +>I2 : I2 + + [s:string]: I1; +>s : string +>I1 : I1 +} + + +var x: I2; +>x : I2 +>I2 : I2 + +var n = x[''].m(); // should not crash compiler +>n : number +>x[''].m() : number +>x[''].m : () => number +>x[''] : I1 +>x : I2 +>m : () => number + diff --git a/tests/baselines/reference/enumBasics.types b/tests/baselines/reference/enumBasics.types new file mode 100644 index 00000000000..67c16c62620 --- /dev/null +++ b/tests/baselines/reference/enumBasics.types @@ -0,0 +1,221 @@ +=== tests/cases/conformance/enums/enumBasics.ts === +// Enum without initializers have first member = 0 and successive members = N + 1 +enum E1 { +>E1 : E1 + + A, +>A : E1 + + B, +>B : E1 + + C +>C : E1 +} + +// Enum type is a subtype of Number +var x: number = E1.A; +>x : number +>E1.A : E1 +>E1 : typeof E1 +>A : E1 + +// Enum object type is anonymous with properties of the enum type and numeric indexer +var e = E1; +>e : typeof E1 +>E1 : typeof E1 + +var e: { +>e : typeof E1 + + A: E1; +>A : E1 +>E1 : E1 + + B: E1; +>B : E1 +>E1 : E1 + + C: E1; +>C : E1 +>E1 : E1 + + [n: number]: string; +>n : number + +}; +var e: typeof E1; +>e : typeof E1 +>E1 : typeof E1 + +// Reverse mapping of enum returns string name of property +var s = E1[e.A]; +>s : string +>E1[e.A] : string +>E1 : typeof E1 +>e.A : E1 +>e : typeof E1 +>A : E1 + +var s: string; +>s : string + + +// Enum with only constant members +enum E2 { +>E2 : E2 + + A = 1, B = 2, C = 3 +>A : E2 +>B : E2 +>C : E2 +} + +// Enum with only computed members +enum E3 { +>E3 : E3 + + X = 'foo'.length, Y = 4 + 3, Z = +'foo' +>X : E3 +>'foo'.length : number +>length : number +>Y : E3 +>4 + 3 : number +>Z : E3 +>+'foo' : number +} + +// Enum with constant members followed by computed members +enum E4 { +>E4 : E4 + + X = 0, Y, Z = 'foo'.length +>X : E4 +>Y : E4 +>Z : E4 +>'foo'.length : number +>length : number +} + +// Enum with > 2 constant members with no initializer for first member, non zero initializer for second element +enum E5 { +>E5 : E5 + + A, +>A : E5 + + B = 3, +>B : E5 + + C // 4 +>C : E5 +} + +enum E6 { +>E6 : E6 + + A, +>A : E6 + + B = 0, +>B : E6 + + C // 1 +>C : E6 +} + +// Enum with computed member initializer of type 'any' +enum E7 { +>E7 : E7 + + A = 'foo'['foo'] +>A : E7 +>'foo'['foo'] : any +} + +// Enum with computed member initializer of type number +enum E8 { +>E8 : E8 + + B = 'foo'['foo'] +>B : E8 +>'foo'['foo'] : any +} + +//Enum with computed member intializer of same enum type +enum E9 { +>E9 : E9 + + A, +>A : E9 + + B = A +>B : E9 +>A : E9 +} + +// (refer to .js to validate) +// Enum constant members are propagated +var doNotPropagate = [ +>doNotPropagate : {}[] +>[ + E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z +] : {}[] + + E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z +>E8.B : E8 +>E8 : typeof E8 +>B : E8 +>E7.A : E7 +>E7 : typeof E7 +>A : E7 +>E4.Z : E4 +>E4 : typeof E4 +>Z : E4 +>E3.X : E3 +>E3 : typeof E3 +>X : E3 +>E3.Y : E3 +>E3 : typeof E3 +>Y : E3 +>E3.Z : E3 +>E3 : typeof E3 +>Z : E3 + +]; +// Enum computed members are not propagated +var doPropagate = [ +>doPropagate : {}[] +>[ + E9.A, E9.B, E6.B, E6.C, E6.A, E5.A, E5.B, E5.C +] : {}[] + + E9.A, E9.B, E6.B, E6.C, E6.A, E5.A, E5.B, E5.C +>E9.A : E9 +>E9 : typeof E9 +>A : E9 +>E9.B : E9 +>E9 : typeof E9 +>B : E9 +>E6.B : E6 +>E6 : typeof E6 +>B : E6 +>E6.C : E6 +>E6 : typeof E6 +>C : E6 +>E6.A : E6 +>E6 : typeof E6 +>A : E6 +>E5.A : E5 +>E5 : typeof E5 +>A : E5 +>E5.B : E5 +>E5 : typeof E5 +>B : E5 +>E5.C : E5 +>E5 : typeof E5 +>C : E5 + +]; + + diff --git a/tests/baselines/reference/enumCodeGenNewLines1.types b/tests/baselines/reference/enumCodeGenNewLines1.types new file mode 100644 index 00000000000..51c09daa0ff --- /dev/null +++ b/tests/baselines/reference/enumCodeGenNewLines1.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/enumCodeGenNewLines1.ts === +enum foo { +>foo : foo + + b = 1, +>b : foo + + c = 2, +>c : foo + + d = 3 +>d : foo +} + diff --git a/tests/baselines/reference/enumDecl1.types b/tests/baselines/reference/enumDecl1.types new file mode 100644 index 00000000000..22d2b6b4d69 --- /dev/null +++ b/tests/baselines/reference/enumDecl1.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/enumDecl1.ts === + +declare module mAmbient { +>mAmbient : typeof mAmbient + + enum e { +>e : e + + x, +>x : e + + y, +>y : e + + z +>z : e + } +} + diff --git a/tests/baselines/reference/enumFromExternalModule.types b/tests/baselines/reference/enumFromExternalModule.types new file mode 100644 index 00000000000..e5aa4444094 --- /dev/null +++ b/tests/baselines/reference/enumFromExternalModule.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/enumFromExternalModule_1.ts === +/// +import f = require('enumFromExternalModule_0'); +>f : typeof "tests/cases/compiler/enumFromExternalModule_0" + +var x = f.Mode.Open; +>x : Mode +>f.Mode.Open : Mode +>f.Mode : typeof Mode +>f : typeof "tests/cases/compiler/enumFromExternalModule_0" +>Mode : typeof Mode +>Open : Mode + +=== tests/cases/compiler/enumFromExternalModule_0.ts === +export enum Mode { Open } +>Mode : Mode +>Open : Mode + diff --git a/tests/baselines/reference/enumIdentifierLiterals.types b/tests/baselines/reference/enumIdentifierLiterals.types new file mode 100644 index 00000000000..b259e57d1dd --- /dev/null +++ b/tests/baselines/reference/enumIdentifierLiterals.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/enumIdentifierLiterals.ts === +enum Nums { +>Nums : Nums + + 1.0, + 11e-1, + 0.12e1, + "13e-1", + 0xF00D +} diff --git a/tests/baselines/reference/enumIndexer.types b/tests/baselines/reference/enumIndexer.types new file mode 100644 index 00000000000..cbd7c3274a6 --- /dev/null +++ b/tests/baselines/reference/enumIndexer.types @@ -0,0 +1,38 @@ +=== tests/cases/compiler/enumIndexer.ts === +enum MyEnumType { +>MyEnumType : MyEnumType + + foo, bar +>foo : MyEnumType +>bar : MyEnumType +} +var _arr = [{ key: 'foo' }, { key: 'bar' }] +>_arr : { key: string; }[] +>[{ key: 'foo' }, { key: 'bar' }] : { key: string; }[] +>{ key: 'foo' } : { key: string; } +>key : string +>{ key: 'bar' } : { key: string; } +>key : string + +var enumValue = MyEnumType.foo; +>enumValue : MyEnumType +>MyEnumType.foo : MyEnumType +>MyEnumType : typeof MyEnumType +>foo : MyEnumType + +var x = _arr.map(o => MyEnumType[o.key] === enumValue); // these are not same type +>x : boolean[] +>_arr.map(o => MyEnumType[o.key] === enumValue) : boolean[] +>_arr.map : (callbackfn: (value: { key: string; }, index: number, array: { key: string; }[]) => U, thisArg?: any) => U[] +>_arr : { key: string; }[] +>map : (callbackfn: (value: { key: string; }, index: number, array: { key: string; }[]) => U, thisArg?: any) => U[] +>o => MyEnumType[o.key] === enumValue : (o: { key: string; }) => boolean +>o : { key: string; } +>MyEnumType[o.key] === enumValue : boolean +>MyEnumType[o.key] : any +>MyEnumType : typeof MyEnumType +>o.key : string +>o : { key: string; } +>key : string +>enumValue : MyEnumType + diff --git a/tests/baselines/reference/enumMapBackIntoItself.types b/tests/baselines/reference/enumMapBackIntoItself.types new file mode 100644 index 00000000000..d97dbcf85db --- /dev/null +++ b/tests/baselines/reference/enumMapBackIntoItself.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/enumMapBackIntoItself.ts === +enum TShirtSize { +>TShirtSize : TShirtSize + + Small, +>Small : TShirtSize + + Medium, +>Medium : TShirtSize + + Large +>Large : TShirtSize +} +var mySize = TShirtSize.Large; +>mySize : TShirtSize +>TShirtSize.Large : TShirtSize +>TShirtSize : typeof TShirtSize +>Large : TShirtSize + +var test = TShirtSize[mySize]; +>test : string +>TShirtSize[mySize] : string +>TShirtSize : typeof TShirtSize +>mySize : TShirtSize + +// specifically checking output here, bug was that test used to be undefined at runtime +test + '' +>test + '' : string +>test : string + diff --git a/tests/baselines/reference/enumMerging.types b/tests/baselines/reference/enumMerging.types new file mode 100644 index 00000000000..da0a30102c7 --- /dev/null +++ b/tests/baselines/reference/enumMerging.types @@ -0,0 +1,204 @@ +=== tests/cases/conformance/enums/enumMerging.ts === +// Enum with only constant members across 2 declarations with the same root module +// Enum with initializer in all declarations with constant members with the same root module +module M1 { +>M1 : typeof M1 + + enum EImpl1 { +>EImpl1 : EImpl1 + + A, B, C +>A : EImpl1 +>B : EImpl1 +>C : EImpl1 + } + + enum EImpl1 { +>EImpl1 : EImpl1 + + D = 1, E, F +>D : EImpl1 +>E : EImpl1 +>F : EImpl1 + } + + export enum EConst1 { +>EConst1 : EConst1 + + A = 3, B = 2, C = 1 +>A : EConst1 +>B : EConst1 +>C : EConst1 + } + + export enum EConst1 { +>EConst1 : EConst1 + + D = 7, E = 9, F = 8 +>D : EConst1 +>E : EConst1 +>F : EConst1 + } + + var x = [EConst1.A, EConst1.B, EConst1.C, EConst1.D, EConst1.E, EConst1.F]; +>x : EConst1[] +>[EConst1.A, EConst1.B, EConst1.C, EConst1.D, EConst1.E, EConst1.F] : EConst1[] +>EConst1.A : EConst1 +>EConst1 : typeof EConst1 +>A : EConst1 +>EConst1.B : EConst1 +>EConst1 : typeof EConst1 +>B : EConst1 +>EConst1.C : EConst1 +>EConst1 : typeof EConst1 +>C : EConst1 +>EConst1.D : EConst1 +>EConst1 : typeof EConst1 +>D : EConst1 +>EConst1.E : EConst1 +>EConst1 : typeof EConst1 +>E : EConst1 +>EConst1.F : EConst1 +>EConst1 : typeof EConst1 +>F : EConst1 +} + +// Enum with only computed members across 2 declarations with the same root module +module M2 { +>M2 : typeof M2 + + export enum EComp2 { +>EComp2 : EComp2 + + A = 'foo'.length, B = 'foo'.length, C = 'foo'.length +>A : EComp2 +>'foo'.length : number +>length : number +>B : EComp2 +>'foo'.length : number +>length : number +>C : EComp2 +>'foo'.length : number +>length : number + } + + export enum EComp2 { +>EComp2 : EComp2 + + D = 'foo'.length, E = 'foo'.length, F = 'foo'.length +>D : EComp2 +>'foo'.length : number +>length : number +>E : EComp2 +>'foo'.length : number +>length : number +>F : EComp2 +>'foo'.length : number +>length : number + } + + var x = [EComp2.A, EComp2.B, EComp2.C, EComp2.D, EComp2.E, EComp2.F]; +>x : EComp2[] +>[EComp2.A, EComp2.B, EComp2.C, EComp2.D, EComp2.E, EComp2.F] : EComp2[] +>EComp2.A : EComp2 +>EComp2 : typeof EComp2 +>A : EComp2 +>EComp2.B : EComp2 +>EComp2 : typeof EComp2 +>B : EComp2 +>EComp2.C : EComp2 +>EComp2 : typeof EComp2 +>C : EComp2 +>EComp2.D : EComp2 +>EComp2 : typeof EComp2 +>D : EComp2 +>EComp2.E : EComp2 +>EComp2 : typeof EComp2 +>E : EComp2 +>EComp2.F : EComp2 +>EComp2 : typeof EComp2 +>F : EComp2 +} + +// Enum with initializer in only one of two declarations with constant members with the same root module +module M3 { +>M3 : typeof M3 + + enum EInit { +>EInit : EInit + + A, +>A : EInit + + B +>B : EInit + } + + enum EInit { +>EInit : EInit + + C = 1, D, E +>C : EInit +>D : EInit +>E : EInit + } +} + +// Enums with same name but different root module +module M4 { +>M4 : typeof M4 + + export enum Color { Red, Green, Blue } +>Color : Color +>Red : Color +>Green : Color +>Blue : Color +} +module M5 { +>M5 : typeof M5 + + export enum Color { Red, Green, Blue } +>Color : Color +>Red : Color +>Green : Color +>Blue : Color +} + +module M6.A { +>M6 : typeof M6 +>A : typeof A + + export enum Color { Red, Green, Blue } +>Color : Color +>Red : Color +>Green : Color +>Blue : Color +} +module M6 { +>M6 : typeof M6 + + export module A { +>A : typeof A + + export enum Color { Yellow = 1 } +>Color : Color +>Yellow : Color + } + var t = A.Color.Yellow; +>t : Color +>A.Color.Yellow : Color +>A.Color : typeof Color +>A : typeof A +>Color : typeof Color +>Yellow : Color + + t = A.Color.Red; +>t = A.Color.Red : Color +>t : Color +>A.Color.Red : Color +>A.Color : typeof Color +>A : typeof A +>Color : typeof Color +>Red : Color +} + diff --git a/tests/baselines/reference/enumNegativeLiteral1.types b/tests/baselines/reference/enumNegativeLiteral1.types new file mode 100644 index 00000000000..329c54e276b --- /dev/null +++ b/tests/baselines/reference/enumNegativeLiteral1.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/enumNegativeLiteral1.ts === +enum E { +>E : E + + a = -5, b, c +>a : E +>-5 : number +>b : E +>c : E +} + diff --git a/tests/baselines/reference/enumNumbering1.types b/tests/baselines/reference/enumNumbering1.types new file mode 100644 index 00000000000..00e8eb95da9 --- /dev/null +++ b/tests/baselines/reference/enumNumbering1.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/enumNumbering1.ts === +enum Test { +>Test : Test + + A, +>A : Test + + B, +>B : Test + + C = Math.floor(Math.random() * 1000), +>C : Test +>Math.floor(Math.random() * 1000) : number +>Math.floor : (x: number) => number +>Math : Math +>floor : (x: number) => number +>Math.random() * 1000 : number +>Math.random() : number +>Math.random : () => number +>Math : Math +>random : () => number + + D = 10, +>D : Test + + E // Error but shouldn't be +>E : Test +} + diff --git a/tests/baselines/reference/enumOperations.types b/tests/baselines/reference/enumOperations.types new file mode 100644 index 00000000000..df36d293cf3 --- /dev/null +++ b/tests/baselines/reference/enumOperations.types @@ -0,0 +1,62 @@ +=== tests/cases/compiler/enumOperations.ts === +enum Enum { None = 0 } +>Enum : Enum +>None : Enum + +var enumType: Enum = Enum.None; +>enumType : Enum +>Enum : Enum +>Enum.None : Enum +>Enum : typeof Enum +>None : Enum + +var numberType: number = 0; +>numberType : number + +var anyType: any = 0; +>anyType : any + +enumType ^ numberType; +>enumType ^ numberType : number +>enumType : Enum +>numberType : number + +numberType ^ anyType; +>numberType ^ anyType : number +>numberType : number +>anyType : any + +enumType & anyType; +>enumType & anyType : number +>enumType : Enum +>anyType : any + +enumType | anyType; +>enumType | anyType : number +>enumType : Enum +>anyType : any + +enumType ^ anyType; +>enumType ^ anyType : number +>enumType : Enum +>anyType : any + +~anyType; +>~anyType : number +>anyType : any + +enumType <enumType <enumType : Enum +>anyType : any + +enumType >>anyType; +>enumType >>anyType : number +>enumType : Enum +>anyType : any + +enumType >>>anyType; +>enumType >>>anyType : number +>enumType : Enum +>anyType : any + diff --git a/tests/baselines/reference/enumWithQuotedElementName1.types b/tests/baselines/reference/enumWithQuotedElementName1.types new file mode 100644 index 00000000000..135a74a5103 --- /dev/null +++ b/tests/baselines/reference/enumWithQuotedElementName1.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/enumWithQuotedElementName1.ts === +enum E { +>E : E + + 'fo"o', +} diff --git a/tests/baselines/reference/enumWithQuotedElementName2.types b/tests/baselines/reference/enumWithQuotedElementName2.types new file mode 100644 index 00000000000..ab222764f75 --- /dev/null +++ b/tests/baselines/reference/enumWithQuotedElementName2.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/enumWithQuotedElementName2.ts === +enum E { +>E : E + + "fo'o", +} diff --git a/tests/baselines/reference/enumWithUnicodeEscape1.types b/tests/baselines/reference/enumWithUnicodeEscape1.types new file mode 100644 index 00000000000..8376685ca6b --- /dev/null +++ b/tests/baselines/reference/enumWithUnicodeEscape1.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/enumWithUnicodeEscape1.ts === +enum E { +>E : E + + 'gold \u2730' +} + diff --git a/tests/baselines/reference/enumsWithMultipleDeclarations3.types b/tests/baselines/reference/enumsWithMultipleDeclarations3.types new file mode 100644 index 00000000000..2b761c780e9 --- /dev/null +++ b/tests/baselines/reference/enumsWithMultipleDeclarations3.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/enumsWithMultipleDeclarations3.ts === +module E { +>E : typeof E +} + +enum E { +>E : E + + A +>A : E +} diff --git a/tests/baselines/reference/es3-amd.types b/tests/baselines/reference/es3-amd.types new file mode 100644 index 00000000000..c43d29ac6dc --- /dev/null +++ b/tests/baselines/reference/es3-amd.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/es3-amd.ts === + +class A +>A : A +{ + constructor () + { + + } + + public B() +>B : () => number + { + return 42; + } +} diff --git a/tests/baselines/reference/es3-declaration-amd.types b/tests/baselines/reference/es3-declaration-amd.types new file mode 100644 index 00000000000..0ee63040166 --- /dev/null +++ b/tests/baselines/reference/es3-declaration-amd.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/es3-declaration-amd.ts === + +class A +>A : A +{ + constructor () + { + + } + + public B() +>B : () => number + { + return 42; + } +} diff --git a/tests/baselines/reference/es3-sourcemap-amd.types b/tests/baselines/reference/es3-sourcemap-amd.types new file mode 100644 index 00000000000..5301120e2df --- /dev/null +++ b/tests/baselines/reference/es3-sourcemap-amd.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/es3-sourcemap-amd.ts === + +class A +>A : A +{ + constructor () + { + + } + + public B() +>B : () => number + { + return 42; + } +} diff --git a/tests/baselines/reference/es5-amd.types b/tests/baselines/reference/es5-amd.types new file mode 100644 index 00000000000..289289d3c0b --- /dev/null +++ b/tests/baselines/reference/es5-amd.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/es5-amd.ts === + +class A +>A : A +{ + constructor () + { + + } + + public B() +>B : () => number + { + return 42; + } +} diff --git a/tests/baselines/reference/es5-declaration-amd.types b/tests/baselines/reference/es5-declaration-amd.types new file mode 100644 index 00000000000..50815e8e6bc --- /dev/null +++ b/tests/baselines/reference/es5-declaration-amd.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/es5-declaration-amd.ts === + +class A +>A : A +{ + constructor () + { + + } + + public B() +>B : () => number + { + return 42; + } +} diff --git a/tests/baselines/reference/es5-souremap-amd.types b/tests/baselines/reference/es5-souremap-amd.types new file mode 100644 index 00000000000..242e6508026 --- /dev/null +++ b/tests/baselines/reference/es5-souremap-amd.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/es5-souremap-amd.ts === + +class A +>A : A +{ + constructor () + { + + } + + public B() +>B : () => number + { + return 42; + } +} diff --git a/tests/baselines/reference/es6ClassSuperCodegenBug.types b/tests/baselines/reference/es6ClassSuperCodegenBug.types new file mode 100644 index 00000000000..2c74789b587 --- /dev/null +++ b/tests/baselines/reference/es6ClassSuperCodegenBug.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/es6ClassSuperCodegenBug.ts === +class A { +>A : A + + constructor(str1:string, str2:string) {} +>str1 : string +>str2 : string +} +class B extends A { +>B : B +>A : A + + constructor() { + if (true) { + super('a1', 'b1'); +>super('a1', 'b1') : void + + } else { + super('a2', 'b2'); +>super('a2', 'b2') : void + } + } +} + diff --git a/tests/baselines/reference/es6ClassTest4.types b/tests/baselines/reference/es6ClassTest4.types new file mode 100644 index 00000000000..53669dada73 --- /dev/null +++ b/tests/baselines/reference/es6ClassTest4.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/es6ClassTest4.ts === +declare class Point +>Point : Point +{ + x: number; +>x : number + + y: number; +>y : number + + add(dx: number, dy: number): Point; +>add : (dx: number, dy: number) => Point +>dx : number +>dy : number +>Point : Point + + mult(p: Point): Point; +>mult : (p: Point) => Point +>p : Point +>Point : Point +>Point : Point + + static origin: Point; +>origin : Point +>Point : Point + + constructor(x: number, y: number); +>x : number +>y : number +} + diff --git a/tests/baselines/reference/es6ClassTest5.types b/tests/baselines/reference/es6ClassTest5.types new file mode 100644 index 00000000000..d1d3ab1b780 --- /dev/null +++ b/tests/baselines/reference/es6ClassTest5.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/es6ClassTest5.ts === +class C1T5 { +>C1T5 : C1T5 + + foo: (i: number, s: string) => number = +>foo : (i: number, s: string) => number +>i : number +>s : string + + (i) => { +>(i) => { + return i; + } : (i: number) => number +>i : number + + return i; +>i : number + } +} +module C2T5 {} +>C2T5 : C2T5 + +class bigClass { +>bigClass : bigClass + + public break = 1; +>break : number +} + diff --git a/tests/baselines/reference/es6ClassTest7.types b/tests/baselines/reference/es6ClassTest7.types new file mode 100644 index 00000000000..149fcac9c1e --- /dev/null +++ b/tests/baselines/reference/es6ClassTest7.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/es6ClassTest7.ts === +declare module M { +>M : typeof M + + export class Foo { +>Foo : Foo + } +} + +class Bar extends M.Foo { +>Bar : Bar +>M : M +>Foo : Foo +} + diff --git a/tests/baselines/reference/es6ClassTest8.types b/tests/baselines/reference/es6ClassTest8.types new file mode 100644 index 00000000000..5272f192b85 --- /dev/null +++ b/tests/baselines/reference/es6ClassTest8.types @@ -0,0 +1,183 @@ +=== tests/cases/compiler/es6ClassTest8.ts === +function f1(x:any) {return x;} +>f1 : (x: any) => any +>x : any +>x : any + +class C { +>C : C + + constructor() { + var bar:any = (function() { +>bar : any +>(function() { + return bar; // 'bar' should be resolvable + }) : () => any +>function() { + return bar; // 'bar' should be resolvable + } : () => any + + return bar; // 'bar' should be resolvable +>bar : any + + }); + var b = f1(f1(bar)); +>b : any +>f1(f1(bar)) : any +>f1 : (x: any) => any +>f1(bar) : any +>f1 : (x: any) => any +>bar : any + } + +} + +class Vector { +>Vector : Vector + + static norm(v:Vector):Vector {return null;} +>norm : (v: Vector) => Vector +>v : Vector +>Vector : Vector +>Vector : Vector + + static minus(v1:Vector, v2:Vector):Vector {return null;} +>minus : (v1: Vector, v2: Vector) => Vector +>v1 : Vector +>Vector : Vector +>v2 : Vector +>Vector : Vector +>Vector : Vector + + static times(v1:Vector, v2:Vector):Vector {return null;} +>times : (v1: Vector, v2: Vector) => Vector +>v1 : Vector +>Vector : Vector +>v2 : Vector +>Vector : Vector +>Vector : Vector + + static cross(v1:Vector, v2:Vector):Vector {return null;} +>cross : (v1: Vector, v2: Vector) => Vector +>v1 : Vector +>Vector : Vector +>v2 : Vector +>Vector : Vector +>Vector : Vector + + constructor(public x: number, +>x : number + + public y: number, +>y : number + + public z: number) { +>z : number + } + + static dot(v1:Vector, v2:Vector):Vector {return null;} +>dot : (v1: Vector, v2: Vector) => Vector +>v1 : Vector +>Vector : Vector +>v2 : Vector +>Vector : Vector +>Vector : Vector + +} + +class Camera { +>Camera : Camera + + public forward: Vector; +>forward : Vector +>Vector : Vector + + public right: Vector; +>right : Vector +>Vector : Vector + + public up: Vector; +>up : Vector +>Vector : Vector + + constructor(public pos: Vector, lookAt: Vector) { +>pos : Vector +>Vector : Vector +>lookAt : Vector +>Vector : Vector + + var down = new Vector(0.0, -1.0, 0.0); +>down : Vector +>new Vector(0.0, -1.0, 0.0) : Vector +>Vector : typeof Vector +>-1.0 : number + + this.forward = Vector.norm(Vector.minus(lookAt,this.pos)); +>this.forward = Vector.norm(Vector.minus(lookAt,this.pos)) : Vector +>this.forward : Vector +>this : Camera +>forward : Vector +>Vector.norm(Vector.minus(lookAt,this.pos)) : Vector +>Vector.norm : (v: Vector) => Vector +>Vector : typeof Vector +>norm : (v: Vector) => Vector +>Vector.minus(lookAt,this.pos) : Vector +>Vector.minus : (v1: Vector, v2: Vector) => Vector +>Vector : typeof Vector +>minus : (v1: Vector, v2: Vector) => Vector +>lookAt : Vector +>this.pos : Vector +>this : Camera +>pos : Vector + + this.right = Vector.times(down, Vector.norm(Vector.cross(this.forward, down))); +>this.right = Vector.times(down, Vector.norm(Vector.cross(this.forward, down))) : Vector +>this.right : Vector +>this : Camera +>right : Vector +>Vector.times(down, Vector.norm(Vector.cross(this.forward, down))) : Vector +>Vector.times : (v1: Vector, v2: Vector) => Vector +>Vector : typeof Vector +>times : (v1: Vector, v2: Vector) => Vector +>down : Vector +>Vector.norm(Vector.cross(this.forward, down)) : Vector +>Vector.norm : (v: Vector) => Vector +>Vector : typeof Vector +>norm : (v: Vector) => Vector +>Vector.cross(this.forward, down) : Vector +>Vector.cross : (v1: Vector, v2: Vector) => Vector +>Vector : typeof Vector +>cross : (v1: Vector, v2: Vector) => Vector +>this.forward : Vector +>this : Camera +>forward : Vector +>down : Vector + + this.up = Vector.times(down, Vector.norm(Vector.cross(this.forward, this.right))); +>this.up = Vector.times(down, Vector.norm(Vector.cross(this.forward, this.right))) : Vector +>this.up : Vector +>this : Camera +>up : Vector +>Vector.times(down, Vector.norm(Vector.cross(this.forward, this.right))) : Vector +>Vector.times : (v1: Vector, v2: Vector) => Vector +>Vector : typeof Vector +>times : (v1: Vector, v2: Vector) => Vector +>down : Vector +>Vector.norm(Vector.cross(this.forward, this.right)) : Vector +>Vector.norm : (v: Vector) => Vector +>Vector : typeof Vector +>norm : (v: Vector) => Vector +>Vector.cross(this.forward, this.right) : Vector +>Vector.cross : (v1: Vector, v2: Vector) => Vector +>Vector : typeof Vector +>cross : (v1: Vector, v2: Vector) => Vector +>this.forward : Vector +>this : Camera +>forward : Vector +>this.right : Vector +>this : Camera +>right : Vector + } +} + + diff --git a/tests/baselines/reference/escapedIdentifiers.types b/tests/baselines/reference/escapedIdentifiers.types new file mode 100644 index 00000000000..e814db0463c --- /dev/null +++ b/tests/baselines/reference/escapedIdentifiers.types @@ -0,0 +1,297 @@ +=== tests/cases/compiler/escapedIdentifiers.ts === +/* + 0 .. \u0030 + 9 .. \u0039 + + A .. \u0041 + Z .. \u005a + + a .. \u0061 + z .. \u00za +*/ + +// var decl +var \u0061 = 1; +>\u0061 : number + +a ++; +>a ++ : number +>a : number + +\u0061 ++; +>\u0061 ++ : number +>\u0061 : number + +var b = 1; +>b : number + +b ++; +>b ++ : number +>b : number + +\u0062 ++; +>\u0062 ++ : number +>\u0062 : number + +// modules +module moduleType1 { +>moduleType1 : typeof moduleType1 + + export var baz1: number; +>baz1 : number +} +module moduleType\u0032 { +>moduleType\u0032 : typeof moduleType\u0032 + + export var baz2: number; +>baz2 : number +} + +moduleType1.baz1 = 3; +>moduleType1.baz1 = 3 : number +>moduleType1.baz1 : number +>moduleType1 : typeof moduleType1 +>baz1 : number + +moduleType\u0031.baz1 = 3; +>moduleType\u0031.baz1 = 3 : number +>moduleType\u0031.baz1 : number +>moduleType\u0031 : typeof moduleType1 +>baz1 : number + +moduleType2.baz2 = 3; +>moduleType2.baz2 = 3 : number +>moduleType2.baz2 : number +>moduleType2 : typeof moduleType\u0032 +>baz2 : number + +moduleType\u0032.baz2 = 3; +>moduleType\u0032.baz2 = 3 : number +>moduleType\u0032.baz2 : number +>moduleType\u0032 : typeof moduleType\u0032 +>baz2 : number + +// classes + +class classType1 { +>classType1 : classType1 + + public foo1: number; +>foo1 : number +} +class classType\u0032 { +>classType\u0032 : classType\u0032 + + public foo2: number; +>foo2 : number +} + +var classType1Object1 = new classType1(); +>classType1Object1 : classType1 +>new classType1() : classType1 +>classType1 : typeof classType1 + +classType1Object1.foo1 = 2; +>classType1Object1.foo1 = 2 : number +>classType1Object1.foo1 : number +>classType1Object1 : classType1 +>foo1 : number + +var classType1Object2 = new classType\u0031(); +>classType1Object2 : classType1 +>new classType\u0031() : classType1 +>classType\u0031 : typeof classType1 + +classType1Object2.foo1 = 2; +>classType1Object2.foo1 = 2 : number +>classType1Object2.foo1 : number +>classType1Object2 : classType1 +>foo1 : number + +var classType2Object1 = new classType2(); +>classType2Object1 : classType\u0032 +>new classType2() : classType\u0032 +>classType2 : typeof classType\u0032 + +classType2Object1.foo2 = 2; +>classType2Object1.foo2 = 2 : number +>classType2Object1.foo2 : number +>classType2Object1 : classType\u0032 +>foo2 : number + +var classType2Object2 = new classType\u0032(); +>classType2Object2 : classType\u0032 +>new classType\u0032() : classType\u0032 +>classType\u0032 : typeof classType\u0032 + +classType2Object2.foo2 = 2; +>classType2Object2.foo2 = 2 : number +>classType2Object2.foo2 : number +>classType2Object2 : classType\u0032 +>foo2 : number + +// interfaces +interface interfaceType1 { +>interfaceType1 : interfaceType1 + + bar1: number; +>bar1 : number +} +interface interfaceType\u0032 { +>interfaceType\u0032 : interfaceType\u0032 + + bar2: number; +>bar2 : number +} + +var interfaceType1Object1 = { bar1: 0 }; +>interfaceType1Object1 : interfaceType1 +>{ bar1: 0 } : interfaceType1 +>interfaceType1 : interfaceType1 +>{ bar1: 0 } : { bar1: number; } +>bar1 : number + +interfaceType1Object1.bar1 = 2; +>interfaceType1Object1.bar1 = 2 : number +>interfaceType1Object1.bar1 : number +>interfaceType1Object1 : interfaceType1 +>bar1 : number + +var interfaceType1Object2 = { bar1: 0 }; +>interfaceType1Object2 : interfaceType1 +>{ bar1: 0 } : interfaceType1 +>interfaceType\u0031 : interfaceType\u0031 +>{ bar1: 0 } : { bar1: number; } +>bar1 : number + +interfaceType1Object2.bar1 = 2; +>interfaceType1Object2.bar1 = 2 : number +>interfaceType1Object2.bar1 : number +>interfaceType1Object2 : interfaceType1 +>bar1 : number + +var interfaceType2Object1 = { bar2: 0 }; +>interfaceType2Object1 : interfaceType\u0032 +>{ bar2: 0 } : interfaceType\u0032 +>interfaceType2 : interfaceType2 +>{ bar2: 0 } : { bar2: number; } +>bar2 : number + +interfaceType2Object1.bar2 = 2; +>interfaceType2Object1.bar2 = 2 : number +>interfaceType2Object1.bar2 : number +>interfaceType2Object1 : interfaceType\u0032 +>bar2 : number + +var interfaceType2Object2 = { bar2: 0 }; +>interfaceType2Object2 : interfaceType\u0032 +>{ bar2: 0 } : interfaceType\u0032 +>interfaceType\u0032 : interfaceType\u0032 +>{ bar2: 0 } : { bar2: number; } +>bar2 : number + +interfaceType2Object2.bar2 = 2; +>interfaceType2Object2.bar2 = 2 : number +>interfaceType2Object2.bar2 : number +>interfaceType2Object2 : interfaceType\u0032 +>bar2 : number + + +// arguments +class testClass { +>testClass : testClass + + public func(arg1: number, arg\u0032: string, arg\u0033: boolean, arg4: number) { +>func : (arg1: number, arg\u0032: string, arg\u0033: boolean, arg4: number) => void +>arg1 : number +>arg\u0032 : string +>arg\u0033 : boolean +>arg4 : number + + arg\u0031 = 1; +>arg\u0031 = 1 : number +>arg\u0031 : number + + arg2 = 'string'; +>arg2 = 'string' : string +>arg2 : string + + arg\u0033 = true; +>arg\u0033 = true : boolean +>arg\u0033 : boolean + + arg4 = 2; +>arg4 = 2 : number +>arg4 : number + } +} + +// constructors +class constructorTestClass { +>constructorTestClass : constructorTestClass + + constructor (public arg1: number,public arg\u0032: string,public arg\u0033: boolean,public arg4: number) { +>arg1 : number +>arg\u0032 : string +>arg\u0033 : boolean +>arg4 : number + } +} +var constructorTestObject = new constructorTestClass(1, 'string', true, 2); +>constructorTestObject : constructorTestClass +>new constructorTestClass(1, 'string', true, 2) : constructorTestClass +>constructorTestClass : typeof constructorTestClass + +constructorTestObject.arg\u0031 = 1; +>constructorTestObject.arg\u0031 = 1 : number +>constructorTestObject.arg\u0031 : number +>constructorTestObject : constructorTestClass +>arg\u0031 : number + +constructorTestObject.arg2 = 'string'; +>constructorTestObject.arg2 = 'string' : string +>constructorTestObject.arg2 : string +>constructorTestObject : constructorTestClass +>arg2 : string + +constructorTestObject.arg\u0033 = true; +>constructorTestObject.arg\u0033 = true : boolean +>constructorTestObject.arg\u0033 : boolean +>constructorTestObject : constructorTestClass +>arg\u0033 : boolean + +constructorTestObject.arg4 = 2; +>constructorTestObject.arg4 = 2 : number +>constructorTestObject.arg4 : number +>constructorTestObject : constructorTestClass +>arg4 : number + +// Lables + +l\u0061bel1: + while (false) + { + while(false) + continue label1; // it will go to next iteration of outer loop + } + +label2: + while (false) + { + while(false) + continue l\u0061bel2; // it will go to next iteration of outer loop + } + +label3: + while (false) + { + while(false) + continue label3; // it will go to next iteration of outer loop + } + +l\u0061bel4: + while (false) + { + while(false) + continue l\u0061bel4; // it will go to next iteration of outer loop + } diff --git a/tests/baselines/reference/everyTypeAssignableToAny.types b/tests/baselines/reference/everyTypeAssignableToAny.types new file mode 100644 index 00000000000..89af4f4b7c0 --- /dev/null +++ b/tests/baselines/reference/everyTypeAssignableToAny.types @@ -0,0 +1,214 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny.ts === +var a: any; +>a : any + +class C { +>C : C + + foo: string; +>foo : string +} +var ac: C; +>ac : C +>C : C + +interface I { +>I : I + + foo: string; +>foo : string +} +var ai: I; +>ai : I +>I : I + +enum E { A } +>E : E +>A : E + +var ae: E; +>ae : E +>E : E + +var b: number; +>b : number + +var c: string; +>c : string + +var d: boolean; +>d : boolean + +var e: Date; +>e : Date +>Date : Date + +var f: any; +>f : any + +var g: void; +>g : void + +var h: Object; +>h : Object +>Object : Object + +var i: {}; +>i : {} + +var j: () => {}; +>j : () => {} + +var k: Function; +>k : Function +>Function : Function + +var l: (x: number) => string; +>l : (x: number) => string +>x : number + +var m: number[]; +>m : number[] + +var n: { foo: string }; +>n : { foo: string; } +>foo : string + +var o: (x: T) => T; +>o : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +var p: Number; +>p : Number +>Number : Number + +var q: String; +>q : String +>String : String + +a = b; +>a = b : number +>a : any +>b : number + +a = c; +>a = c : string +>a : any +>c : string + +a = d; +>a = d : boolean +>a : any +>d : boolean + +a = e; +>a = e : Date +>a : any +>e : Date + +a = f; +>a = f : any +>a : any +>f : any + +a = g; +>a = g : void +>a : any +>g : void + +a = h; +>a = h : Object +>a : any +>h : Object + +a = i; +>a = i : {} +>a : any +>i : {} + +a = j; +>a = j : () => {} +>a : any +>j : () => {} + +a = k; +>a = k : Function +>a : any +>k : Function + +a = l; +>a = l : (x: number) => string +>a : any +>l : (x: number) => string + +a = m; +>a = m : number[] +>a : any +>m : number[] + +a = o; +>a = o : (x: T) => T +>a : any +>o : (x: T) => T + +a = p; +>a = p : Number +>a : any +>p : Number + +a = q; +>a = q : String +>a : any +>q : String + +a = ac; +>a = ac : C +>a : any +>ac : C + +a = ai; +>a = ai : I +>a : any +>ai : I + +a = ae; +>a = ae : E +>a : any +>ae : E + +function foo(x: T, y: U, z: V) { +>foo : (x: T, y: U, z: V) => void +>T : T +>U : U +>V : V +>Date : Date +>x : T +>T : T +>y : U +>U : U +>z : V +>V : V + + a = x; +>a = x : T +>a : any +>x : T + + a = y; +>a = y : U +>a : any +>y : U + + a = z; +>a = z : V +>a : any +>z : V +} +//function foo(x: T, y: U, z: V) { +// a = x; +// a = y; +// a = z; +//} diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.types b/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.types new file mode 100644 index 00000000000..5674dd0cd0d --- /dev/null +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.types @@ -0,0 +1,156 @@ +=== tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInitializer.ts === +interface I { +>I : I + + id: number; +>id : number +} + +class C implements I { +>C : C +>I : I + + id: number; +>id : number +} + +class D{ +>D : D +>T : T + + source: T; +>source : T +>T : T + + recurse: D; +>recurse : D +>D : D +>T : T + + wrapped: D> +>wrapped : D> +>D : D +>D : D +>T : T +} + +function F(x: string): number { return 42; } +>F : (x: string) => number +>x : string + +module M { +>M : typeof M + + export class A { +>A : A + + name: string; +>name : string + } + + export function F2(x: number): string { return x.toString(); } +>F2 : (x: number) => string +>x : number +>x.toString() : string +>x.toString : (radix?: number) => string +>x : number +>toString : (radix?: number) => string +} + +var aNumber: number = 9.9; +>aNumber : number + +var aString: string = 'this is a string'; +>aString : string + +var aDate: Date = new Date(12); +>aDate : Date +>Date : Date +>new Date(12) : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } + +var anObject: Object = new Object(); +>anObject : Object +>Object : Object +>new Object() : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } + +var anAny: any = null; +>anAny : any + +var aSecondAny: any = undefined; +>aSecondAny : any +>undefined : undefined + +var aVoid: void = undefined; +>aVoid : void +>undefined : undefined + +var anInterface: I = new C(); +>anInterface : I +>I : I +>new C() : C +>C : typeof C + +var aClass: C = new C(); +>aClass : C +>C : C +>new C() : C +>C : typeof C + +var aGenericClass: D = new D(); +>aGenericClass : D +>D : D +>new D() : D +>D : typeof D + +var anObjectLiteral: I = { id: 12 }; +>anObjectLiteral : I +>I : I +>{ id: 12 } : { id: number; } +>id : number + +var anOtherObjectLiteral: { id: number } = new C(); +>anOtherObjectLiteral : { id: number; } +>id : number +>new C() : C +>C : typeof C + +var aFunction: typeof F = F; +>aFunction : (x: string) => number +>F : (x: string) => number +>F : (x: string) => number + +var anOtherFunction: (x: string) => number = F; +>anOtherFunction : (x: string) => number +>x : string +>F : (x: string) => number + +var aLambda: typeof F = (x) => 2; +>aLambda : (x: string) => number +>F : (x: string) => number +>(x) => 2 : (x: string) => number +>x : string + +var aModule: typeof M = M; +>aModule : typeof M +>M : typeof M +>M : typeof M + +var aClassInModule: M.A = new M.A(); +>aClassInModule : A +>M : M +>A : A +>new M.A() : A +>M.A : typeof A +>M : typeof M +>A : typeof A + +var aFunctionInModule: typeof M.F2 = (x) => 'this is a string'; +>aFunctionInModule : (x: number) => string +>M : typeof M +>F2 : (x: number) => string +>(x) => 'this is a string' : (x: number) => string +>x : number + + diff --git a/tests/baselines/reference/everyTypeWithInitializer.types b/tests/baselines/reference/everyTypeWithInitializer.types new file mode 100644 index 00000000000..238335f8795 --- /dev/null +++ b/tests/baselines/reference/everyTypeWithInitializer.types @@ -0,0 +1,135 @@ +=== tests/cases/conformance/statements/VariableStatements/everyTypeWithInitializer.ts === +interface I { +>I : I + + id: number; +>id : number +} + +class C implements I { +>C : C +>I : I + + id: number; +>id : number +} + +class D{ +>D : D +>T : T + + source: T; +>source : T +>T : T + + recurse: D; +>recurse : D +>D : D +>T : T + + wrapped: D> +>wrapped : D> +>D : D +>D : D +>T : T +} + +function F(x: string): number { return 42; } +>F : (x: string) => number +>x : string + +module M { +>M : typeof M + + export class A { +>A : A + + name: string; +>name : string + } + + export function F2(x: number): string { return x.toString(); } +>F2 : (x: number) => string +>x : number +>x.toString() : string +>x.toString : (radix?: number) => string +>x : number +>toString : (radix?: number) => string +} + +var aNumber = 9.9; +>aNumber : number + +var aString = 'this is a string'; +>aString : string + +var aDate = new Date(12); +>aDate : Date +>new Date(12) : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } + +var anObject = new Object(); +>anObject : Object +>new Object() : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } + +var anAny = null; +>anAny : any + +var anOtherAny = new C(); +>anOtherAny : any +> new C() : any +>new C() : C +>C : typeof C + +var anUndefined = undefined; +>anUndefined : any +>undefined : undefined + + +var aClass = new C(); +>aClass : C +>new C() : C +>C : typeof C + +var aGenericClass = new D(); +>aGenericClass : D +>new D() : D +>D : typeof D + +var anObjectLiteral = { id: 12 }; +>anObjectLiteral : { id: number; } +>{ id: 12 } : { id: number; } +>id : number + +var aFunction = F; +>aFunction : (x: string) => number +>F : (x: string) => number + +var aLambda = (x) => 2; +>aLambda : (x: any) => number +>(x) => 2 : (x: any) => number +>x : any + +var aModule = M; +>aModule : typeof M +>M : typeof M + +var aClassInModule = new M.A(); +>aClassInModule : A +>new M.A() : A +>M.A : typeof A +>M : typeof M +>A : typeof A + +var aFunctionInModule = M.F2; +>aFunctionInModule : (x: number) => string +>M.F2 : (x: number) => string +>M : typeof M +>F2 : (x: number) => string + +// no initializer or annotation, so this is an 'any' +var x; +>x : any + + diff --git a/tests/baselines/reference/exportAssignClassAndModule.types b/tests/baselines/reference/exportAssignClassAndModule.types new file mode 100644 index 00000000000..97289bc09d6 --- /dev/null +++ b/tests/baselines/reference/exportAssignClassAndModule.types @@ -0,0 +1,38 @@ +=== tests/cases/compiler/exportAssignClassAndModule_1.ts === +/// +import Foo = require('exportAssignClassAndModule_0'); +>Foo : typeof Foo + +var z: Foo.Bar; +>z : Bar +>Foo : Foo +>Bar : Bar + +var zz: Foo; +>zz : Foo +>Foo : Foo + +zz.x; +>zz.x : Bar +>zz : Foo +>x : Bar + +=== tests/cases/compiler/exportAssignClassAndModule_0.ts === +class Foo { +>Foo : Foo + + x: Foo.Bar; +>x : Bar +>Foo : Foo +>Bar : Bar +} +module Foo { +>Foo : typeof Foo + + export interface Bar { +>Bar : Bar + } +} +export = Foo; +>Foo : Foo + diff --git a/tests/baselines/reference/exportAssignValueAndType.types b/tests/baselines/reference/exportAssignValueAndType.types new file mode 100644 index 00000000000..1d595bf3137 --- /dev/null +++ b/tests/baselines/reference/exportAssignValueAndType.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/exportAssignValueAndType.ts === +declare module http { +>http : http + + export interface Server { openPort: number; } +>Server : Server +>openPort : number +} + +interface server { +>server : server + + (): http.Server; +>http : http +>Server : Server + + startTime: Date; +>startTime : Date +>Date : Date +} + +var x = 5; +>x : number + +var server = new Date(); +>server : Date +>new Date() : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } + +export = server; +>server : server + + diff --git a/tests/baselines/reference/exportAssignedTypeAsTypeAnnotation.types b/tests/baselines/reference/exportAssignedTypeAsTypeAnnotation.types new file mode 100644 index 00000000000..3b96628a3cc --- /dev/null +++ b/tests/baselines/reference/exportAssignedTypeAsTypeAnnotation.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/exportAssignedTypeAsTypeAnnotation_1.ts === +/// +import test = require('exportAssignedTypeAsTypeAnnotation_0'); +>test : test + +var t2: test; // should not raise a 'container type' error +>t2 : x +>test : test + +=== tests/cases/compiler/exportAssignedTypeAsTypeAnnotation_0.ts === + +interface x { +>x : x + + (): Date; +>Date : Date + + foo: string; +>foo : string +} +export = x; +>x : x + diff --git a/tests/baselines/reference/exportAssignmentCircularModules.types b/tests/baselines/reference/exportAssignmentCircularModules.types new file mode 100644 index 00000000000..3bc8f09cc85 --- /dev/null +++ b/tests/baselines/reference/exportAssignmentCircularModules.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/externalModules/foo_2.ts === +import foo0 = require("./foo_0"); +>foo0 : typeof Foo + +module Foo { +>Foo : typeof Foo + + export var x = foo0.x; +>x : any +>foo0.x : any +>foo0 : typeof Foo +>x : any +} +export = Foo; +>Foo : typeof Foo + +=== tests/cases/conformance/externalModules/foo_0.ts === +import foo1 = require('./foo_1'); +>foo1 : typeof Foo + +module Foo { +>Foo : typeof Foo + + export var x = foo1.x; +>x : any +>foo1.x : any +>foo1 : typeof Foo +>x : any +} +export = Foo; +>Foo : typeof Foo + +=== tests/cases/conformance/externalModules/foo_1.ts === +import foo2 = require("./foo_2"); +>foo2 : typeof Foo + +module Foo { +>Foo : typeof Foo + + export var x = foo2.x; +>x : any +>foo2.x : any +>foo2 : typeof Foo +>x : any +} +export = Foo; +>Foo : typeof Foo + diff --git a/tests/baselines/reference/exportAssignmentClass.types b/tests/baselines/reference/exportAssignmentClass.types new file mode 100644 index 00000000000..03b16d0ef2f --- /dev/null +++ b/tests/baselines/reference/exportAssignmentClass.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/exportAssignmentClass_B.ts === +import D = require("exportAssignmentClass_A"); +>D : typeof C + +var d = new D(); +>d : C +>new D() : C +>D : typeof C + +var x = d.p; +>x : number +>d.p : number +>d : C +>p : number + +=== tests/cases/compiler/exportAssignmentClass_A.ts === +class C { public p = 0; } +>C : C +>p : number + +export = C; +>C : C + diff --git a/tests/baselines/reference/exportAssignmentEnum.types b/tests/baselines/reference/exportAssignmentEnum.types new file mode 100644 index 00000000000..6e258339277 --- /dev/null +++ b/tests/baselines/reference/exportAssignmentEnum.types @@ -0,0 +1,39 @@ +=== tests/cases/compiler/exportAssignmentEnum_B.ts === +import EnumE = require("exportAssignmentEnum_A"); +>EnumE : typeof E + +var a = EnumE.A; +>a : E +>EnumE.A : E +>EnumE : typeof E +>A : E + +var b = EnumE.B; +>b : E +>EnumE.B : E +>EnumE : typeof E +>B : E + +var c = EnumE.C; +>c : E +>EnumE.C : E +>EnumE : typeof E +>C : E + +=== tests/cases/compiler/exportAssignmentEnum_A.ts === +enum E { +>E : E + + A, +>A : E + + B, +>B : E + + C, +>C : E +} + +export = E; +>E : E + diff --git a/tests/baselines/reference/exportAssignmentError.types b/tests/baselines/reference/exportAssignmentError.types new file mode 100644 index 00000000000..89e7d461fb2 --- /dev/null +++ b/tests/baselines/reference/exportAssignmentError.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/exportAssignmentError.ts === +module M { +>M : typeof M + + export var x; +>x : any +} + +import M2 = M; +>M2 : typeof M +>M : typeof M + +export = M2; // should not error +>M2 : typeof M + diff --git a/tests/baselines/reference/exportAssignmentFunction.types b/tests/baselines/reference/exportAssignmentFunction.types new file mode 100644 index 00000000000..023a8c234d2 --- /dev/null +++ b/tests/baselines/reference/exportAssignmentFunction.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/exportAssignmentFunction_B.ts === +import fooFunc = require("exportAssignmentFunction_A"); +>fooFunc : () => number + +var n: number = fooFunc(); +>n : number +>fooFunc() : number +>fooFunc : () => number + +=== tests/cases/compiler/exportAssignmentFunction_A.ts === +function foo() { return 0; } +>foo : () => number + +export = foo; +>foo : () => number + diff --git a/tests/baselines/reference/exportAssignmentGenericType.types b/tests/baselines/reference/exportAssignmentGenericType.types new file mode 100644 index 00000000000..249c6d6bda0 --- /dev/null +++ b/tests/baselines/reference/exportAssignmentGenericType.types @@ -0,0 +1,27 @@ +=== tests/cases/conformance/externalModules/foo_1.ts === +import foo = require("./foo_0"); +>foo : typeof Foo + +var x = new foo(); +>x : Foo +>new foo() : Foo +>foo : typeof Foo + +var y:number = x.test; +>y : number +>x.test : number +>x : Foo +>test : number + +=== tests/cases/conformance/externalModules/foo_0.ts === +class Foo{ +>Foo : Foo +>T : T + + test: T; +>test : T +>T : T +} +export = Foo; +>Foo : Foo + diff --git a/tests/baselines/reference/exportAssignmentInterface.types b/tests/baselines/reference/exportAssignmentInterface.types new file mode 100644 index 00000000000..29c27090132 --- /dev/null +++ b/tests/baselines/reference/exportAssignmentInterface.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/exportAssignmentInterface_B.ts === +import I1 = require("exportAssignmentInterface_A"); +>I1 : I1 + +var i: I1; +>i : A +>I1 : I1 + +var n: number = i.p1; +>n : number +>i.p1 : number +>i : A +>p1 : number + +=== tests/cases/compiler/exportAssignmentInterface_A.ts === +interface A { +>A : A + + p1: number; +>p1 : number +} + +export = A; +>A : A + diff --git a/tests/baselines/reference/exportAssignmentInternalModule.types b/tests/baselines/reference/exportAssignmentInternalModule.types new file mode 100644 index 00000000000..c7231cef453 --- /dev/null +++ b/tests/baselines/reference/exportAssignmentInternalModule.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/exportAssignmentInternalModule_B.ts === +import modM = require("exportAssignmentInternalModule_A"); +>modM : typeof M + +var n: number = modM.x; +>n : number +>modM.x : any +>modM : typeof M +>x : any + +=== tests/cases/compiler/exportAssignmentInternalModule_A.ts === +module M { +>M : typeof M + + export var x; +>x : any +} + +export = M; +>M : typeof M + diff --git a/tests/baselines/reference/exportAssignmentMergedInterface.types b/tests/baselines/reference/exportAssignmentMergedInterface.types new file mode 100644 index 00000000000..033bc26f98e --- /dev/null +++ b/tests/baselines/reference/exportAssignmentMergedInterface.types @@ -0,0 +1,69 @@ +=== tests/cases/conformance/externalModules/foo_1.ts === +import foo = require("./foo_0"); +>foo : foo + +var x: foo; +>x : Foo +>foo : foo + +x("test"); +>x("test") : void +>x : Foo + +x(42); +>x(42) : number +>x : Foo + +var y: string = x.b; +>y : string +>x.b : string +>x : Foo +>b : string + +if(!!x.c){ } +>!!x.c : boolean +>!x.c : boolean +>x.c : boolean +>x : Foo +>c : boolean + +var z = {x: 1, y: 2}; +>z : { x: number; y: number; } +>{x: 1, y: 2} : { x: number; y: number; } +>x : number +>y : number + +z = x.d; +>z = x.d : { x: number; y: number; } +>z : { x: number; y: number; } +>x.d : { x: number; y: number; } +>x : Foo +>d : { x: number; y: number; } + +=== tests/cases/conformance/externalModules/foo_0.ts === +interface Foo { +>Foo : Foo + + (a: string): void; +>a : string + + b: string; +>b : string +} +interface Foo { +>Foo : Foo + + (a: number): number; +>a : number + + c: boolean; +>c : boolean + + d: {x: number; y: number}; +>d : { x: number; y: number; } +>x : number +>y : number +} +export = Foo; +>Foo : Foo + diff --git a/tests/baselines/reference/exportAssignmentMergedModule.types b/tests/baselines/reference/exportAssignmentMergedModule.types new file mode 100644 index 00000000000..42dfe518d33 --- /dev/null +++ b/tests/baselines/reference/exportAssignmentMergedModule.types @@ -0,0 +1,62 @@ +=== tests/cases/conformance/externalModules/foo_1.ts === +import foo = require("./foo_0"); +>foo : typeof Foo + +var a: number = foo.a(); +>a : number +>foo.a() : number +>foo.a : () => number +>foo : typeof Foo +>a : () => number + +if(!!foo.b){ +>!!foo.b : boolean +>!foo.b : boolean +>foo.b : boolean +>foo : typeof Foo +>b : boolean + + foo.Test.answer = foo.c(42); +>foo.Test.answer = foo.c(42) : number +>foo.Test.answer : number +>foo.Test : typeof Test +>foo : typeof Foo +>Test : typeof Test +>answer : number +>foo.c(42) : number +>foo.c : (a: number) => number +>foo : typeof Foo +>c : (a: number) => number +} +=== tests/cases/conformance/externalModules/foo_0.ts === +module Foo { +>Foo : typeof Foo + + export function a(){ +>a : () => number + + return 5; + } + export var b = true; +>b : boolean +} +module Foo { +>Foo : typeof Foo + + export function c(a: number){ +>c : (a: number) => number +>a : number + + return a; +>a : number + } + export module Test { +>Test : typeof Test + + export var answer = 42; +>answer : number + } +} +export = Foo; +>Foo : typeof Foo + diff --git a/tests/baselines/reference/exportAssignmentOfGenericType1.types b/tests/baselines/reference/exportAssignmentOfGenericType1.types new file mode 100644 index 00000000000..acf68310880 --- /dev/null +++ b/tests/baselines/reference/exportAssignmentOfGenericType1.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/exportAssignmentOfGenericType1_1.ts === +/// +import q = require("exportAssignmentOfGenericType1_0"); +>q : typeof T + +class M extends q { } +>M : M +>q : q + +var m: M; +>m : M +>M : M + +var r: string = m.foo; +>r : string +>m.foo : string +>m : M +>foo : string + +=== tests/cases/compiler/exportAssignmentOfGenericType1_0.ts === +export = T; +>T : T + +class T { foo: X; } +>T : T +>X : X +>foo : X +>X : X + diff --git a/tests/baselines/reference/exportAssignmentTopLevelClodule.types b/tests/baselines/reference/exportAssignmentTopLevelClodule.types new file mode 100644 index 00000000000..7e016c7196e --- /dev/null +++ b/tests/baselines/reference/exportAssignmentTopLevelClodule.types @@ -0,0 +1,32 @@ +=== tests/cases/conformance/externalModules/foo_1.ts === +import foo = require("./foo_0"); +>foo : typeof Foo + +if(foo.answer === 42){ +>foo.answer === 42 : boolean +>foo.answer : number +>foo : typeof Foo +>answer : number + + var x = new foo(); +>x : Foo +>new foo() : Foo +>foo : typeof Foo +} + +=== tests/cases/conformance/externalModules/foo_0.ts === +class Foo { +>Foo : Foo + + test = "test"; +>test : string +} +module Foo { +>Foo : typeof Foo + + export var answer = 42; +>answer : number +} +export = Foo; +>Foo : Foo + diff --git a/tests/baselines/reference/exportAssignmentTopLevelEnumdule.types b/tests/baselines/reference/exportAssignmentTopLevelEnumdule.types new file mode 100644 index 00000000000..4ee49f6d20f --- /dev/null +++ b/tests/baselines/reference/exportAssignmentTopLevelEnumdule.types @@ -0,0 +1,41 @@ +=== tests/cases/conformance/externalModules/foo_1.ts === +import foo = require("./foo_0"); +>foo : typeof foo + +var color: foo; +>color : foo +>foo : foo + +if(color === foo.green){ +>color === foo.green : boolean +>color : foo +>foo.green : foo +>foo : typeof foo +>green : foo + + color = foo.answer; +>color = foo.answer : number +>color : foo +>foo.answer : number +>foo : typeof foo +>answer : number +} + +=== tests/cases/conformance/externalModules/foo_0.ts === +enum foo { +>foo : foo + + red, green, blue +>red : foo +>green : foo +>blue : foo +} +module foo { +>foo : typeof foo + + export var answer = 42; +>answer : number +} +export = foo; +>foo : foo + diff --git a/tests/baselines/reference/exportAssignmentTopLevelFundule.types b/tests/baselines/reference/exportAssignmentTopLevelFundule.types new file mode 100644 index 00000000000..982e87e59f3 --- /dev/null +++ b/tests/baselines/reference/exportAssignmentTopLevelFundule.types @@ -0,0 +1,31 @@ +=== tests/cases/conformance/externalModules/foo_1.ts === +import foo = require("./foo_0"); +>foo : typeof foo + +if(foo.answer === 42){ +>foo.answer === 42 : boolean +>foo.answer : number +>foo : typeof foo +>answer : number + + var x = foo(); +>x : string +>foo() : string +>foo : typeof foo +} + +=== tests/cases/conformance/externalModules/foo_0.ts === +function foo() { +>foo : typeof foo + + return "test"; +} +module foo { +>foo : typeof foo + + export var answer = 42; +>answer : number +} +export = foo; +>foo : typeof foo + diff --git a/tests/baselines/reference/exportAssignmentTopLevelIdentifier.types b/tests/baselines/reference/exportAssignmentTopLevelIdentifier.types new file mode 100644 index 00000000000..b248e35d4a3 --- /dev/null +++ b/tests/baselines/reference/exportAssignmentTopLevelIdentifier.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/externalModules/foo_1.ts === +import foo = require("./foo_0"); +>foo : typeof Foo + +if(foo.answer === 42){ +>foo.answer === 42 : boolean +>foo.answer : number +>foo : typeof Foo +>answer : number + +} + +=== tests/cases/conformance/externalModules/foo_0.ts === +module Foo { +>Foo : typeof Foo + + export var answer = 42; +>answer : number +} +export = Foo; +>Foo : typeof Foo + diff --git a/tests/baselines/reference/exportAssignmentVariable.types b/tests/baselines/reference/exportAssignmentVariable.types new file mode 100644 index 00000000000..36f02f60a95 --- /dev/null +++ b/tests/baselines/reference/exportAssignmentVariable.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/exportAssignmentVariable_B.ts === +import y = require("exportAssignmentVariable_A"); +>y : number + +var n: number = y; +>n : number +>y : number + +=== tests/cases/compiler/exportAssignmentVariable_A.ts === +var x = 0; +>x : number + +export = x; +>x : number + diff --git a/tests/baselines/reference/exportAssignmentWithImportStatementPrivacyError.types b/tests/baselines/reference/exportAssignmentWithImportStatementPrivacyError.types new file mode 100644 index 00000000000..d7749845000 --- /dev/null +++ b/tests/baselines/reference/exportAssignmentWithImportStatementPrivacyError.types @@ -0,0 +1,57 @@ +=== tests/cases/compiler/exportAssignmentWithImportStatementPrivacyError.ts === +module m2 { +>m2 : m2 + + export interface connectModule { +>connectModule : connectModule + + (res, req, next): void; +>res : any +>req : any +>next : any + } + export interface connectExport { +>connectExport : connectExport + + use: (mod: connectModule) => connectExport; +>use : (mod: connectModule) => connectExport +>mod : connectModule +>connectModule : connectModule +>connectExport : connectExport + + listen: (port: number) => void; +>listen : (port: number) => void +>port : number + } + +} + +module M { +>M : typeof M + + export var server: { +>server : { (): connectExport; test1: connectModule; test2(): connectModule; } + + (): m2.connectExport; +>m2 : m2 +>connectExport : connectExport + + test1: m2.connectModule; +>test1 : connectModule +>m2 : m2 +>connectModule : connectModule + + test2(): m2.connectModule; +>test2 : () => connectModule +>m2 : m2 +>connectModule : connectModule + + }; +} +import M22 = M; +>M22 : typeof M +>M : typeof M + +export = M; +>M : typeof M + diff --git a/tests/baselines/reference/exportAssignmentWithPrivacyError.types b/tests/baselines/reference/exportAssignmentWithPrivacyError.types new file mode 100644 index 00000000000..272849bd8c9 --- /dev/null +++ b/tests/baselines/reference/exportAssignmentWithPrivacyError.types @@ -0,0 +1,43 @@ +=== tests/cases/compiler/exportAssignmentWithPrivacyError.ts === +interface connectmodule { +>connectmodule : connectmodule + + (res, req, next): void; +>res : any +>req : any +>next : any +} +interface connectexport { +>connectexport : connectexport + + use: (mod: connectmodule) => connectexport; +>use : (mod: connectmodule) => connectexport +>mod : connectmodule +>connectmodule : connectmodule +>connectexport : connectexport + + listen: (port: number) => void; +>listen : (port: number) => void +>port : number +} + +var server: { +>server : { (): connectexport; test1: connectmodule; test2(): connectmodule; } + + (): connectexport; +>connectexport : connectexport + + test1: connectmodule; +>test1 : connectmodule +>connectmodule : connectmodule + + test2(): connectmodule; +>test2 : () => connectmodule +>connectmodule : connectmodule + +}; + +export = server; +>server : { (): connectexport; test1: connectmodule; test2(): connectmodule; } + + diff --git a/tests/baselines/reference/exportCodeGen.types b/tests/baselines/reference/exportCodeGen.types new file mode 100644 index 00000000000..89cb16fdf4c --- /dev/null +++ b/tests/baselines/reference/exportCodeGen.types @@ -0,0 +1,111 @@ +=== tests/cases/conformance/internalModules/codeGeneration/exportCodeGen.ts === + +// should replace all refs to 'x' in the body, +// with fully qualified +module A { +>A : typeof A + + export var x = 12; +>x : number + + function lt12() { +>lt12 : () => boolean + + return x < 12; +>x < 12 : boolean +>x : number + } +} + +// should not fully qualify 'x' +module B { +>B : typeof B + + var x = 12; +>x : number + + function lt12() { +>lt12 : () => boolean + + return x < 12; +>x < 12 : boolean +>x : number + } +} + +// not copied, since not exported +module C { +>C : typeof C + + function no() { +>no : () => boolean + + return false; + } +} + +// copies, since exported +module D { +>D : typeof D + + export function yes() { +>yes : () => boolean + + return true; + } +} + +// validate all exportable statements +module E { +>E : typeof E + + export enum Color { Red } +>Color : Color +>Red : Color + + export function fn() { } +>fn : () => void + + export interface I { id: number } +>I : I +>id : number + + export class C { name: string } +>C : C +>name : string + + export module M { +>M : typeof M + + export var x = 42; +>x : number + } +} + +// validate all exportable statements, +// which are not exported +module F { +>F : typeof F + + enum Color { Red } +>Color : Color +>Red : Color + + function fn() { } +>fn : () => void + + interface I { id: number } +>I : I +>id : number + + class C { name: string } +>C : C +>name : string + + module M { +>M : typeof M + + var x = 42; +>x : number + } +} diff --git a/tests/baselines/reference/exportEqualCallable.types b/tests/baselines/reference/exportEqualCallable.types new file mode 100644 index 00000000000..0a084523137 --- /dev/null +++ b/tests/baselines/reference/exportEqualCallable.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/exportEqualCallable_1.ts === +/// +import connect = require('exportEqualCallable_0'); +>connect : () => any + +connect(); +>connect() : any +>connect : () => any + +=== tests/cases/compiler/exportEqualCallable_0.ts === + +var server: { +>server : () => any + + (): any; +}; +export = server; +>server : () => any + diff --git a/tests/baselines/reference/exportEqualNamespaces.types b/tests/baselines/reference/exportEqualNamespaces.types new file mode 100644 index 00000000000..9da65466c63 --- /dev/null +++ b/tests/baselines/reference/exportEqualNamespaces.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/exportEqualNamespaces.ts === +declare module server { +>server : Date + + interface Server extends Object { } +>Server : Server +>Object : Object +} + +interface server { +>server : server + + (): server.Server; +>server : server +>Server : Server + + startTime: Date; +>startTime : Date +>Date : Date +} + +var x = 5; +>x : number + +var server = new Date(); +>server : Date +>new Date() : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } + +export = server; +>server : server + diff --git a/tests/baselines/reference/exportImport.types b/tests/baselines/reference/exportImport.types new file mode 100644 index 00000000000..4e39013d8f2 --- /dev/null +++ b/tests/baselines/reference/exportImport.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/consumer.ts === +import e = require('./exporter'); +>e : typeof "tests/cases/compiler/exporter" + +export function w(): e.w { // Should be OK +>w : () => Widget1 +>e : e +>w : w + + return new e.w(); +>new e.w() : Widget1 +>e.w : typeof Widget1 +>e : typeof "tests/cases/compiler/exporter" +>w : typeof Widget1 +} +=== tests/cases/compiler/w1.ts === + +export = Widget1 +>Widget1 : Widget1 + +class Widget1 { name = 'one'; } +>Widget1 : Widget1 +>name : string + +=== tests/cases/compiler/exporter.ts === +export import w = require('./w1'); +>w : typeof Widget1 + diff --git a/tests/baselines/reference/exportImportAlias.types b/tests/baselines/reference/exportImportAlias.types new file mode 100644 index 00000000000..02255f88391 --- /dev/null +++ b/tests/baselines/reference/exportImportAlias.types @@ -0,0 +1,175 @@ +=== tests/cases/conformance/internalModules/importDeclarations/exportImportAlias.ts === +// expect no errors here + +module A { +>A : typeof A + + export var x = 'hello world' +>x : string + + export class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + } + export module B { +>B : B + + export interface Id { +>Id : Id + + name: string; +>name : string + } + } +} + +module C { +>C : typeof C + + export import a = A; +>a : typeof A +>A : typeof A +} + +var a: string = C.a.x; +>a : string +>C.a.x : string +>C.a : typeof A +>C : typeof C +>a : typeof A +>x : string + +var b: { x: number; y: number; } = new C.a.Point(0, 0); +>b : { x: number; y: number; } +>x : number +>y : number +>new C.a.Point(0, 0) : Point +>C.a.Point : typeof Point +>C.a : typeof A +>C : typeof C +>a : typeof A +>Point : typeof Point + +var c: { name: string }; +>c : { name: string; } +>name : string + +var c: C.a.B.Id; +>c : { name: string; } +>C : C +>a : a +>B : B +>Id : Id + +module X { +>X : typeof X + + export function Y() { +>Y : typeof Y + + return 42; + } + + export module Y { +>Y : typeof Y + + export class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + } + } +} + +module Z { +>Z : typeof Z + + // 'y' should be a fundule here + export import y = X.Y; +>y : typeof Y +>X : typeof Y +>Y : typeof Y +} + +var m: number = Z.y(); +>m : number +>Z.y() : number +>Z.y : typeof Y +>Z : typeof Z +>y : typeof Y + +var n: { x: number; y: number; } = new Z.y.Point(0, 0); +>n : { x: number; y: number; } +>x : number +>y : number +>new Z.y.Point(0, 0) : Point +>Z.y.Point : typeof Point +>Z.y : typeof Y +>Z : typeof Z +>y : typeof Y +>Point : typeof Point + +module K { +>K : typeof K + + export class L { +>L : L + + constructor(public name: string) { } +>name : string + } + + export module L { +>L : typeof L + + export var y = 12; +>y : number + + export interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + } +} + +module M { +>M : typeof M + + export import D = K.L; +>D : typeof L +>K : L +>L : L +} + +var o: { name: string }; +>o : { name: string; } +>name : string + +var o = new M.D('Hello'); +>o : { name: string; } +>new M.D('Hello') : L +>M.D : typeof L +>M : typeof M +>D : typeof L + +var p: { x: number; y: number; } +>p : { x: number; y: number; } +>x : number +>y : number + +var p: M.D.Point; +>p : { x: number; y: number; } +>M : M +>D : D +>Point : Point + diff --git a/tests/baselines/reference/exportImportAndClodule.types b/tests/baselines/reference/exportImportAndClodule.types new file mode 100644 index 00000000000..b25fa31f082 --- /dev/null +++ b/tests/baselines/reference/exportImportAndClodule.types @@ -0,0 +1,57 @@ +=== tests/cases/compiler/exportImportAndClodule.ts === +module K { +>K : typeof K + + export class L { +>L : L + + constructor(public name: string) { } +>name : string + } + export module L { +>L : typeof L + + export var y = 12; +>y : number + + export interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } + } +} +module M { +>M : typeof M + + export import D = K.L; +>D : typeof L +>K : L +>L : L +} +var o: { name: string }; +>o : { name: string; } +>name : string + +var o = new M.D('Hello'); +>o : { name: string; } +>new M.D('Hello') : L +>M.D : typeof L +>M : typeof M +>D : typeof L + +var p: { x: number; y: number; } +>p : { x: number; y: number; } +>x : number +>y : number + +var p: M.D.Point; +>p : { x: number; y: number; } +>M : M +>D : D +>Point : Point + diff --git a/tests/baselines/reference/exportImportMultipleFiles.types b/tests/baselines/reference/exportImportMultipleFiles.types new file mode 100644 index 00000000000..02b17bd4101 --- /dev/null +++ b/tests/baselines/reference/exportImportMultipleFiles.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/exportImportMultipleFiles_userCode.ts === +import lib = require('./exportImportMultipleFiles_library'); +>lib : typeof "tests/cases/compiler/exportImportMultipleFiles_library" + +lib.math.add(3, 4); // Shouldnt be error +>lib.math.add(3, 4) : any +>lib.math.add : (a: any, b: any) => any +>lib.math : typeof "tests/cases/compiler/exportImportMultipleFiles_math" +>lib : typeof "tests/cases/compiler/exportImportMultipleFiles_library" +>math : typeof "tests/cases/compiler/exportImportMultipleFiles_math" +>add : (a: any, b: any) => any + +=== tests/cases/compiler/exportImportMultipleFiles_math.ts === +export function add(a, b) { return a + b; } +>add : (a: any, b: any) => any +>a : any +>b : any +>a + b : any +>a : any +>b : any + +=== tests/cases/compiler/exportImportMultipleFiles_library.ts === +export import math = require("exportImportMultipleFiles_math"); +>math : typeof "tests/cases/compiler/exportImportMultipleFiles_math" + +math.add(3, 4); // OK +>math.add(3, 4) : any +>math.add : (a: any, b: any) => any +>math : typeof "tests/cases/compiler/exportImportMultipleFiles_math" +>add : (a: any, b: any) => any + diff --git a/tests/baselines/reference/exportImportNonInstantiatedModule.types b/tests/baselines/reference/exportImportNonInstantiatedModule.types new file mode 100644 index 00000000000..e89b34a2bbf --- /dev/null +++ b/tests/baselines/reference/exportImportNonInstantiatedModule.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/exportImportNonInstantiatedModule.ts === +module A { +>A : A + + export interface I { x: number } +>I : I +>x : number +} + +module B { +>B : typeof B + + export import A1 = A +>A1 : A1 +>A : A + +} + +var x: B.A1.I = { x: 1 }; +>x : I +>B : B +>A1 : A1 +>I : I +>{ x: 1 } : { x: number; } +>x : number + diff --git a/tests/baselines/reference/exportImportNonInstantiatedModule2.types b/tests/baselines/reference/exportImportNonInstantiatedModule2.types new file mode 100644 index 00000000000..f8366883d12 --- /dev/null +++ b/tests/baselines/reference/exportImportNonInstantiatedModule2.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/consumer.ts === +import e = require('./exporter'); +>e : typeof "tests/cases/compiler/exporter" + +export function w(): e.w { // Should be OK +>w : () => Widget1 +>e : e +>w : w + + return {name: 'value' }; +>{name: 'value' } : { name: string; } +>name : string +} +=== tests/cases/compiler/w1.ts === + +export = Widget1 +>Widget1 : Widget1 + +interface Widget1 { name: string; } +>Widget1 : Widget1 +>name : string + +=== tests/cases/compiler/exporter.ts === +export import w = require('./w1'); +>w : w + diff --git a/tests/baselines/reference/exportPrivateType.types b/tests/baselines/reference/exportPrivateType.types new file mode 100644 index 00000000000..87751b273a7 --- /dev/null +++ b/tests/baselines/reference/exportPrivateType.types @@ -0,0 +1,70 @@ +=== tests/cases/compiler/exportPrivateType.ts === +module foo { +>foo : typeof foo + + class C1 { +>C1 : C1 + + x: string; +>x : string + + y: C1; +>y : C1 +>C1 : C1 + } + + class C2 { +>C2 : C2 + + test() { return true; } +>test : () => boolean + } + + interface I1 { +>I1 : I1 + + (a: string, b: string): string; +>a : string +>b : string + + (x: number, y: number): I1; +>x : number +>y : number +>I1 : I1 + } + + interface I2 { +>I2 : I2 + + x: string; +>x : string + + y: number; +>y : number + } + + // None of the types are exported, so per section 10.3, should all be errors + export var e: C1; +>e : C1 +>C1 : C1 + + export var f: I1; +>f : I1 +>I1 : I1 + + export var g: C2; +>g : C2 +>C2 : C2 + + export var h: I2; +>h : I2 +>I2 : I2 +} + +var y = foo.g; // Exported variable 'y' has or is using private type 'foo.C2'. +>y : C2 +>foo.g : C2 +>foo : typeof foo +>g : C2 + + diff --git a/tests/baselines/reference/exportVisibility.types b/tests/baselines/reference/exportVisibility.types new file mode 100644 index 00000000000..59936828275 --- /dev/null +++ b/tests/baselines/reference/exportVisibility.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/exportVisibility.ts === +export class Foo { +>Foo : Foo +} + +export var foo = new Foo(); +>foo : Foo +>new Foo() : Foo +>Foo : typeof Foo + +export function test(foo: Foo) { +>test : (foo: Foo) => boolean +>foo : Foo +>Foo : Foo + + return true; +} + diff --git a/tests/baselines/reference/exportedInterfaceInaccessibleInCallbackInModule.types b/tests/baselines/reference/exportedInterfaceInaccessibleInCallbackInModule.types new file mode 100644 index 00000000000..94124bf9e2a --- /dev/null +++ b/tests/baselines/reference/exportedInterfaceInaccessibleInCallbackInModule.types @@ -0,0 +1,42 @@ +=== tests/cases/compiler/exportedInterfaceInaccessibleInCallbackInModule.ts === +export interface ProgressCallback { +>ProgressCallback : ProgressCallback + + (progress:any):any; +>progress : any +} + +// --- Generic promise +export declare class TPromise { +>TPromise : TPromise +>V : V + + constructor(init:(complete: (value:V)=>void, error:(err:any)=>void, progress:ProgressCallback)=>void, oncancel?: any); +>init : (complete: (value: V) => void, error: (err: any) => void, progress: ProgressCallback) => void +>complete : (value: V) => void +>value : V +>V : V +>error : (err: any) => void +>err : any +>progress : ProgressCallback +>ProgressCallback : ProgressCallback +>oncancel : any + + // removing this method fixes the error squiggle..... + public then(success?: (value:V)=>TPromise, error?: (err:any)=>TPromise, progress?:ProgressCallback): TPromise; +>then : (success?: (value: V) => TPromise, error?: (err: any) => TPromise, progress?: ProgressCallback) => TPromise +>U : U +>success : (value: V) => TPromise +>value : V +>V : V +>TPromise : TPromise +>U : U +>error : (err: any) => TPromise +>err : any +>TPromise : TPromise +>U : U +>progress : ProgressCallback +>ProgressCallback : ProgressCallback +>TPromise : TPromise +>U : U +} diff --git a/tests/baselines/reference/exportedVariable1.types b/tests/baselines/reference/exportedVariable1.types new file mode 100644 index 00000000000..a02cbc5b36a --- /dev/null +++ b/tests/baselines/reference/exportedVariable1.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/exportedVariable1.ts === +export var foo = {name: "Bill"}; +>foo : { name: string; } +>{name: "Bill"} : { name: string; } +>name : string + +var upper = foo.name.toUpperCase(); +>upper : string +>foo.name.toUpperCase() : string +>foo.name.toUpperCase : () => string +>foo.name : string +>foo : { name: string; } +>name : string +>toUpperCase : () => string + diff --git a/tests/baselines/reference/extBaseClass1.types b/tests/baselines/reference/extBaseClass1.types new file mode 100644 index 00000000000..d00c6e632e3 --- /dev/null +++ b/tests/baselines/reference/extBaseClass1.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/extBaseClass1.ts === +module M { +>M : typeof M + + export class B { +>B : B + + public x=10; +>x : number + } + + export class C extends B { +>C : C +>B : B + } +} + +module M { +>M : typeof M + + export class C2 extends B { +>C2 : C2 +>B : B + } +} + +module N { +>N : typeof N + + export class C3 extends M.B { +>C3 : C3 +>M : M +>B : B + } +} + diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType.types b/tests/baselines/reference/extendAndImplementTheSameBaseType.types new file mode 100644 index 00000000000..136308b3887 --- /dev/null +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/extendAndImplementTheSameBaseType.ts === +class C { +>C : C + + foo: number +>foo : number + + bar() {} +>bar : () => void +} +class D extends C implements C { +>D : D +>C : C +>C : C + + baz() { } +>baz : () => void +} + +var c: C; +>c : C +>C : C + +var d: D = new D(); +>d : D +>D : D +>new D() : D +>D : typeof D + +d.bar(); +>d.bar() : void +>d.bar : () => void +>d : D +>bar : () => void + +d.baz(); +>d.baz() : void +>d.baz : () => void +>d : D +>baz : () => void + +d.foo; +>d.foo : number +>d : D +>foo : number + diff --git a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.types b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.types new file mode 100644 index 00000000000..a9ad130d474 --- /dev/null +++ b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/extendBaseClassBeforeItsDeclared.ts === +class derived extends base { } +>derived : derived +>base : base + +class base { constructor (public n: number) { } } +>base : base +>n : number + diff --git a/tests/baselines/reference/extendBooleanInterface.types b/tests/baselines/reference/extendBooleanInterface.types new file mode 100644 index 00000000000..2d94680599a --- /dev/null +++ b/tests/baselines/reference/extendBooleanInterface.types @@ -0,0 +1,44 @@ +=== tests/cases/conformance/types/primitives/boolean/extendBooleanInterface.ts === +interface Boolean { +>Boolean : Boolean + + doStuff(): string; +>doStuff : () => string + + doOtherStuff(x: T): T; +>doOtherStuff : (x: T) => T +>T : T +>x : T +>T : T +>T : T +} + +var x = true; +>x : boolean + +var a: string = x.doStuff(); +>a : string +>x.doStuff() : string +>x.doStuff : () => string +>x : boolean +>doStuff : () => string + +var b: string = x.doOtherStuff('hm'); +>b : string +>x.doOtherStuff('hm') : string +>x.doOtherStuff : (x: T) => T +>x : boolean +>doOtherStuff : (x: T) => T + +var c: string = x['doStuff'](); +>c : string +>x['doStuff']() : string +>x['doStuff'] : () => string +>x : boolean + +var d: string = x['doOtherStuff']('hm'); +>d : string +>x['doOtherStuff']('hm') : string +>x['doOtherStuff'] : (x: T) => T +>x : boolean + diff --git a/tests/baselines/reference/extendNumberInterface.types b/tests/baselines/reference/extendNumberInterface.types new file mode 100644 index 00000000000..f109e05be89 --- /dev/null +++ b/tests/baselines/reference/extendNumberInterface.types @@ -0,0 +1,44 @@ +=== tests/cases/conformance/types/primitives/number/extendNumberInterface.ts === +interface Number { +>Number : Number + + doStuff(): string; +>doStuff : () => string + + doOtherStuff(x:T): T; +>doOtherStuff : (x: T) => T +>T : T +>x : T +>T : T +>T : T +} + +var x = 1; +>x : number + +var a: string = x.doStuff(); +>a : string +>x.doStuff() : string +>x.doStuff : () => string +>x : number +>doStuff : () => string + +var b: string = x.doOtherStuff('hm'); +>b : string +>x.doOtherStuff('hm') : string +>x.doOtherStuff : (x: T) => T +>x : number +>doOtherStuff : (x: T) => T + +var c: string = x['doStuff'](); +>c : string +>x['doStuff']() : string +>x['doStuff'] : () => string +>x : number + +var d: string = x['doOtherStuff']('hm'); +>d : string +>x['doOtherStuff']('hm') : string +>x['doOtherStuff'] : (x: T) => T +>x : number + diff --git a/tests/baselines/reference/extendStringInterface.types b/tests/baselines/reference/extendStringInterface.types new file mode 100644 index 00000000000..3cf9f72f5f2 --- /dev/null +++ b/tests/baselines/reference/extendStringInterface.types @@ -0,0 +1,44 @@ +=== tests/cases/conformance/types/primitives/string/extendStringInterface.ts === +interface String { +>String : String + + doStuff(): string; +>doStuff : () => string + + doOtherStuff(x:T): T; +>doOtherStuff : (x: T) => T +>T : T +>x : T +>T : T +>T : T +} + +var x = ''; +>x : string + +var a: string = x.doStuff(); +>a : string +>x.doStuff() : string +>x.doStuff : () => string +>x : string +>doStuff : () => string + +var b: string = x.doOtherStuff('hm'); +>b : string +>x.doOtherStuff('hm') : string +>x.doOtherStuff : (x: T) => T +>x : string +>doOtherStuff : (x: T) => T + +var c: string = x['doStuff'](); +>c : string +>x['doStuff']() : string +>x['doStuff'] : () => string +>x : string + +var d: string = x['doOtherStuff']('hm'); +>d : string +>x['doOtherStuff']('hm') : string +>x['doOtherStuff'] : (x: T) => T +>x : string + diff --git a/tests/baselines/reference/extendedInterfaceGenericType.types b/tests/baselines/reference/extendedInterfaceGenericType.types new file mode 100644 index 00000000000..ed2433979aa --- /dev/null +++ b/tests/baselines/reference/extendedInterfaceGenericType.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/extendedInterfaceGenericType.ts === +interface Alpha { +>Alpha : Alpha +>T : T + + takesArgOfT(arg: T): Alpha; +>takesArgOfT : (arg: T) => Alpha +>arg : T +>T : T +>Alpha : Alpha +>T : T + + makeBetaOfNumber(): Beta; +>makeBetaOfNumber : () => Beta +>Beta : Beta +} +interface Beta extends Alpha { +>Beta : Beta +>T : T +>Alpha : Alpha +>T : T +} + +var alpha: Alpha; +>alpha : Alpha +>Alpha : Alpha + +var betaOfNumber = alpha.makeBetaOfNumber(); +>betaOfNumber : Beta +>alpha.makeBetaOfNumber() : Beta +>alpha.makeBetaOfNumber : () => Beta +>alpha : Alpha +>makeBetaOfNumber : () => Beta + +betaOfNumber.takesArgOfT(5); +>betaOfNumber.takesArgOfT(5) : Alpha +>betaOfNumber.takesArgOfT : (arg: number) => Alpha +>betaOfNumber : Beta +>takesArgOfT : (arg: number) => Alpha + diff --git a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types new file mode 100644 index 00000000000..20a683c5968 --- /dev/null +++ b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types @@ -0,0 +1,83 @@ +=== tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_main.ts === +import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); +>Backbone : typeof "tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_backbone" + +import moduleA = require("extendingClassFromAliasAndUsageInIndexer_moduleA"); +>moduleA : typeof "tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_moduleA" + +import moduleB = require("extendingClassFromAliasAndUsageInIndexer_moduleB"); +>moduleB : typeof "tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_moduleB" + +interface IHasVisualizationModel { +>IHasVisualizationModel : IHasVisualizationModel + + VisualizationModel: typeof Backbone.Model; +>VisualizationModel : typeof Model +>Backbone : typeof "tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_backbone" +>Model : typeof Model +} +var moduleATyped: IHasVisualizationModel = moduleA; +>moduleATyped : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +>moduleA : typeof "tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_moduleA" + +var moduleMap: { [key: string]: IHasVisualizationModel } = { +>moduleMap : { [x: string]: IHasVisualizationModel; } +>key : string +>IHasVisualizationModel : IHasVisualizationModel +>{ + "moduleA": moduleA, + "moduleB": moduleB +} : { [x: string]: IHasVisualizationModel; "moduleA": typeof "tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_moduleA"; "moduleB": typeof "tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_moduleB"; } + + "moduleA": moduleA, +>moduleA : moduleA + + "moduleB": moduleB +>moduleB : moduleB + +}; +var moduleName: string; +>moduleName : string + +var visModel = new moduleMap[moduleName].VisualizationModel(); +>visModel : Model +>new moduleMap[moduleName].VisualizationModel() : Model +>moduleMap[moduleName].VisualizationModel : typeof Model +>moduleMap[moduleName] : IHasVisualizationModel +>moduleMap : { [x: string]: IHasVisualizationModel; } +>moduleName : string +>VisualizationModel : typeof Model + +=== tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_backbone.ts === +export class Model { +>Model : Model + + public someData: string; +>someData : string +} + +=== tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_moduleA.ts === +import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); +>Backbone : typeof "tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_backbone" + +export class VisualizationModel extends Backbone.Model { +>VisualizationModel : VisualizationModel +>Backbone : Backbone +>Model : Model + + // interesting stuff here +} + +=== tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_moduleB.ts === +import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); +>Backbone : typeof "tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_backbone" + +export class VisualizationModel extends Backbone.Model { +>VisualizationModel : VisualizationModel +>Backbone : Backbone +>Model : Model + + // different interesting stuff here +} + diff --git a/tests/baselines/reference/externFunc.types b/tests/baselines/reference/externFunc.types new file mode 100644 index 00000000000..5aac52ac125 --- /dev/null +++ b/tests/baselines/reference/externFunc.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/externFunc.ts === +declare function parseInt(s:string):number; +>parseInt : { (s: string, radix?: number): number; (s: string): number; } +>s : string + +parseInt("2"); +>parseInt("2") : number +>parseInt : { (s: string, radix?: number): number; (s: string): number; } + diff --git a/tests/baselines/reference/externModuleClobber.types b/tests/baselines/reference/externModuleClobber.types new file mode 100644 index 00000000000..ef659a37180 --- /dev/null +++ b/tests/baselines/reference/externModuleClobber.types @@ -0,0 +1,39 @@ +=== tests/cases/compiler/externModuleClobber.ts === +declare module EM { +>EM : typeof EM + + export class Position { } +>Position : Position + + export class EC { +>EC : EC + + public getPosition() : EM.Position; +>getPosition : () => Position +>EM : EM +>Position : Position + } +} + +var x:EM.Position; +>x : Position +>EM : EM +>Position : Position + +var ec:EM.EC = new EM.EC(); +>ec : EC +>EM : EM +>EC : EC +>new EM.EC() : EC +>EM.EC : typeof EC +>EM : typeof EM +>EC : typeof EC + +x = ec.getPosition(); +>x = ec.getPosition() : Position +>x : Position +>ec.getPosition() : Position +>ec.getPosition : () => Position +>ec : EC +>getPosition : () => Position + diff --git a/tests/baselines/reference/externalModuleAssignToVar.types b/tests/baselines/reference/externalModuleAssignToVar.types new file mode 100644 index 00000000000..f8479bfb490 --- /dev/null +++ b/tests/baselines/reference/externalModuleAssignToVar.types @@ -0,0 +1,64 @@ +=== tests/cases/compiler/externalModuleAssignToVar_core.ts === +/// +import ext = require('externalModuleAssignToVar_core_require'); +>ext : typeof "tests/cases/compiler/externalModuleAssignToVar_core_require" + +var y1: { C: new() => ext.C; } = ext; +>y1 : { C: new () => C; } +>C : new () => C +>ext : ext +>C : C +>ext : typeof "tests/cases/compiler/externalModuleAssignToVar_core_require" + +y1 = ext; // ok +>y1 = ext : typeof "tests/cases/compiler/externalModuleAssignToVar_core_require" +>y1 : { C: new () => C; } +>ext : typeof "tests/cases/compiler/externalModuleAssignToVar_core_require" + +import ext2 = require('externalModuleAssignToVar_core_require2'); +>ext2 : typeof C + +var y2: new() => ext2 = ext2; +>y2 : new () => C +>ext2 : ext2 +>ext2 : typeof C + +y2 = ext2; // ok +>y2 = ext2 : typeof C +>y2 : new () => C +>ext2 : typeof C + +import ext3 = require('externalModuleAssignToVar_ext'); +>ext3 : typeof D + +var y3: new () => ext3 = ext3; +>y3 : new () => D +>ext3 : ext3 +>ext3 : typeof D + +y3 = ext3; // ok +>y3 = ext3 : typeof D +>y3 : new () => D +>ext3 : typeof D + +=== tests/cases/compiler/externalModuleAssignToVar_ext.ts === +class D { foo: string; } +>D : D +>foo : string + +export = D; +>D : D + +=== tests/cases/compiler/externalModuleAssignToVar_core_require.ts === +export class C { bar: string; } +>C : C +>bar : string + +=== tests/cases/compiler/externalModuleAssignToVar_core_require2.ts === +class C { baz: string; } +>C : C +>baz : string + +export = C; +>C : C + diff --git a/tests/baselines/reference/externalModuleQualification.types b/tests/baselines/reference/externalModuleQualification.types new file mode 100644 index 00000000000..e78f2881a6b --- /dev/null +++ b/tests/baselines/reference/externalModuleQualification.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/externalModuleQualification.ts === +export var ID = "test"; +>ID : string + +export class DiffEditor { +>DiffEditor : DiffEditor +>A : A +>B : B +>C : C + + private previousDiffAction: NavigateAction; +>previousDiffAction : NavigateAction +>NavigateAction : NavigateAction + + constructor(id: string = ID) { +>id : string +>ID : string + } +} +class NavigateAction { +>NavigateAction : NavigateAction + + f(editor: DiffEditor) { +>f : (editor: DiffEditor) => void +>editor : DiffEditor +>DiffEditor : DiffEditor + } +} + diff --git a/tests/baselines/reference/externalModuleReferenceOfImportDeclarationWithExportModifier.types b/tests/baselines/reference/externalModuleReferenceOfImportDeclarationWithExportModifier.types new file mode 100644 index 00000000000..d0e60ad36ed --- /dev/null +++ b/tests/baselines/reference/externalModuleReferenceOfImportDeclarationWithExportModifier.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/externalModuleReferenceOfImportDeclarationWithExportModifier_1.ts === +export import file1 = require('externalModuleReferenceOfImportDeclarationWithExportModifier_0'); +>file1 : typeof "tests/cases/compiler/externalModuleReferenceOfImportDeclarationWithExportModifier_0" + +file1.foo(); +>file1.foo() : void +>file1.foo : () => void +>file1 : typeof "tests/cases/compiler/externalModuleReferenceOfImportDeclarationWithExportModifier_0" +>foo : () => void + +=== tests/cases/compiler/externalModuleReferenceOfImportDeclarationWithExportModifier_0.ts === +export function foo() { }; +>foo : () => void + diff --git a/tests/baselines/reference/externalModuleResolution.types b/tests/baselines/reference/externalModuleResolution.types new file mode 100644 index 00000000000..f56fb58e7cd --- /dev/null +++ b/tests/baselines/reference/externalModuleResolution.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/consumer.ts === +import x = require('./foo'); +>x : typeof M2 + +x.Y // .ts should be picked +>x.Y : number +>x : typeof M2 +>Y : number + +=== tests/cases/compiler/foo.ts === +module M2 { +>M2 : typeof M2 + + export var Y = 1; +>Y : number +} +export = M2 +>M2 : typeof M2 + diff --git a/tests/baselines/reference/externalModuleResolution2.types b/tests/baselines/reference/externalModuleResolution2.types new file mode 100644 index 00000000000..d44de272fae --- /dev/null +++ b/tests/baselines/reference/externalModuleResolution2.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/consumer.ts === +import x = require('./foo'); +>x : typeof M2 + +x.X // .ts should be picked +>x.X : number +>x : typeof M2 +>X : number + +=== tests/cases/compiler/foo.ts === +module M2 { +>M2 : typeof M2 + + export var X = 1; +>X : number +} +export = M2 +>M2 : typeof M2 + diff --git a/tests/baselines/reference/fatArrowSelf.types b/tests/baselines/reference/fatArrowSelf.types new file mode 100644 index 00000000000..19d0b2d61b0 --- /dev/null +++ b/tests/baselines/reference/fatArrowSelf.types @@ -0,0 +1,64 @@ +=== tests/cases/compiler/fatArrowSelf.ts === +module Events { +>Events : typeof Events + + export interface ListenerCallback { +>ListenerCallback : ListenerCallback + + (value:any):void; +>value : any + } + export class EventEmitter { +>EventEmitter : EventEmitter + + public addListener(type:string, listener:ListenerCallback) { +>addListener : (type: string, listener: ListenerCallback) => void +>type : string +>listener : ListenerCallback +>ListenerCallback : ListenerCallback + } + } +} + +module Consumer { +>Consumer : typeof Consumer + + class EventEmitterConsummer { +>EventEmitterConsummer : EventEmitterConsummer + + constructor (private emitter: Events.EventEmitter) { } +>emitter : EventEmitter +>Events : Events +>EventEmitter : EventEmitter + + private register() { +>register : () => void + + this.emitter.addListener('change', (e) => { +>this.emitter.addListener('change', (e) => { + this.changed(); + }) : void +>this.emitter.addListener : (type: string, listener: ListenerCallback) => void +>this.emitter : EventEmitter +>this : EventEmitterConsummer +>emitter : EventEmitter +>addListener : (type: string, listener: ListenerCallback) => void +>(e) => { + this.changed(); + } : (e: any) => void +>e : any + + this.changed(); +>this.changed() : void +>this.changed : () => void +>this : EventEmitterConsummer +>changed : () => void + + }); + } + + private changed() { +>changed : () => void + } + } +} diff --git a/tests/baselines/reference/fatArrowfunctionAsType.types b/tests/baselines/reference/fatArrowfunctionAsType.types new file mode 100644 index 00000000000..31f8c128611 --- /dev/null +++ b/tests/baselines/reference/fatArrowfunctionAsType.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/fatArrowfunctionAsType.ts === +declare var b: (x: T) => void ; +>b : (x: T) => void +>T : T +>x : T +>T : T + +var c: (x: T) => void = function (x: T) { return 42; } +>c : (x: T) => void +>T : T +>x : T +>T : T +>function (x: T) { return 42; } : (x: T) => number +>T : T +>x : T +>T : T + +b = c; +>b = c : (x: T) => void +>b : (x: T) => void +>c : (x: T) => void + diff --git a/tests/baselines/reference/fatarrowfunctions.types b/tests/baselines/reference/fatarrowfunctions.types new file mode 100644 index 00000000000..5863436ef4e --- /dev/null +++ b/tests/baselines/reference/fatarrowfunctions.types @@ -0,0 +1,246 @@ +=== tests/cases/compiler/fatarrowfunctions.ts === + +function foo(x:any) { +>foo : (x: any) => any +>x : any + + return x(); +>x() : any +>x : any +} + + +foo((x:number,y,z)=>{return x+y+z;}); +>foo((x:number,y,z)=>{return x+y+z;}) : any +>foo : (x: any) => any +>(x:number,y,z)=>{return x+y+z;} : (x: number, y: any, z: any) => any +>x : number +>y : any +>z : any +>x+y+z : any +>x+y : any +>x : number +>y : any +>z : any + +foo((x,y,z)=>{return x+y+z;}); +>foo((x,y,z)=>{return x+y+z;}) : any +>foo : (x: any) => any +>(x,y,z)=>{return x+y+z;} : (x: any, y: any, z: any) => any +>x : any +>y : any +>z : any +>x+y+z : any +>x+y : any +>x : any +>y : any +>z : any + +foo((x,y:number,z)=>{return x+y+z;}); +>foo((x,y:number,z)=>{return x+y+z;}) : any +>foo : (x: any) => any +>(x,y:number,z)=>{return x+y+z;} : (x: any, y: number, z: any) => any +>x : any +>y : number +>z : any +>x+y+z : any +>x+y : any +>x : any +>y : number +>z : any + +foo((x,y:number,z:number)=>{return x+y+z;}); +>foo((x,y:number,z:number)=>{return x+y+z;}) : any +>foo : (x: any) => any +>(x,y:number,z:number)=>{return x+y+z;} : (x: any, y: number, z: number) => any +>x : any +>y : number +>z : number +>x+y+z : any +>x+y : any +>x : any +>y : number +>z : number + +foo((x,y,z:number)=>{return x+y+z;}); +>foo((x,y,z:number)=>{return x+y+z;}) : any +>foo : (x: any) => any +>(x,y,z:number)=>{return x+y+z;} : (x: any, y: any, z: number) => any +>x : any +>y : any +>z : number +>x+y+z : any +>x+y : any +>x : any +>y : any +>z : number + +foo(()=>{return 0;}); +>foo(()=>{return 0;}) : any +>foo : (x: any) => any +>()=>{return 0;} : () => number + +foo((x:number,y,z)=>x+y+z); +>foo((x:number,y,z)=>x+y+z) : any +>foo : (x: any) => any +>(x:number,y,z)=>x+y+z : (x: number, y: any, z: any) => any +>x : number +>y : any +>z : any +>x+y+z : any +>x+y : any +>x : number +>y : any +>z : any + +foo((x,y,z)=>x+y+z); +>foo((x,y,z)=>x+y+z) : any +>foo : (x: any) => any +>(x,y,z)=>x+y+z : (x: any, y: any, z: any) => any +>x : any +>y : any +>z : any +>x+y+z : any +>x+y : any +>x : any +>y : any +>z : any + +foo((x,y:number,z)=>{return x+y+z;}); +>foo((x,y:number,z)=>{return x+y+z;}) : any +>foo : (x: any) => any +>(x,y:number,z)=>{return x+y+z;} : (x: any, y: number, z: any) => any +>x : any +>y : number +>z : any +>x+y+z : any +>x+y : any +>x : any +>y : number +>z : any + +foo((x,y:number,z:number)=>{return x+y+z;}); +>foo((x,y:number,z:number)=>{return x+y+z;}) : any +>foo : (x: any) => any +>(x,y:number,z:number)=>{return x+y+z;} : (x: any, y: number, z: number) => any +>x : any +>y : number +>z : number +>x+y+z : any +>x+y : any +>x : any +>y : number +>z : number + +foo((x,y,z:number)=>{return x+y+z;}); +>foo((x,y,z:number)=>{return x+y+z;}) : any +>foo : (x: any) => any +>(x,y,z:number)=>{return x+y+z;} : (x: any, y: any, z: number) => any +>x : any +>y : any +>z : number +>x+y+z : any +>x+y : any +>x : any +>y : any +>z : number + +foo(()=>{return 0;}); +>foo(()=>{return 0;}) : any +>foo : (x: any) => any +>()=>{return 0;} : () => number + + +foo(((x) => x)); +>foo(((x) => x)) : any +>foo : (x: any) => any +>((x) => x) : (x: any) => any +>(x) => x : (x: any) => any +>x : any +>x : any + +foo(x => x*x); +>foo(x => x*x) : any +>foo : (x: any) => any +>x => x*x : (x: any) => number +>x : any +>x*x : number +>x : any +>x : any + +var y = x => x*x; +>y : (x: any) => number +>x => x*x : (x: any) => number +>x : any +>x*x : number +>x : any +>x : any + +var z = (x:number) => x*x; +>z : (x: number) => number +>(x:number) => x*x : (x: number) => number +>x : number +>x*x : number +>x : number +>x : number + +var w = () => 3; +>w : () => number +>() => 3 : () => number + +function ternaryTest(isWhile:boolean) { +>ternaryTest : (isWhile: boolean) => void +>isWhile : boolean + + var f = isWhile ? function (n) { return n > 0; } : function (n) { return n === 0; }; +>f : (n: any) => boolean +>isWhile ? function (n) { return n > 0; } : function (n) { return n === 0; } : (n: any) => boolean +>isWhile : boolean +>function (n) { return n > 0; } : (n: any) => boolean +>n : any +>n > 0 : boolean +>n : any +>function (n) { return n === 0; } : (n: any) => boolean +>n : any +>n === 0 : boolean +>n : any + +} + +declare function setTimeout(expression: any, msec?: number, language?: any): number; +>setTimeout : (expression: any, msec?: number, language?: any) => number +>expression : any +>msec : number +>language : any + +var messenger = { +>messenger : { message: string; start: () => void; } +>{ + message: "Hello World", + start: function() { + setTimeout(() => { this.message.toString(); }, 3000); + } +} : { message: string; start: () => void; } + + message: "Hello World", +>message : string + + start: function() { +>start : () => void +>function() { + setTimeout(() => { this.message.toString(); }, 3000); + } : () => void + + setTimeout(() => { this.message.toString(); }, 3000); +>setTimeout(() => { this.message.toString(); }, 3000) : number +>setTimeout : (expression: any, msec?: number, language?: any) => number +>() => { this.message.toString(); } : () => void +>this.message.toString() : any +>this.message.toString : any +>this.message : any +>this : any +>message : any +>toString : any + } +}; + diff --git a/tests/baselines/reference/fatarrowfunctionsInFunctionParameterDefaults.types b/tests/baselines/reference/fatarrowfunctionsInFunctionParameterDefaults.types new file mode 100644 index 00000000000..cf561eb08af --- /dev/null +++ b/tests/baselines/reference/fatarrowfunctionsInFunctionParameterDefaults.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/fatarrowfunctionsInFunctionParameterDefaults.ts === +function fn(x = () => this, y = x()) { +>fn : (x?: () => any, y?: any) => any +>x : () => any +>() => this : () => any +>this : any +>y : any +>x() : any +>x : () => any + + // should be 4 + return y; +>y : any + +} + +fn.call(4); // Should be 4 +>fn.call(4) : any +>fn.call : (thisArg: any, ...argArray: any[]) => any +>fn : (x?: () => any, y?: any) => any +>call : (thisArg: any, ...argArray: any[]) => any + diff --git a/tests/baselines/reference/fatarrowfunctionsInFunctions.types b/tests/baselines/reference/fatarrowfunctionsInFunctions.types new file mode 100644 index 00000000000..f92f2ae2cb1 --- /dev/null +++ b/tests/baselines/reference/fatarrowfunctionsInFunctions.types @@ -0,0 +1,61 @@ +=== tests/cases/compiler/fatarrowfunctionsInFunctions.ts === +declare function setTimeout(expression: any, msec?: number, language?: any): number; +>setTimeout : (expression: any, msec?: number, language?: any) => number +>expression : any +>msec : number +>language : any + +var messenger = { +>messenger : { message: string; start: () => void; } +>{ + message: "Hello World", + start: function() { + var _self = this; + setTimeout(function() { + _self.message.toString(); + }, 3000); + } +} : { message: string; start: () => void; } + + message: "Hello World", +>message : string + + start: function() { +>start : () => void +>function() { + var _self = this; + setTimeout(function() { + _self.message.toString(); + }, 3000); + } : () => void + + var _self = this; +>_self : any +>this : any + + setTimeout(function() { +>setTimeout(function() { + _self.message.toString(); + }, 3000) : number +>setTimeout : (expression: any, msec?: number, language?: any) => number +>function() { + _self.message.toString(); + } : () => void + + _self.message.toString(); +>_self.message.toString() : any +>_self.message.toString : any +>_self.message : any +>_self : any +>message : any +>toString : any + + }, 3000); + } +}; +messenger.start(); +>messenger.start() : void +>messenger.start : () => void +>messenger : { message: string; start: () => void; } +>start : () => void + diff --git a/tests/baselines/reference/fileReferencesWithNoExtensions.types b/tests/baselines/reference/fileReferencesWithNoExtensions.types new file mode 100644 index 00000000000..ec58e338345 --- /dev/null +++ b/tests/baselines/reference/fileReferencesWithNoExtensions.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/t.ts === +/// +/// +/// +var a = aa; // Check that a.ts is referenced +>a : number +>aa : number + +var b = bb; // Check that b.d.ts is referenced +>b : number +>bb : number + +var c = cc; // Check that c.ts has precedence over c.d.ts +>c : number +>cc : number + +=== tests/cases/compiler/a.ts === +var aa = 1; +>aa : number + +=== tests/cases/compiler/b.d.ts === +declare var bb: number; +>bb : number + +=== tests/cases/compiler/c.ts === +var cc = 1; +>cc : number + +=== tests/cases/compiler/c.d.ts === +declare var xx: number; +>xx : number + diff --git a/tests/baselines/reference/fillInMissingTypeArgsOnConstructCalls.types b/tests/baselines/reference/fillInMissingTypeArgsOnConstructCalls.types new file mode 100644 index 00000000000..496400c8235 --- /dev/null +++ b/tests/baselines/reference/fillInMissingTypeArgsOnConstructCalls.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/fillInMissingTypeArgsOnConstructCalls.ts === +class A{ +>A : A +>T : T +>Object : Object + + list: T ; +>list : T +>T : T +} +var a = new A(); +>a : A<{}> +>new A() : A<{}> +>A : typeof A + diff --git a/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.types b/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.types new file mode 100644 index 00000000000..95214571df9 --- /dev/null +++ b/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts === +function bar(item1: T, item2: T) { } +>bar : (item1: T, item2: T) => void +>T : T +>item1 : T +>T : T +>item2 : T +>T : T + +bar(1, ""); // Should be ok +>bar(1, "") : void +>bar : (item1: T, item2: T) => void + diff --git a/tests/baselines/reference/forBreakStatements.types b/tests/baselines/reference/forBreakStatements.types new file mode 100644 index 00000000000..dafaae9cce7 --- /dev/null +++ b/tests/baselines/reference/forBreakStatements.types @@ -0,0 +1,41 @@ +=== tests/cases/conformance/statements/breakStatements/forBreakStatements.ts === +for (; ;) { + break; +} + +ONE: +for (; ;) { + break ONE; +} + +TWO: +THREE: +for (; ;) { + break THREE; +} + +FOUR: +for (; ;) { + FIVE: + for (; ;) { + break FOUR; + } +} + +for (; ;) { + SIX: + for (; ;) break SIX; +} + +SEVEN: +for (; ;) for (; ;) for (; ;) break SEVEN; + +EIGHT: +for (; ;) { + var fn = function () { } +>fn : () => void +>function () { } : () => void + + break EIGHT; +} + diff --git a/tests/baselines/reference/forContinueStatements.types b/tests/baselines/reference/forContinueStatements.types new file mode 100644 index 00000000000..60fd7115362 --- /dev/null +++ b/tests/baselines/reference/forContinueStatements.types @@ -0,0 +1,41 @@ +=== tests/cases/conformance/statements/continueStatements/forContinueStatements.ts === +for (; ;) { + continue; +} + +ONE: +for (; ;) { + continue ONE; +} + +TWO: +THREE: +for (; ;) { + continue THREE; +} + +FOUR: +for (; ;) { + FIVE: + for (; ;) { + continue FOUR; + } +} + +for (; ;) { + SIX: + for (; ;) continue SIX; +} + +SEVEN: +for (; ;) for (; ;) for (; ;) continue SEVEN; + +EIGHT: +for (; ;) { + var fn = function () { } +>fn : () => void +>function () { } : () => void + + continue EIGHT; +} + diff --git a/tests/baselines/reference/forInBreakStatements.types b/tests/baselines/reference/forInBreakStatements.types new file mode 100644 index 00000000000..8d0cf0ace3c --- /dev/null +++ b/tests/baselines/reference/forInBreakStatements.types @@ -0,0 +1,70 @@ +=== tests/cases/conformance/statements/breakStatements/forInBreakStatements.ts === +for(var x in {}) { +>x : any +>{} : {} + + break; +} + +ONE: +for(var x in {}) { +>x : any +>{} : {} + + break ONE; +} + +TWO: +THREE: +for(var x in {}) { +>x : any +>{} : {} + + break THREE; +} + +FOUR: +for(var x in {}) { +>x : any +>{} : {} + + FIVE: + for(var x in {}) { +>x : any +>{} : {} + + break FOUR; + } +} + +for(var x in {}) { +>x : any +>{} : {} + + SIX: + for(var x in {}) break SIX; +>x : any +>{} : {} +} + +SEVEN: +for (var x in {}) for (var x in {}) for (var x in {}) break SEVEN; +>x : any +>{} : {} +>x : any +>{} : {} +>x : any +>{} : {} + +EIGHT: +for (var x in {}){ +>x : any +>{} : {} + + var fn = function () { } +>fn : () => void +>function () { } : () => void + + break EIGHT; +} + diff --git a/tests/baselines/reference/forInContinueStatements.types b/tests/baselines/reference/forInContinueStatements.types new file mode 100644 index 00000000000..3751c11aaa9 --- /dev/null +++ b/tests/baselines/reference/forInContinueStatements.types @@ -0,0 +1,70 @@ +=== tests/cases/conformance/statements/continueStatements/forInContinueStatements.ts === +for(var x in {}) { +>x : any +>{} : {} + + continue; +} + +ONE: +for(var x in {}) { +>x : any +>{} : {} + + continue ONE; +} + +TWO: +THREE: +for(var x in {}) { +>x : any +>{} : {} + + continue THREE; +} + +FOUR: +for(var x in {}) { +>x : any +>{} : {} + + FIVE: + for(var x in {}) { +>x : any +>{} : {} + + continue FOUR; + } +} + +for(var x in {}) { +>x : any +>{} : {} + + SIX: + for(var x in {}) continue SIX; +>x : any +>{} : {} +} + +SEVEN: +for (var x in {}) for (var x in {}) for (var x in {}) continue SEVEN; +>x : any +>{} : {} +>x : any +>{} : {} +>x : any +>{} : {} + +EIGHT: +for (var x in {}){ +>x : any +>{} : {} + + var fn = function () { } +>fn : () => void +>function () { } : () => void + + continue EIGHT; +} + diff --git a/tests/baselines/reference/forInModule.types b/tests/baselines/reference/forInModule.types new file mode 100644 index 00000000000..7de39df3b33 --- /dev/null +++ b/tests/baselines/reference/forInModule.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/forInModule.ts === +module Foo { +>Foo : typeof Foo + + for (var i = 0; i < 1; i++) { +>i : number +>i < 1 : boolean +>i : number +>i++ : number +>i : number + + i+i; +>i+i : number +>i : number +>i : number + } +} diff --git a/tests/baselines/reference/forInStatement1.types b/tests/baselines/reference/forInStatement1.types new file mode 100644 index 00000000000..8ccacc9e2f7 --- /dev/null +++ b/tests/baselines/reference/forInStatement1.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/forInStatement1.ts === +var expr: any; +>expr : any + +for (var a in expr) { +>a : any +>expr : any +} diff --git a/tests/baselines/reference/forInStatement3.types b/tests/baselines/reference/forInStatement3.types new file mode 100644 index 00000000000..1d3803065bd --- /dev/null +++ b/tests/baselines/reference/forInStatement3.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/forInStatement3.ts === +function F() { +>F : () => void +>T : T + + var expr: T; +>expr : T +>T : T + + for (var a in expr) { +>a : any +>expr : T + } +} diff --git a/tests/baselines/reference/forInStatement5.types b/tests/baselines/reference/forInStatement5.types new file mode 100644 index 00000000000..97f894dc6bf --- /dev/null +++ b/tests/baselines/reference/forInStatement5.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/forInStatement5.ts === +var a: string; +>a : string + +var expr: any; +>expr : any + +for (a in expr) { +>a : string +>expr : any +} diff --git a/tests/baselines/reference/forInStatement6.types b/tests/baselines/reference/forInStatement6.types new file mode 100644 index 00000000000..0a882c62d8a --- /dev/null +++ b/tests/baselines/reference/forInStatement6.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/forInStatement6.ts === +var a: any; +>a : any + +var expr: any; +>expr : any + +for (a in expr) { +>a : any +>expr : any +} diff --git a/tests/baselines/reference/forStatements.types b/tests/baselines/reference/forStatements.types new file mode 100644 index 00000000000..3abee5e22f7 --- /dev/null +++ b/tests/baselines/reference/forStatements.types @@ -0,0 +1,155 @@ +=== tests/cases/conformance/statements/forStatements/forStatements.ts === +interface I { +>I : I + + id: number; +>id : number +} + +class C implements I { +>C : C +>I : I + + id: number; +>id : number +} + +class D{ +>D : D +>T : T + + source: T; +>source : T +>T : T + + recurse: D; +>recurse : D +>D : D +>T : T + + wrapped: D> +>wrapped : D> +>D : D +>D : D +>T : T +} + +function F(x: string): number { return 42; } +>F : (x: string) => number +>x : string + +module M { +>M : typeof M + + export class A { +>A : A + + name: string; +>name : string + } + + export function F2(x: number): string { return x.toString(); } +>F2 : (x: number) => string +>x : number +>x.toString() : string +>x.toString : (radix?: number) => string +>x : number +>toString : (radix?: number) => string +} + +for(var aNumber: number = 9.9;;){} +>aNumber : number + +for(var aString: string = 'this is a string';;){} +>aString : string + +for(var aDate: Date = new Date(12);;){} +>aDate : Date +>Date : Date +>new Date(12) : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } + +for(var anObject: Object = new Object();;){} +>anObject : Object +>Object : Object +>new Object() : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } + +for(var anAny: any = null;;){} +>anAny : any + +for(var aSecondAny: any = undefined;;){} +>aSecondAny : any +>undefined : undefined + +for(var aVoid: void = undefined;;){} +>aVoid : void +>undefined : undefined + +for(var anInterface: I = new C();;){} +>anInterface : I +>I : I +>new C() : C +>C : typeof C + +for(var aClass: C = new C();;){} +>aClass : C +>C : C +>new C() : C +>C : typeof C + +for(var aGenericClass: D = new D();;){} +>aGenericClass : D +>D : D +>new D() : D +>D : typeof D + +for(var anObjectLiteral: I = { id: 12 };;){} +>anObjectLiteral : I +>I : I +>{ id: 12 } : { id: number; } +>id : number + +for(var anOtherObjectLiteral: { id: number } = new C();;){} +>anOtherObjectLiteral : { id: number; } +>id : number +>new C() : C +>C : typeof C + +for(var aFunction: typeof F = F;;){} +>aFunction : (x: string) => number +>F : (x: string) => number +>F : (x: string) => number + +for(var anOtherFunction: (x: string) => number = F;;){} +>anOtherFunction : (x: string) => number +>x : string +>F : (x: string) => number + +for(var aLambda: typeof F = (x) => 2;;){} +>aLambda : (x: string) => number +>F : (x: string) => number +>(x) => 2 : (x: string) => number +>x : string + +for(var aModule: typeof M = M;;){} +>aModule : typeof M +>M : typeof M +>M : typeof M + +for(var aClassInModule: M.A = new M.A();;){} +>aClassInModule : A +>M : M +>A : A +>new M.A() : A +>M.A : typeof A +>M : typeof M +>A : typeof A + +for(var aFunctionInModule: typeof M.F2 = (x) => 'this is a string';;){} +>aFunctionInModule : (x: number) => string +>M : typeof M +>F2 : (x: number) => string +>(x) => 'this is a string' : (x: number) => string +>x : number + diff --git a/tests/baselines/reference/forStatementsMultipleValidDecl.types b/tests/baselines/reference/forStatementsMultipleValidDecl.types new file mode 100644 index 00000000000..f894eef1404 --- /dev/null +++ b/tests/baselines/reference/forStatementsMultipleValidDecl.types @@ -0,0 +1,126 @@ +=== tests/cases/conformance/statements/forStatements/forStatementsMultipleValidDecl.ts === +// all expected to be valid + +for (var x: number; ;) { } +>x : number + +for (var x = 2; ;) { } +>x : number + +for (var x = undefined; ;) { } +>x : number +>undefined : number +>undefined : undefined + +// new declaration space, making redeclaring x as a string valid +function declSpace() { +>declSpace : () => void + + for (var x = 'this is a string'; ;) { } +>x : string +} +interface Point { x: number; y: number; } +>Point : Point +>x : number +>y : number + +for (var p: Point; ;) { } +>p : Point +>Point : Point + +for (var p = { x: 1, y: 2 }; ;) { } +>p : Point +>{ x: 1, y: 2 } : { x: number; y: number; } +>x : number +>y : number + +for (var p: Point = { x: 0, y: undefined }; ;) { } +>p : Point +>Point : Point +>{ x: 0, y: undefined } : { x: number; y: undefined; } +>x : number +>y : any +>undefined : undefined + +for (var p = { x: 1, y: undefined }; ;) { } +>p : Point +>{ x: 1, y: undefined } : { x: number; y: number; } +>x : number +>y : number +>undefined : number +>undefined : undefined + +for (var p: { x: number; y: number; } = { x: 1, y: 2 }; ;) { } +>p : Point +>x : number +>y : number +>{ x: 1, y: 2 } : { x: number; y: number; } +>x : number +>y : number + +for (var p = <{ x: number; y: number; }>{ x: 0, y: undefined }; ;) { } +>p : Point +><{ x: number; y: number; }>{ x: 0, y: undefined } : { x: number; y: number; } +>x : number +>y : number +>{ x: 0, y: undefined } : { x: number; y: undefined; } +>x : number +>y : any +>undefined : undefined + +for (var p: typeof p; ;) { } +>p : Point +>p : Point + +for (var fn = function (s: string) { return 42; }; ;) { } +>fn : (s: string) => number +>function (s: string) { return 42; } : (s: string) => number +>s : string + +for (var fn = (s: string) => 3; ;) { } +>fn : (s: string) => number +>(s: string) => 3 : (s: string) => number +>s : string + +for (var fn: (s: string) => number; ;) { } +>fn : (s: string) => number +>s : string + +for (var fn: { (s: string): number }; ;) { } +>fn : (s: string) => number +>s : string + +for (var fn = <(s: string) => number> null; ;) { } +>fn : (s: string) => number +><(s: string) => number> null : (s: string) => number +>s : string + +for (var fn: typeof fn; ;) { } +>fn : (s: string) => number +>fn : (s: string) => number + +for (var a: string[]; ;) { } +>a : string[] + +for (var a = ['a', 'b']; ;) { } +>a : string[] +>['a', 'b'] : string[] + +for (var a = []; ;) { } +>a : string[] +>[] : string[] +>[] : string[] + +for (var a: string[] = []; ;) { } +>a : string[] +>[] : string[] + +for (var a = new Array(); ;) { } +>a : string[] +>new Array() : string[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } + +for (var a: typeof a; ;) { } +>a : string[] +>a : string[] + diff --git a/tests/baselines/reference/funcdecl.types b/tests/baselines/reference/funcdecl.types new file mode 100644 index 00000000000..52f73f2a06c --- /dev/null +++ b/tests/baselines/reference/funcdecl.types @@ -0,0 +1,171 @@ +=== tests/cases/compiler/funcdecl.ts === +function simpleFunc() { +>simpleFunc : () => string + + return "this is my simple func"; +} +var simpleFuncVar = simpleFunc; +>simpleFuncVar : () => string +>simpleFunc : () => string + +function anotherFuncNoReturn() { +>anotherFuncNoReturn : () => void +} +var anotherFuncNoReturnVar = anotherFuncNoReturn; +>anotherFuncNoReturnVar : () => void +>anotherFuncNoReturn : () => void + +function withReturn() : string{ +>withReturn : () => string + + return "Hello"; +} +var withReturnVar = withReturn; +>withReturnVar : () => string +>withReturn : () => string + +function withParams(a : string) : string{ +>withParams : (a: string) => string +>a : string + + return a; +>a : string +} +var withparamsVar = withParams; +>withparamsVar : (a: string) => string +>withParams : (a: string) => string + +function withMultiParams(a : number, b, c: Object) { +>withMultiParams : (a: number, b: any, c: Object) => number +>a : number +>b : any +>c : Object +>Object : Object + + return a; +>a : number +} +var withMultiParamsVar = withMultiParams; +>withMultiParamsVar : (a: number, b: any, c: Object) => number +>withMultiParams : (a: number, b: any, c: Object) => number + +function withOptionalParams(a?: string) { +>withOptionalParams : (a?: string) => void +>a : string +} +var withOptionalParamsVar = withOptionalParams; +>withOptionalParamsVar : (a?: string) => void +>withOptionalParams : (a?: string) => void + +function withInitializedParams(a: string, b0, b = 30, c = "string value") { +>withInitializedParams : (a: string, b0: any, b?: number, c?: string) => void +>a : string +>b0 : any +>b : number +>c : string +} +var withInitializedParamsVar = withInitializedParams; +>withInitializedParamsVar : (a: string, b0: any, b?: number, c?: string) => void +>withInitializedParams : (a: string, b0: any, b?: number, c?: string) => void + +function withOptionalInitializedParams(a: string, c: string = "hello string") { +>withOptionalInitializedParams : (a: string, c?: string) => void +>a : string +>c : string +} +var withOptionalInitializedParamsVar = withOptionalInitializedParams; +>withOptionalInitializedParamsVar : (a: string, c?: string) => void +>withOptionalInitializedParams : (a: string, c?: string) => void + +function withRestParams(a: string, ... myRestParameter : number[]) { +>withRestParams : (a: string, ...myRestParameter: number[]) => number[] +>a : string +>myRestParameter : number[] + + return myRestParameter; +>myRestParameter : number[] +} +var withRestParamsVar = withRestParams; +>withRestParamsVar : (a: string, ...myRestParameter: number[]) => number[] +>withRestParams : (a: string, ...myRestParameter: number[]) => number[] + +function overload1(n: number) : string; +>overload1 : { (n: number): string; (s: string): string; } +>n : number + +function overload1(s: string) : string; +>overload1 : { (n: number): string; (s: string): string; } +>s : string + +function overload1(ns: any) { +>overload1 : { (n: number): string; (s: string): string; } +>ns : any + + return ns.toString(); +>ns.toString() : any +>ns.toString : any +>ns : any +>toString : any +} +var withOverloadSignature = overload1; +>withOverloadSignature : { (n: number): string; (s: string): string; } +>overload1 : { (n: number): string; (s: string): string; } + +function f(n: () => void) { } +>f : (n: () => void) => void +>n : () => void + +module m2 { +>m2 : typeof m2 + + export function foo(n: () => void ) { +>foo : (n: () => void) => void +>n : () => void + } + +} + +m2.foo(() => { +>m2.foo(() => { + + var b = 30; + return b; +}) : void +>m2.foo : (n: () => void) => void +>m2 : typeof m2 +>foo : (n: () => void) => void +>() => { + + var b = 30; + return b; +} : () => number + + var b = 30; +>b : number + + return b; +>b : number + +}); + + +declare function fooAmbient(n: number): string; +>fooAmbient : (n: number) => string +>n : number + +declare function overloadAmbient(n: number): string; +>overloadAmbient : { (n: number): string; (s: string): string; } +>n : number + +declare function overloadAmbient(s: string): string; +>overloadAmbient : { (n: number): string; (s: string): string; } +>s : string + +var f2 = () => { +>f2 : () => string +>() => { + return "string"; +} : () => string + + return "string"; +} diff --git a/tests/baselines/reference/functionAssignmentError.types b/tests/baselines/reference/functionAssignmentError.types new file mode 100644 index 00000000000..63996db0e40 --- /dev/null +++ b/tests/baselines/reference/functionAssignmentError.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/functionAssignmentError.ts === +var func = function (){return "ONE";}; +>func : () => string +>function (){return "ONE";} : () => string + +func = function (){return "ONE";}; +>func = function (){return "ONE";} : () => string +>func : () => string +>function (){return "ONE";} : () => string + diff --git a/tests/baselines/reference/functionCall1.types b/tests/baselines/reference/functionCall1.types new file mode 100644 index 00000000000..1b06379860c --- /dev/null +++ b/tests/baselines/reference/functionCall1.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/functionCall1.ts === +function foo():any{return ""}; +>foo : () => any + +var x = foo(); +>x : any +>foo() : any +>foo : () => any + diff --git a/tests/baselines/reference/functionCall2.types b/tests/baselines/reference/functionCall2.types new file mode 100644 index 00000000000..92bb0f0be23 --- /dev/null +++ b/tests/baselines/reference/functionCall2.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/functionCall2.ts === +function foo():number{return 1}; +>foo : () => number + +var x = foo(); +>x : number +>foo() : number +>foo : () => number + diff --git a/tests/baselines/reference/functionCall3.types b/tests/baselines/reference/functionCall3.types new file mode 100644 index 00000000000..a9b8e46069c --- /dev/null +++ b/tests/baselines/reference/functionCall3.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/functionCall3.ts === +function foo():any[]{return [1];} +>foo : () => any[] +>[1] : any[] + +var x = foo(); +>x : any[] +>foo() : any[] +>foo : () => any[] + diff --git a/tests/baselines/reference/functionCall4.types b/tests/baselines/reference/functionCall4.types new file mode 100644 index 00000000000..37a0b980a00 --- /dev/null +++ b/tests/baselines/reference/functionCall4.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/functionCall4.ts === +function foo():any{return ""}; +>foo : () => any + +function bar():()=>any{return foo}; +>bar : () => () => any +>foo : () => any + +var x = bar(); +>x : () => any +>bar() : () => any +>bar : () => () => any + diff --git a/tests/baselines/reference/functionCall5.types b/tests/baselines/reference/functionCall5.types new file mode 100644 index 00000000000..2485185bb49 --- /dev/null +++ b/tests/baselines/reference/functionCall5.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/functionCall5.ts === +module m1 { export class c1 { public a; }} +>m1 : typeof m1 +>c1 : c1 +>a : any + +function foo():m1.c1{return new m1.c1();}; +>foo : () => c1 +>m1 : m1 +>c1 : c1 +>new m1.c1() : c1 +>m1.c1 : typeof c1 +>m1 : typeof m1 +>c1 : typeof c1 + +var x = foo(); +>x : c1 +>foo() : c1 +>foo : () => c1 + diff --git a/tests/baselines/reference/functionConstraintSatisfaction.types b/tests/baselines/reference/functionConstraintSatisfaction.types new file mode 100644 index 00000000000..403973c6b3c --- /dev/null +++ b/tests/baselines/reference/functionConstraintSatisfaction.types @@ -0,0 +1,256 @@ +=== tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction.ts === +// satisfaction of a constraint to Function, no errors expected + +function foo(x: T): T { return x; } +>foo : (x: T) => T +>T : T +>Function : Function +>x : T +>T : T +>T : T +>x : T + +interface I { +>I : I + + (): string; +} +var i: I; +>i : I +>I : I + +class C { +>C : C + + foo: string; +>foo : string +} + +var a: { (): string }; +>a : () => string + +var b: { new (): string }; +>b : new () => string + +var c: { (): string; (x): string }; +>c : { (): string; (x: any): string; } +>x : any + +var r = foo(new Function()); +>r : Function +>foo(new Function()) : Function +>foo : (x: T) => T +>new Function() : Function +>Function : { (...args: string[]): Function; new (...args: string[]): Function; prototype: Function; } + +var r1 = foo((x) => x); +>r1 : (x: any) => any +>foo((x) => x) : (x: any) => any +>foo : (x: T) => T +>(x) => x : (x: any) => any +>x : any +>x : any + +var r2 = foo((x: string[]) => x); +>r2 : (x: string[]) => string[] +>foo((x: string[]) => x) : (x: string[]) => string[] +>foo : (x: T) => T +>(x: string[]) => x : (x: string[]) => string[] +>x : string[] +>x : string[] + +var r3 = foo(function (x) { return x }); +>r3 : (x: any) => any +>foo(function (x) { return x }) : (x: any) => any +>foo : (x: T) => T +>function (x) { return x } : (x: any) => any +>x : any +>x : any + +var r4 = foo(function (x: string[]) { return x }); +>r4 : (x: string[]) => string[] +>foo(function (x: string[]) { return x }) : (x: string[]) => string[] +>foo : (x: T) => T +>function (x: string[]) { return x } : (x: string[]) => string[] +>x : string[] +>x : string[] + +var r5 = foo(i); +>r5 : I +>foo(i) : I +>foo : (x: T) => T +>i : I + +var r6 = foo(C); +>r6 : typeof C +>foo(C) : typeof C +>foo : (x: T) => T +>C : typeof C + +var r7 = foo(b); +>r7 : new () => string +>foo(b) : new () => string +>foo : (x: T) => T +>b : new () => string + +var r8 = foo(c); +>r8 : { (): string; (x: any): string; } +>foo(c) : { (): string; (x: any): string; } +>foo : (x: T) => T +>c : { (): string; (x: any): string; } + +interface I2 { +>I2 : I2 +>T : T + + (x: T): T; +>x : T +>T : T +>T : T +} +var i2: I2; +>i2 : I2 +>I2 : I2 + +class C2 { +>C2 : C2 +>T : T + + foo: T; +>foo : T +>T : T +} + +var a2: { (x: T): T }; +>a2 : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +var b2: { new (x: T): T }; +>b2 : new (x: T) => T +>T : T +>x : T +>T : T +>T : T + +var c2: { (x: T): T; (x: T, y: T): T }; +>c2 : { (x: T): T; (x: T, y: T): T; } +>T : T +>x : T +>T : T +>T : T +>T : T +>x : T +>T : T +>y : T +>T : T +>T : T + +var r9 = foo((x: U) => x); +>r9 : (x: U) => U +>foo((x: U) => x) : (x: U) => U +>foo : (x: T) => T +>(x: U) => x : (x: U) => U +>U : U +>x : U +>U : U +>x : U + +var r10 = foo(function (x: U) { return x; }); +>r10 : (x: U) => U +>foo(function (x: U) { return x; }) : (x: U) => U +>foo : (x: T) => T +>function (x: U) { return x; } : (x: U) => U +>U : U +>x : U +>U : U +>x : U + +var r11 = foo((x: U) => x); +>r11 : (x: U) => U +>foo((x: U) => x) : (x: U) => U +>foo : (x: T) => T +>(x: U) => x : (x: U) => U +>U : U +>Date : Date +>x : U +>U : U +>x : U + +var r12 = foo((x: U, y: V) => x); +>r12 : (x: U, y: V) => U +>foo((x: U, y: V) => x) : (x: U, y: V) => U +>foo : (x: T) => T +>(x: U, y: V) => x : (x: U, y: V) => U +>U : U +>V : V +>x : U +>U : U +>y : V +>V : V +>x : U + +var r13 = foo(i2); +>r13 : I2 +>foo(i2) : I2 +>foo : (x: T) => T +>i2 : I2 + +var r14 = foo(C2); +>r14 : typeof C2 +>foo(C2) : typeof C2 +>foo : (x: T) => T +>C2 : typeof C2 + +var r15 = foo(b2); +>r15 : new (x: T) => T +>foo(b2) : new (x: T) => T +>foo : (x: T) => T +>b2 : new (x: T) => T + +var r16 = foo(c2); +>r16 : { (x: T): T; (x: T, y: T): T; } +>foo(c2) : { (x: T): T; (x: T, y: T): T; } +>foo : (x: T) => T +>c2 : { (x: T): T; (x: T, y: T): T; } + +interface F2 extends Function { foo: string; } +>F2 : F2 +>Function : Function +>foo : string + +var f2: F2; +>f2 : F2 +>F2 : F2 + +var r17 = foo(f2); +>r17 : F2 +>foo(f2) : F2 +>foo : (x: T) => T +>f2 : F2 + +function foo2(x: T, y: U) { +>foo2 : void, U extends () => void>(x: T, y: U) => void +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U + + foo(x); +>foo(x) : T +>foo : (x: T) => T +>x : T + + foo(y); +>foo(y) : U +>foo : (x: T) => T +>y : U +} +//function foo2(x: T, y: U) { +// foo(x); +// foo(y); +//} diff --git a/tests/baselines/reference/functionConstraintSatisfaction3.types b/tests/baselines/reference/functionConstraintSatisfaction3.types new file mode 100644 index 00000000000..c2ec5e6d8a1 --- /dev/null +++ b/tests/baselines/reference/functionConstraintSatisfaction3.types @@ -0,0 +1,163 @@ +=== tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts === +// satisfaction of a constraint to Function, no errors expected + +function foo string>(x: T): T { return x; } +>foo : string>(x: T) => T +>T : T +>x : string +>x : T +>T : T +>T : T +>x : T + +interface I { +>I : I + + (): string; +} +var i: I; +>i : I +>I : I + +class C { +>C : C + + foo: string; +>foo : string +} + +var a: { (): string }; +>a : () => string + +var b: { new (): string }; +>b : new () => string + +var c: { (): string; (x): string }; +>c : { (): string; (x: any): string; } +>x : any + +var r1 = foo((x) => x); +>r1 : (x: any) => any +>foo((x) => x) : (x: any) => any +>foo : string>(x: T) => T +>(x) => x : (x: any) => any +>x : any +>x : any + +var r2 = foo((x: string) => x); +>r2 : (x: string) => string +>foo((x: string) => x) : (x: string) => string +>foo : string>(x: T) => T +>(x: string) => x : (x: string) => string +>x : string +>x : string + +var r3 = foo(function (x) { return x }); +>r3 : (x: any) => any +>foo(function (x) { return x }) : (x: any) => any +>foo : string>(x: T) => T +>function (x) { return x } : (x: any) => any +>x : any +>x : any + +var r4 = foo(function (x: string) { return x }); +>r4 : (x: string) => string +>foo(function (x: string) { return x }) : (x: string) => string +>foo : string>(x: T) => T +>function (x: string) { return x } : (x: string) => string +>x : string +>x : string + +var r5 = foo(i); +>r5 : I +>foo(i) : I +>foo : string>(x: T) => T +>i : I + +var r8 = foo(c); +>r8 : { (): string; (x: any): string; } +>foo(c) : { (): string; (x: any): string; } +>foo : string>(x: T) => T +>c : { (): string; (x: any): string; } + +interface I2 { +>I2 : I2 +>T : T + + (x: T): T; +>x : T +>T : T +>T : T +} +var i2: I2; +>i2 : I2 +>I2 : I2 + +class C2 { +>C2 : C2 +>T : T + + foo: T; +>foo : T +>T : T +} + +var a2: { (x: T): T }; +>a2 : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +var b2: { new (x: T): T }; +>b2 : new (x: T) => T +>T : T +>x : T +>T : T +>T : T + +var c2: { (x: T): T; (x: T, y: T): T }; +>c2 : { (x: T): T; (x: T, y: T): T; } +>T : T +>x : T +>T : T +>T : T +>T : T +>x : T +>T : T +>y : T +>T : T +>T : T + +var r9 = foo(function (x: U) { return x; }); +>r9 : (x: U) => U +>foo(function (x: U) { return x; }) : (x: U) => U +>foo : string>(x: T) => T +>function (x: U) { return x; } : (x: U) => U +>U : U +>x : U +>U : U +>x : U + +var r10 = foo((x: U) => x); +>r10 : (x: U) => U +>foo((x: U) => x) : (x: U) => U +>foo : string>(x: T) => T +>(x: U) => x : (x: U) => U +>U : U +>x : U +>U : U +>x : U + +var r12 = foo(i2); +>r12 : I2 +>foo(i2) : I2 +>foo : string>(x: T) => T +>i2 : I2 + +var r15 = foo(c2); +>r15 : { (x: T): T; (x: T, y: T): T; } +>foo(c2) : { (x: T): T; (x: T, y: T): T; } +>foo : string>(x: T) => T +>c2 : { (x: T): T; (x: T, y: T): T; } + diff --git a/tests/baselines/reference/functionDeclarationWithArgumentOfTypeFunctionTypeArray.types b/tests/baselines/reference/functionDeclarationWithArgumentOfTypeFunctionTypeArray.types new file mode 100644 index 00000000000..af751fbb0e9 --- /dev/null +++ b/tests/baselines/reference/functionDeclarationWithArgumentOfTypeFunctionTypeArray.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/functionDeclarationWithArgumentOfTypeFunctionTypeArray.ts === +function foo(args: { (x): number }[]) { +>foo : (args: { (x: any): number; }[]) => number +>args : { (x: any): number; }[] +>x : any + + return args.length; +>args.length : number +>args : { (x: any): number; }[] +>length : number +} + diff --git a/tests/baselines/reference/functionExpressionAndLambdaMatchesFunction.types b/tests/baselines/reference/functionExpressionAndLambdaMatchesFunction.types new file mode 100644 index 00000000000..1a8fb157032 --- /dev/null +++ b/tests/baselines/reference/functionExpressionAndLambdaMatchesFunction.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/functionExpressionAndLambdaMatchesFunction.ts === +class CDoc { +>CDoc : CDoc + + constructor() { + function doSomething(a: Function) { +>doSomething : (a: Function) => void +>a : Function +>Function : Function + } + doSomething(() => undefined); +>doSomething(() => undefined) : void +>doSomething : (a: Function) => void +>() => undefined : () => any +>undefined : undefined + + doSomething(function () { }); +>doSomething(function () { }) : void +>doSomething : (a: Function) => void +>function () { } : () => void + } +} + diff --git a/tests/baselines/reference/functionExpressionReturningItself.types b/tests/baselines/reference/functionExpressionReturningItself.types new file mode 100644 index 00000000000..fb76852369a --- /dev/null +++ b/tests/baselines/reference/functionExpressionReturningItself.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/functionExpressionReturningItself.ts === +var x = function somefn() { return somefn; }; +>x : () => typeof somefn +>function somefn() { return somefn; } : () => typeof somefn +>somefn : () => typeof somefn +>somefn : () => typeof somefn + diff --git a/tests/baselines/reference/functionImplementations.types b/tests/baselines/reference/functionImplementations.types new file mode 100644 index 00000000000..63be65e8418 --- /dev/null +++ b/tests/baselines/reference/functionImplementations.types @@ -0,0 +1,342 @@ +=== tests/cases/conformance/functions/functionImplementations.ts === +// FunctionExpression with no return type annotation and no return statement returns void +var v: void = function () { } (); +>v : void +>function () { } () : void +>function () { } : () => void + +// FunctionExpression f with no return type annotation and directly references f in its body returns any +var a: any = function f() { +>a : any +>function f() { + return f; +} : () => typeof f +>f : () => typeof f + + return f; +>f : () => typeof f + +}; +var a: any = function f() { +>a : any +>function f() { + return f(); +} : () => any +>f : () => any + + return f(); +>f() : any +>f : () => any + +}; + +// FunctionExpression f with no return type annotation and indirectly references f in its body returns any +var a: any = function f() { +>a : any +>function f() { + var x = f; + return x; +} : () => typeof f +>f : () => typeof f + + var x = f; +>x : () => typeof f +>f : () => typeof f + + return x; +>x : () => typeof f + +}; + +// Two mutually recursive function implementations with no return type annotations +function rec1() { +>rec1 : () => any + + return rec2(); +>rec2() : any +>rec2 : () => any +} +function rec2() { +>rec2 : () => any + + return rec1(); +>rec1() : any +>rec1 : () => any +} +var a = rec1(); +>a : any +>rec1() : any +>rec1 : () => any + +var a = rec2(); +>a : any +>rec2() : any +>rec2 : () => any + +// Two mutually recursive function implementations with return type annotation in one +function rec3(): number { +>rec3 : () => number + + return rec4(); +>rec4() : number +>rec4 : () => number +} +function rec4() { +>rec4 : () => number + + return rec3(); +>rec3() : number +>rec3 : () => number +} +var n: number; +>n : number + +var n = rec3(); +>n : number +>rec3() : number +>rec3 : () => number + +var n = rec4(); +>n : number +>rec4() : number +>rec4 : () => number + +// FunctionExpression with no return type annotation and returns a number +var n = function () { +>n : number +>function () { + return 3; +} () : number +>function () { + return 3; +} : () => number + + return 3; +} (); + +// FunctionExpression with no return type annotation and returns null +var nu = null; +>nu : any + +var nu = function () { +>nu : any +>function () { + return null; +} () : any +>function () { + return null; +} : () => any + + return null; +} (); + +// FunctionExpression with no return type annotation and returns undefined +var un = undefined; +>un : any +>undefined : undefined + +var un = function () { +>un : any +>function () { + return undefined; +} () : any +>function () { + return undefined; +} : () => any + + return undefined; +>undefined : undefined + +} (); + +// FunctionExpression with no return type annotation and returns a type parameter type +var n = function (x: T) { +>n : number +>function (x: T) { + return x; +} (4) : number +>function (x: T) { + return x; +} : (x: T) => T +>T : T +>x : T +>T : T + + return x; +>x : T + +} (4); + +// FunctionExpression with no return type annotation and returns a constrained type parameter type +var n = function (x: T) { +>n : number +>function (x: T) { + return x; +} (4) : number +>function (x: T) { + return x; +} : (x: T) => T +>T : T +>x : T +>T : T + + return x; +>x : T + +} (4); + +// FunctionExpression with no return type annotation with multiple return statements with identical types +var n = function () { +>n : number +>function () { + return 3; + return 5; +}() : number +>function () { + return 3; + return 5; +} : () => number + + return 3; + return 5; +}(); + +// FunctionExpression with no return type annotation with multiple return statements with subtype relation between returns +class Base { private m; } +>Base : Base +>m : any + +class Derived extends Base { private q; } +>Derived : Derived +>Base : Base +>q : any + +var b: Base; +>b : Base +>Base : Base + +var b = function () { +>b : Base +>function () { + return new Base(); return new Derived(); +} () : Base +>function () { + return new Base(); return new Derived(); +} : () => Base + + return new Base(); return new Derived(); +>new Base() : Base +>Base : typeof Base +>new Derived() : Derived +>Derived : typeof Derived + +} (); + +// FunctionExpression with no return type annotation with multiple return statements with one a recursive call +var a = function f() { +>a : any +>function f() { + return new Base(); return new Derived(); return f(); // ? +} () : any +>function f() { + return new Base(); return new Derived(); return f(); // ? +} : () => any +>f : () => any + + return new Base(); return new Derived(); return f(); // ? +>new Base() : Base +>Base : typeof Base +>new Derived() : Derived +>Derived : typeof Derived +>f() : any +>f : () => any + +} (); + +// FunctionExpression with non -void return type annotation with a single throw statement +undefined === function (): number { +>undefined === function (): number { + throw undefined; +} : boolean +>undefined : undefined +>function (): number { + throw undefined; +} : () => number + + throw undefined; +>undefined : undefined + +}; + +// Type of 'this' in function implementation is 'any' +function thisFunc() { +>thisFunc : () => void + + var x = this; +>x : any +>this : any + + var x: any; +>x : any +} + +// Function signature with optional parameter, no type annotation and initializer has initializer's type +function opt1(n = 4) { +>opt1 : (n?: number) => void +>n : number + + var m = n; +>m : number +>n : number + + var m: number; +>m : number +} + +// Function signature with optional parameter, no type annotation and initializer has initializer's widened type +function opt2(n = { x: null, y: undefined }) { +>opt2 : (n?: { x: any; y: any; }) => void +>n : { x: any; y: any; } +>{ x: null, y: undefined } : { x: null; y: undefined; } +>x : any +>y : any +>undefined : undefined + + var m = n; +>m : { x: any; y: any; } +>n : { x: any; y: any; } + + var m: { x: any; y: any }; +>m : { x: any; y: any; } +>x : any +>y : any +} + +// Function signature with initializer referencing other parameter to the left +function opt3(n: number, m = n) { +>opt3 : (n: number, m?: number) => void +>n : number +>m : number +>n : number + + var y = m; +>y : number +>m : number + + var y: number; +>y : number +} + +// Function signature with optional parameter has correct codegen +// (tested above) + +// FunctionExpression with non -void return type annotation return with no expression +function f6(): number { +>f6 : () => number + + return; +} + + + + diff --git a/tests/baselines/reference/functionInIfStatementInModule.types b/tests/baselines/reference/functionInIfStatementInModule.types new file mode 100644 index 00000000000..773fd9c4186 --- /dev/null +++ b/tests/baselines/reference/functionInIfStatementInModule.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/functionInIfStatementInModule.ts === + +module Midori +>Midori : typeof Midori +{ + if (false) { + function Foo(src) +>Foo : (src: any) => void +>src : any + { + } + } +} + diff --git a/tests/baselines/reference/functionLiteral.types b/tests/baselines/reference/functionLiteral.types new file mode 100644 index 00000000000..7a57f0b1e1b --- /dev/null +++ b/tests/baselines/reference/functionLiteral.types @@ -0,0 +1,41 @@ +=== tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteral.ts === +// basic valid forms of function literals + +var x = () => 1; +>x : () => number +>() => 1 : () => number + +var x: { +>x : () => number + + (): number; +} + +var y: { (x: string): string; }; +>y : (x: string) => string +>x : string + +var y: (x: string) => string; +>y : (x: string) => string +>x : string + +var y2: { (x: T): T; } = (x: T) => x +>y2 : (x: T) => T +>T : T +>x : T +>T : T +>T : T +>(x: T) => x : (x: T) => T +>T : T +>x : T +>T : T +>x : T + +var z: { new (x: number): number; }; +>z : new (x: number) => number +>x : number + +var z: new (x: number) => number; +>z : new (x: number) => number +>x : number + diff --git a/tests/baselines/reference/functionLiteralForOverloads.types b/tests/baselines/reference/functionLiteralForOverloads.types new file mode 100644 index 00000000000..b04238b4ce4 --- /dev/null +++ b/tests/baselines/reference/functionLiteralForOverloads.types @@ -0,0 +1,69 @@ +=== tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteralForOverloads.ts === +// basic uses of function literals with overloads + +var f: { +>f : { (x: string): string; (x: number): number; } + + (x: string): string; +>x : string + + (x: number): number; +>x : number + +} = (x) => x; +>(x) => x : (x: any) => any +>x : any +>x : any + +var f2: { +>f2 : { (x: string): string; (x: number): number; } + + (x: string): string; +>T : T +>x : string + + (x: number): number; +>T : T +>x : number + +} = (x) => x; +>(x) => x : (x: any) => any +>x : any +>x : any + +var f3: { +>f3 : { (x: T): string; (x: T): number; } + + (x: T): string; +>T : T +>x : T +>T : T + + (x: T): number; +>T : T +>x : T +>T : T + +} = (x) => x; +>(x) => x : (x: any) => any +>x : any +>x : any + +var f4: { +>f4 : { (x: string): T; (x: number): T; } + + (x: string): T; +>T : T +>x : string +>T : T + + (x: number): T; +>T : T +>x : number +>T : T + +} = (x) => x; +>(x) => x : (x: any) => any +>x : any +>x : any + diff --git a/tests/baselines/reference/functionLiteralForOverloads2.types b/tests/baselines/reference/functionLiteralForOverloads2.types new file mode 100644 index 00000000000..dfd7c526549 --- /dev/null +++ b/tests/baselines/reference/functionLiteralForOverloads2.types @@ -0,0 +1,78 @@ +=== tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteralForOverloads2.ts === +// basic uses of function literals with constructor overloads + +class C { +>C : C + + constructor(x: string); +>x : string + + constructor(x: number); +>x : number + + constructor(x) { } +>x : any +} + +class D { +>D : D +>T : T + + constructor(x: string); +>x : string + + constructor(x: number); +>x : number + + constructor(x) { } +>x : any +} + +var f: { +>f : { new (x: string): C; new (x: number): C; } + + new(x: string): C; +>x : string +>C : C + + new(x: number): C; +>x : number +>C : C + +} = C; +>C : typeof C + +var f2: { +>f2 : { new (x: string): C; new (x: number): C; } + + new(x: string): C; +>T : T +>x : string +>C : C + + new(x: number): C; +>T : T +>x : number +>C : C + +} = C; +>C : typeof C + +var f3: { +>f3 : { new (x: string): D; new (x: number): D; } + + new(x: string): D; +>T : T +>x : string +>D : D +>T : T + + new(x: number): D; +>T : T +>x : number +>D : D +>T : T + +} = D; +>D : typeof D + diff --git a/tests/baselines/reference/functionLiterals.types b/tests/baselines/reference/functionLiterals.types new file mode 100644 index 00000000000..ebafee491ed --- /dev/null +++ b/tests/baselines/reference/functionLiterals.types @@ -0,0 +1,244 @@ +=== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/functionLiterals.ts === +// PropName(ParamList):ReturnType is equivalent to PropName: { (ParamList): ReturnType } + +var b: { +>b : { func1(x: number): number; func2: (x: number) => number; func3: (x: number) => number; } + + func1(x: number): number; // Method signature +>func1 : (x: number) => number +>x : number + + func2: (x: number) => number; // Function type literal +>func2 : (x: number) => number +>x : number + + func3: { (x: number): number }; // Object type literal +>func3 : (x: number) => number +>x : number +} + +// no errors +b.func1 = b.func2; +>b.func1 = b.func2 : (x: number) => number +>b.func1 : (x: number) => number +>b : { func1(x: number): number; func2: (x: number) => number; func3: (x: number) => number; } +>func1 : (x: number) => number +>b.func2 : (x: number) => number +>b : { func1(x: number): number; func2: (x: number) => number; func3: (x: number) => number; } +>func2 : (x: number) => number + +b.func1 = b.func3; +>b.func1 = b.func3 : (x: number) => number +>b.func1 : (x: number) => number +>b : { func1(x: number): number; func2: (x: number) => number; func3: (x: number) => number; } +>func1 : (x: number) => number +>b.func3 : (x: number) => number +>b : { func1(x: number): number; func2: (x: number) => number; func3: (x: number) => number; } +>func3 : (x: number) => number + +b.func2 = b.func1; +>b.func2 = b.func1 : (x: number) => number +>b.func2 : (x: number) => number +>b : { func1(x: number): number; func2: (x: number) => number; func3: (x: number) => number; } +>func2 : (x: number) => number +>b.func1 : (x: number) => number +>b : { func1(x: number): number; func2: (x: number) => number; func3: (x: number) => number; } +>func1 : (x: number) => number + +b.func2 = b.func3; +>b.func2 = b.func3 : (x: number) => number +>b.func2 : (x: number) => number +>b : { func1(x: number): number; func2: (x: number) => number; func3: (x: number) => number; } +>func2 : (x: number) => number +>b.func3 : (x: number) => number +>b : { func1(x: number): number; func2: (x: number) => number; func3: (x: number) => number; } +>func3 : (x: number) => number + +b.func3 = b.func1; +>b.func3 = b.func1 : (x: number) => number +>b.func3 : (x: number) => number +>b : { func1(x: number): number; func2: (x: number) => number; func3: (x: number) => number; } +>func3 : (x: number) => number +>b.func1 : (x: number) => number +>b : { func1(x: number): number; func2: (x: number) => number; func3: (x: number) => number; } +>func1 : (x: number) => number + +b.func3 = b.func2; +>b.func3 = b.func2 : (x: number) => number +>b.func3 : (x: number) => number +>b : { func1(x: number): number; func2: (x: number) => number; func3: (x: number) => number; } +>func3 : (x: number) => number +>b.func2 : (x: number) => number +>b : { func1(x: number): number; func2: (x: number) => number; func3: (x: number) => number; } +>func2 : (x: number) => number + +var c: { +>c : { func4(x: number): number; func4(s: string): string; func5: { (x: number): number; (s: string): string; }; } + + func4(x: number): number; +>func4 : { (x: number): number; (s: string): string; } +>x : number + + func4(s: string): string; +>func4 : { (x: number): number; (s: string): string; } +>s : string + + func5: { +>func5 : { (x: number): number; (s: string): string; } + + (x: number): number; +>x : number + + (s: string): string; +>s : string + + }; +}; + +// no errors +c.func4 = c.func5; +>c.func4 = c.func5 : { (x: number): number; (s: string): string; } +>c.func4 : { (x: number): number; (s: string): string; } +>c : { func4(x: number): number; func4(s: string): string; func5: { (x: number): number; (s: string): string; }; } +>func4 : { (x: number): number; (s: string): string; } +>c.func5 : { (x: number): number; (s: string): string; } +>c : { func4(x: number): number; func4(s: string): string; func5: { (x: number): number; (s: string): string; }; } +>func5 : { (x: number): number; (s: string): string; } + +c.func5 = c.func4; +>c.func5 = c.func4 : { (x: number): number; (s: string): string; } +>c.func5 : { (x: number): number; (s: string): string; } +>c : { func4(x: number): number; func4(s: string): string; func5: { (x: number): number; (s: string): string; }; } +>func5 : { (x: number): number; (s: string): string; } +>c.func4 : { (x: number): number; (s: string): string; } +>c : { func4(x: number): number; func4(s: string): string; func5: { (x: number): number; (s: string): string; }; } +>func4 : { (x: number): number; (s: string): string; } + +// generic versions +var b2: { +>b2 : { func1(x: T): number; func2: (x: T) => number; func3: (x: T) => number; } + + func1(x: T): number; // Method signature +>func1 : (x: T) => number +>T : T +>x : T +>T : T + + func2: (x: T) => number; // Function type literal +>func2 : (x: T) => number +>T : T +>x : T +>T : T + + func3: { (x: T): number }; // Object type literal +>func3 : (x: T) => number +>T : T +>x : T +>T : T +} + +// no errors +b2.func1 = b2.func2; +>b2.func1 = b2.func2 : (x: T) => number +>b2.func1 : (x: T) => number +>b2 : { func1(x: T): number; func2: (x: T) => number; func3: (x: T) => number; } +>func1 : (x: T) => number +>b2.func2 : (x: T) => number +>b2 : { func1(x: T): number; func2: (x: T) => number; func3: (x: T) => number; } +>func2 : (x: T) => number + +b2.func1 = b2.func3; +>b2.func1 = b2.func3 : (x: T) => number +>b2.func1 : (x: T) => number +>b2 : { func1(x: T): number; func2: (x: T) => number; func3: (x: T) => number; } +>func1 : (x: T) => number +>b2.func3 : (x: T) => number +>b2 : { func1(x: T): number; func2: (x: T) => number; func3: (x: T) => number; } +>func3 : (x: T) => number + +b2.func2 = b2.func1; +>b2.func2 = b2.func1 : (x: T) => number +>b2.func2 : (x: T) => number +>b2 : { func1(x: T): number; func2: (x: T) => number; func3: (x: T) => number; } +>func2 : (x: T) => number +>b2.func1 : (x: T) => number +>b2 : { func1(x: T): number; func2: (x: T) => number; func3: (x: T) => number; } +>func1 : (x: T) => number + +b2.func2 = b2.func3; +>b2.func2 = b2.func3 : (x: T) => number +>b2.func2 : (x: T) => number +>b2 : { func1(x: T): number; func2: (x: T) => number; func3: (x: T) => number; } +>func2 : (x: T) => number +>b2.func3 : (x: T) => number +>b2 : { func1(x: T): number; func2: (x: T) => number; func3: (x: T) => number; } +>func3 : (x: T) => number + +b2.func3 = b2.func1; +>b2.func3 = b2.func1 : (x: T) => number +>b2.func3 : (x: T) => number +>b2 : { func1(x: T): number; func2: (x: T) => number; func3: (x: T) => number; } +>func3 : (x: T) => number +>b2.func1 : (x: T) => number +>b2 : { func1(x: T): number; func2: (x: T) => number; func3: (x: T) => number; } +>func1 : (x: T) => number + +b2.func3 = b2.func2; +>b2.func3 = b2.func2 : (x: T) => number +>b2.func3 : (x: T) => number +>b2 : { func1(x: T): number; func2: (x: T) => number; func3: (x: T) => number; } +>func3 : (x: T) => number +>b2.func2 : (x: T) => number +>b2 : { func1(x: T): number; func2: (x: T) => number; func3: (x: T) => number; } +>func2 : (x: T) => number + +var c2: { +>c2 : { func4(x: T): number; func4(s: T): string; func5: { (x: T): number; (s: T): string; }; } + + func4(x: T): number; +>func4 : { (x: T): number; (s: T): string; } +>T : T +>x : T +>T : T + + func4(s: T): string; +>func4 : { (x: T): number; (s: T): string; } +>T : T +>s : T +>T : T + + func5: { +>func5 : { (x: T): number; (s: T): string; } + + (x: T): number; +>T : T +>x : T +>T : T + + (s: T): string; +>T : T +>s : T +>T : T + + }; +}; + +// no errors +c2.func4 = c2.func5; +>c2.func4 = c2.func5 : { (x: T): number; (s: T): string; } +>c2.func4 : { (x: T): number; (s: T): string; } +>c2 : { func4(x: T): number; func4(s: T): string; func5: { (x: T): number; (s: T): string; }; } +>func4 : { (x: T): number; (s: T): string; } +>c2.func5 : { (x: T): number; (s: T): string; } +>c2 : { func4(x: T): number; func4(s: T): string; func5: { (x: T): number; (s: T): string; }; } +>func5 : { (x: T): number; (s: T): string; } + +c2.func5 = c2.func4; +>c2.func5 = c2.func4 : { (x: T): number; (s: T): string; } +>c2.func5 : { (x: T): number; (s: T): string; } +>c2 : { func4(x: T): number; func4(s: T): string; func5: { (x: T): number; (s: T): string; }; } +>func5 : { (x: T): number; (s: T): string; } +>c2.func4 : { (x: T): number; (s: T): string; } +>c2 : { func4(x: T): number; func4(s: T): string; func5: { (x: T): number; (s: T): string; }; } +>func4 : { (x: T): number; (s: T): string; } + diff --git a/tests/baselines/reference/functionMergedWithModule.types b/tests/baselines/reference/functionMergedWithModule.types new file mode 100644 index 00000000000..d0c711ab39a --- /dev/null +++ b/tests/baselines/reference/functionMergedWithModule.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/functionMergedWithModule.ts === +function foo(title: string) { +>foo : typeof foo +>title : string + + var x = 10; +>x : number +} + +module foo.Bar { +>foo : typeof foo +>Bar : typeof Bar + + export function f() { +>f : () => void + } +} + +module foo.Baz { +>foo : typeof foo +>Baz : typeof Baz + + export function g() { +>g : () => void + + Bar.f(); +>Bar.f() : void +>Bar.f : () => void +>Bar : typeof Bar +>f : () => void + } +} diff --git a/tests/baselines/reference/functionOnlyHasThrow.types b/tests/baselines/reference/functionOnlyHasThrow.types new file mode 100644 index 00000000000..0f76f4be39d --- /dev/null +++ b/tests/baselines/reference/functionOnlyHasThrow.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/functionOnlyHasThrow.ts === +function clone():number { +>clone : () => number + + throw new Error("To be implemented"); +>new Error("To be implemented") : Error +>Error : { (message?: string): Error; new (message?: string): Error; prototype: Error; } +} diff --git a/tests/baselines/reference/functionOverloads10.types b/tests/baselines/reference/functionOverloads10.types new file mode 100644 index 00000000000..8ec2bc7c589 --- /dev/null +++ b/tests/baselines/reference/functionOverloads10.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/functionOverloads10.ts === +function foo(foo:string, bar:number); +>foo : { (foo: string, bar: number): any; (foo: string): any; } +>foo : string +>bar : number + +function foo(foo:string); +>foo : { (foo: string, bar: number): any; (foo: string): any; } +>foo : string + +function foo(foo:any){ } +>foo : { (foo: string, bar: number): any; (foo: string): any; } +>foo : any + diff --git a/tests/baselines/reference/functionOverloads12.types b/tests/baselines/reference/functionOverloads12.types new file mode 100644 index 00000000000..6e4c2d9189e --- /dev/null +++ b/tests/baselines/reference/functionOverloads12.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/functionOverloads12.ts === +function foo():string; +>foo : { (): string; (): number; } + +function foo():number; +>foo : { (): string; (): number; } + +function foo():any { if (true) return ""; else return 0;} +>foo : { (): string; (): number; } + diff --git a/tests/baselines/reference/functionOverloads13.types b/tests/baselines/reference/functionOverloads13.types new file mode 100644 index 00000000000..ee65bc296e7 --- /dev/null +++ b/tests/baselines/reference/functionOverloads13.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/functionOverloads13.ts === +function foo(bar:number):string; +>foo : { (bar: number): string; (bar: number): number; } +>bar : number + +function foo(bar:number):number; +>foo : { (bar: number): string; (bar: number): number; } +>bar : number + +function foo(bar?:number):any { return "" } +>foo : { (bar: number): string; (bar: number): number; } +>bar : number + diff --git a/tests/baselines/reference/functionOverloads14.types b/tests/baselines/reference/functionOverloads14.types new file mode 100644 index 00000000000..562c43965c7 --- /dev/null +++ b/tests/baselines/reference/functionOverloads14.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/functionOverloads14.ts === +function foo():{a:number;} +>foo : { (): { a: number; }; (): { a: string; }; } +>a : number + +function foo():{a:string;} +>foo : { (): { a: number; }; (): { a: string; }; } +>a : string + +function foo():{a:any;} { return {a:1} } +>foo : { (): { a: number; }; (): { a: string; }; } +>a : any +>{a:1} : { a: number; } +>a : number + diff --git a/tests/baselines/reference/functionOverloads15.types b/tests/baselines/reference/functionOverloads15.types new file mode 100644 index 00000000000..6ca5b6709cb --- /dev/null +++ b/tests/baselines/reference/functionOverloads15.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/functionOverloads15.ts === +function foo(foo:{a:string; b:number;}):string; +>foo : { (foo: { a: string; b: number; }): string; (foo: { a: string; b: number; }): number; } +>foo : { a: string; b: number; } +>a : string +>b : number + +function foo(foo:{a:string; b:number;}):number; +>foo : { (foo: { a: string; b: number; }): string; (foo: { a: string; b: number; }): number; } +>foo : { a: string; b: number; } +>a : string +>b : number + +function foo(foo:{a:string; b?:number;}):any { return "" } +>foo : { (foo: { a: string; b: number; }): string; (foo: { a: string; b: number; }): number; } +>foo : { a: string; b?: number; } +>a : string +>b : number + diff --git a/tests/baselines/reference/functionOverloads16.types b/tests/baselines/reference/functionOverloads16.types new file mode 100644 index 00000000000..6974d0dab98 --- /dev/null +++ b/tests/baselines/reference/functionOverloads16.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/functionOverloads16.ts === +function foo(foo:{a:string;}):string; +>foo : { (foo: { a: string; }): string; (foo: { a: string; }): number; } +>foo : { a: string; } +>a : string + +function foo(foo:{a:string;}):number; +>foo : { (foo: { a: string; }): string; (foo: { a: string; }): number; } +>foo : { a: string; } +>a : string + +function foo(foo:{a:string; b?:number;}):any { return "" } +>foo : { (foo: { a: string; }): string; (foo: { a: string; }): number; } +>foo : { a: string; b?: number; } +>a : string +>b : number + diff --git a/tests/baselines/reference/functionOverloads21.types b/tests/baselines/reference/functionOverloads21.types new file mode 100644 index 00000000000..dc9e28b7b57 --- /dev/null +++ b/tests/baselines/reference/functionOverloads21.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/functionOverloads21.ts === +function foo(bar:{a:number;}[]); +>foo : { (bar: { a: number; }[]): any; (bar: { a: number; b: string; }[]): any; } +>bar : { a: number; }[] +>a : number + +function foo(bar:{a:number; b:string;}[]); +>foo : { (bar: { a: number; }[]): any; (bar: { a: number; b: string; }[]): any; } +>bar : { a: number; b: string; }[] +>a : number +>b : string + +function foo(bar:{a:any; b?:string;}[]) { return 0 } +>foo : { (bar: { a: number; }[]): any; (bar: { a: number; b: string; }[]): any; } +>bar : { a: any; b?: string; }[] +>a : any +>b : string + diff --git a/tests/baselines/reference/functionOverloads23.types b/tests/baselines/reference/functionOverloads23.types new file mode 100644 index 00000000000..40b67a78c55 --- /dev/null +++ b/tests/baselines/reference/functionOverloads23.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/functionOverloads23.ts === +function foo(bar:(b:string)=>void); +>foo : { (bar: (b: string) => void): any; (bar: (a: number) => void): any; } +>bar : (b: string) => void +>b : string + +function foo(bar:(a:number)=>void); +>foo : { (bar: (b: string) => void): any; (bar: (a: number) => void): any; } +>bar : (a: number) => void +>a : number + +function foo(bar:(a?)=>void) { return 0 } +>foo : { (bar: (b: string) => void): any; (bar: (a: number) => void): any; } +>bar : (a?: any) => void +>a : any + diff --git a/tests/baselines/reference/functionOverloads24.types b/tests/baselines/reference/functionOverloads24.types new file mode 100644 index 00000000000..f6f090d904f --- /dev/null +++ b/tests/baselines/reference/functionOverloads24.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/functionOverloads24.ts === +function foo(bar:number):(b:string)=>void; +>foo : { (bar: number): (b: string) => void; (bar: string): (a: number) => void; } +>bar : number +>b : string + +function foo(bar:string):(a:number)=>void; +>foo : { (bar: number): (b: string) => void; (bar: string): (a: number) => void; } +>bar : string +>a : number + +function foo(bar:any):(a)=>void { return function(){} } +>foo : { (bar: number): (b: string) => void; (bar: string): (a: number) => void; } +>bar : any +>a : any +>function(){} : () => void + diff --git a/tests/baselines/reference/functionOverloads25.types b/tests/baselines/reference/functionOverloads25.types new file mode 100644 index 00000000000..ace77ebc9e4 --- /dev/null +++ b/tests/baselines/reference/functionOverloads25.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/functionOverloads25.ts === +function foo():string; +>foo : { (): string; (bar: string): number; } + +function foo(bar:string):number; +>foo : { (): string; (bar: string): number; } +>bar : string + +function foo(bar?:any):any{ return '' }; +>foo : { (): string; (bar: string): number; } +>bar : any + +var x = foo(); +>x : string +>foo() : string +>foo : { (): string; (bar: string): number; } + diff --git a/tests/baselines/reference/functionOverloads26.types b/tests/baselines/reference/functionOverloads26.types new file mode 100644 index 00000000000..402003d7e7b --- /dev/null +++ b/tests/baselines/reference/functionOverloads26.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/functionOverloads26.ts === +function foo():string; +>foo : { (): string; (bar: string): number; } + +function foo(bar:string):number; +>foo : { (): string; (bar: string): number; } +>bar : string + +function foo(bar?:any):any{ return '' } +>foo : { (): string; (bar: string): number; } +>bar : any + +var x = foo('baz'); +>x : number +>foo('baz') : number +>foo : { (): string; (bar: string): number; } + diff --git a/tests/baselines/reference/functionOverloads28.types b/tests/baselines/reference/functionOverloads28.types new file mode 100644 index 00000000000..034d35c64f7 --- /dev/null +++ b/tests/baselines/reference/functionOverloads28.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/functionOverloads28.ts === +function foo():string; +>foo : { (): string; (bar: string): number; } + +function foo(bar:string):number; +>foo : { (): string; (bar: string): number; } +>bar : string + +function foo(bar?:any):any{ return '' } +>foo : { (): string; (bar: string): number; } +>bar : any + +var t:any; var x = foo(t); +>t : any +>x : number +>foo(t) : number +>foo : { (): string; (bar: string): number; } +>t : any + diff --git a/tests/baselines/reference/functionOverloads30.types b/tests/baselines/reference/functionOverloads30.types new file mode 100644 index 00000000000..80d43c952d9 --- /dev/null +++ b/tests/baselines/reference/functionOverloads30.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/functionOverloads30.ts === +function foo(bar:string):string; +>foo : { (bar: string): string; (bar: number): number; } +>bar : string + +function foo(bar:number):number; +>foo : { (bar: string): string; (bar: number): number; } +>bar : number + +function foo(bar:any):any{ return bar } +>foo : { (bar: string): string; (bar: number): number; } +>bar : any +>bar : any + +var x = foo('bar'); +>x : string +>foo('bar') : string +>foo : { (bar: string): string; (bar: number): number; } + diff --git a/tests/baselines/reference/functionOverloads31.types b/tests/baselines/reference/functionOverloads31.types new file mode 100644 index 00000000000..4d7816166bc --- /dev/null +++ b/tests/baselines/reference/functionOverloads31.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/functionOverloads31.ts === +function foo(bar:string):string; +>foo : { (bar: string): string; (bar: number): number; } +>bar : string + +function foo(bar:number):number; +>foo : { (bar: string): string; (bar: number): number; } +>bar : number + +function foo(bar:any):any{ return bar } +>foo : { (bar: string): string; (bar: number): number; } +>bar : any +>bar : any + +var x = foo(5); +>x : number +>foo(5) : number +>foo : { (bar: string): string; (bar: number): number; } + diff --git a/tests/baselines/reference/functionOverloads32.types b/tests/baselines/reference/functionOverloads32.types new file mode 100644 index 00000000000..df997e5d52a --- /dev/null +++ b/tests/baselines/reference/functionOverloads32.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/functionOverloads32.ts === +function foo(bar:string):string; +>foo : { (bar: string): string; (bar: number): number; } +>bar : string + +function foo(bar:number):number; +>foo : { (bar: string): string; (bar: number): number; } +>bar : number + +function foo(bar:any):any{ return bar } +>foo : { (bar: string): string; (bar: number): number; } +>bar : any +>bar : any + +var baz:number; var x = foo(baz); +>baz : number +>x : number +>foo(baz) : number +>foo : { (bar: string): string; (bar: number): number; } +>baz : number + diff --git a/tests/baselines/reference/functionOverloads33.types b/tests/baselines/reference/functionOverloads33.types new file mode 100644 index 00000000000..0199277180d --- /dev/null +++ b/tests/baselines/reference/functionOverloads33.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/functionOverloads33.ts === +function foo(bar:string):string; +>foo : { (bar: string): string; (bar: any): number; } +>bar : string + +function foo(bar:any):number; +>foo : { (bar: string): string; (bar: any): number; } +>bar : any + +function foo(bar:any):any{ return bar } +>foo : { (bar: string): string; (bar: any): number; } +>bar : any +>bar : any + +var x = foo(5); +>x : number +>foo(5) : number +>foo : { (bar: string): string; (bar: any): number; } + diff --git a/tests/baselines/reference/functionOverloads35.types b/tests/baselines/reference/functionOverloads35.types new file mode 100644 index 00000000000..567f9512e3d --- /dev/null +++ b/tests/baselines/reference/functionOverloads35.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/functionOverloads35.ts === +function foo(bar:{a:number;}):number; +>foo : { (bar: { a: number; }): number; (bar: { a: string; }): string; } +>bar : { a: number; } +>a : number + +function foo(bar:{a:string;}):string; +>foo : { (bar: { a: number; }): number; (bar: { a: string; }): string; } +>bar : { a: string; } +>a : string + +function foo(bar:{a:any;}):any{ return bar } +>foo : { (bar: { a: number; }): number; (bar: { a: string; }): string; } +>bar : { a: any; } +>a : any +>bar : { a: any; } + +var x = foo({a:1}); +>x : number +>foo({a:1}) : number +>foo : { (bar: { a: number; }): number; (bar: { a: string; }): string; } +>{a:1} : { a: number; } +>a : number + diff --git a/tests/baselines/reference/functionOverloads36.types b/tests/baselines/reference/functionOverloads36.types new file mode 100644 index 00000000000..8118a1c113a --- /dev/null +++ b/tests/baselines/reference/functionOverloads36.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/functionOverloads36.ts === +function foo(bar:{a:number;}):number; +>foo : { (bar: { a: number; }): number; (bar: { a: string; }): string; } +>bar : { a: number; } +>a : number + +function foo(bar:{a:string;}):string; +>foo : { (bar: { a: number; }): number; (bar: { a: string; }): string; } +>bar : { a: string; } +>a : string + +function foo(bar:{a:any;}):any{ return bar } +>foo : { (bar: { a: number; }): number; (bar: { a: string; }): string; } +>bar : { a: any; } +>a : any +>bar : { a: any; } + +var x = foo({a:'foo'}); +>x : string +>foo({a:'foo'}) : string +>foo : { (bar: { a: number; }): number; (bar: { a: string; }): string; } +>{a:'foo'} : { a: string; } +>a : string + diff --git a/tests/baselines/reference/functionOverloads38.types b/tests/baselines/reference/functionOverloads38.types new file mode 100644 index 00000000000..852191ba07f --- /dev/null +++ b/tests/baselines/reference/functionOverloads38.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/functionOverloads38.ts === +function foo(bar:{a:number;}[]):string; +>foo : { (bar: { a: number; }[]): string; (bar: { a: boolean; }[]): number; } +>bar : { a: number; }[] +>a : number + +function foo(bar:{a:boolean;}[]):number; +>foo : { (bar: { a: number; }[]): string; (bar: { a: boolean; }[]): number; } +>bar : { a: boolean; }[] +>a : boolean + +function foo(bar:{a:any;}[]):any{ return bar } +>foo : { (bar: { a: number; }[]): string; (bar: { a: boolean; }[]): number; } +>bar : { a: any; }[] +>a : any +>bar : { a: any; }[] + +var x = foo([{a:1}]); +>x : string +>foo([{a:1}]) : string +>foo : { (bar: { a: number; }[]): string; (bar: { a: boolean; }[]): number; } +>[{a:1}] : { a: number; }[] +>{a:1} : { a: number; } +>a : number + diff --git a/tests/baselines/reference/functionOverloads39.types b/tests/baselines/reference/functionOverloads39.types new file mode 100644 index 00000000000..70eee2b5163 --- /dev/null +++ b/tests/baselines/reference/functionOverloads39.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/functionOverloads39.ts === +function foo(bar:{a:number;}[]):string; +>foo : { (bar: { a: number; }[]): string; (bar: { a: boolean; }[]): number; } +>bar : { a: number; }[] +>a : number + +function foo(bar:{a:boolean;}[]):number; +>foo : { (bar: { a: number; }[]): string; (bar: { a: boolean; }[]): number; } +>bar : { a: boolean; }[] +>a : boolean + +function foo(bar:{a:any;}[]):any{ return bar } +>foo : { (bar: { a: number; }[]): string; (bar: { a: boolean; }[]): number; } +>bar : { a: any; }[] +>a : any +>bar : { a: any; }[] + +var x = foo([{a:true}]); +>x : number +>foo([{a:true}]) : number +>foo : { (bar: { a: number; }[]): string; (bar: { a: boolean; }[]): number; } +>[{a:true}] : { a: boolean; }[] +>{a:true} : { a: boolean; } +>a : boolean + diff --git a/tests/baselines/reference/functionOverloads42.types b/tests/baselines/reference/functionOverloads42.types new file mode 100644 index 00000000000..dec6a041440 --- /dev/null +++ b/tests/baselines/reference/functionOverloads42.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/functionOverloads42.ts === +function foo(bar:{a:number;}[]):string; +>foo : { (bar: { a: number; }[]): string; (bar: { a: any; }[]): number; } +>bar : { a: number; }[] +>a : number + +function foo(bar:{a:any;}[]):number; +>foo : { (bar: { a: number; }[]): string; (bar: { a: any; }[]): number; } +>bar : { a: any; }[] +>a : any + +function foo(bar:{a:any;}[]):any{ return bar } +>foo : { (bar: { a: number; }[]): string; (bar: { a: any; }[]): number; } +>bar : { a: any; }[] +>a : any +>bar : { a: any; }[] + +var x = foo([{a:'s'}]); +>x : number +>foo([{a:'s'}]) : number +>foo : { (bar: { a: number; }[]): string; (bar: { a: any; }[]): number; } +>[{a:'s'}] : { a: any; }[] +>{a:'s'} : { a: string; } +>a : string + diff --git a/tests/baselines/reference/functionOverloads6.types b/tests/baselines/reference/functionOverloads6.types new file mode 100644 index 00000000000..6e195b1ca90 --- /dev/null +++ b/tests/baselines/reference/functionOverloads6.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/functionOverloads6.ts === +class foo { +>foo : foo + + static fnOverload(); +>fnOverload : { (): any; (foo: string): any; } + + static fnOverload(foo:string); +>fnOverload : { (): any; (foo: string): any; } +>foo : string + + static fnOverload(foo?: any){ } +>fnOverload : { (): any; (foo: string): any; } +>foo : any +} + diff --git a/tests/baselines/reference/functionOverloads7.types b/tests/baselines/reference/functionOverloads7.types new file mode 100644 index 00000000000..fed669c8943 --- /dev/null +++ b/tests/baselines/reference/functionOverloads7.types @@ -0,0 +1,35 @@ +=== tests/cases/compiler/functionOverloads7.ts === +class foo { +>foo : foo + + private bar(); +>bar : { (): any; (foo: string): any; } + + private bar(foo: string); +>bar : { (): any; (foo: string): any; } +>foo : string + + private bar(foo?: any){ return "foo" } +>bar : { (): any; (foo: string): any; } +>foo : any + + public n() { +>n : () => void + + var foo = this.bar(); +>foo : any +>this.bar() : any +>this.bar : { (): any; (foo: string): any; } +>this : foo +>bar : { (): any; (foo: string): any; } + + foo = this.bar("test"); +>foo = this.bar("test") : any +>foo : any +>this.bar("test") : any +>this.bar : { (): any; (foo: string): any; } +>this : foo +>bar : { (): any; (foo: string): any; } + } +} + diff --git a/tests/baselines/reference/functionOverloads8.types b/tests/baselines/reference/functionOverloads8.types new file mode 100644 index 00000000000..e342db5d174 --- /dev/null +++ b/tests/baselines/reference/functionOverloads8.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/functionOverloads8.ts === +function foo(); +>foo : { (): any; (foo: string): any; } + +function foo(foo:string); +>foo : { (): any; (foo: string): any; } +>foo : string + +function foo(foo?:any){ return '' } +>foo : { (): any; (foo: string): any; } +>foo : any + diff --git a/tests/baselines/reference/functionOverloads9.types b/tests/baselines/reference/functionOverloads9.types new file mode 100644 index 00000000000..a844aee7df1 --- /dev/null +++ b/tests/baselines/reference/functionOverloads9.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/functionOverloads9.ts === +function foo(foo:string); +>foo : (foo: string) => any +>foo : string + +function foo(foo?:string){ return '' }; +>foo : (foo: string) => any +>foo : string + +var x = foo('foo'); +>x : any +>foo('foo') : any +>foo : (foo: string) => any + diff --git a/tests/baselines/reference/functionOverloadsOnGenericArity1.types b/tests/baselines/reference/functionOverloadsOnGenericArity1.types new file mode 100644 index 00000000000..774be93e09a --- /dev/null +++ b/tests/baselines/reference/functionOverloadsOnGenericArity1.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/functionOverloadsOnGenericArity1.ts === +// overloading on arity not allowed +interface C { +>C : C + + f(): string; +>f : { (): string; (): string; } +>T : T + + f(): string; +>f : { (): string; (): string; } +>T : T +>U : U + + (): string; +>T : T + + (): string; +>T : T +>U : U + + new (): string; +>T : T + + new (): string; +>T : T +>U : U +} + diff --git a/tests/baselines/reference/functionOverloadsOnGenericArity2.types b/tests/baselines/reference/functionOverloadsOnGenericArity2.types new file mode 100644 index 00000000000..32e4cb702ec --- /dev/null +++ b/tests/baselines/reference/functionOverloadsOnGenericArity2.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/functionOverloadsOnGenericArity2.ts === +interface I { +>I : I + + then(p: string): string; +>then : { (p: string): string; (p: string): string; (p: string): Date; } +>p : string + + then(p: string): string; +>then : { (p: string): string; (p: string): string; (p: string): Date; } +>U : U +>p : string + + then(p: string): Date; +>then : { (p: string): string; (p: string): string; (p: string): Date; } +>U : U +>T : T +>p : string +>Date : Date +} diff --git a/tests/baselines/reference/functionOverloadsRecursiveGenericReturnType.types b/tests/baselines/reference/functionOverloadsRecursiveGenericReturnType.types new file mode 100644 index 00000000000..22b0a30459f --- /dev/null +++ b/tests/baselines/reference/functionOverloadsRecursiveGenericReturnType.types @@ -0,0 +1,49 @@ +=== tests/cases/compiler/functionOverloadsRecursiveGenericReturnType.ts === +class B{ +>B : B +>V : V + + private id: V; +>id : V +>V : V +} + +class A{ +>A : A +>U : U + + GetEnumerator: () => B; +>GetEnumerator : () => B +>B : B +>U : U +} + +function Choice(args: T[]): A; +>Choice : { (args: T[]): A; (...v_args: T[]): A; } +>T : T +>args : T[] +>T : T +>A : A +>T : T + +function Choice(...v_args: T[]): A; +>Choice : { (args: T[]): A; (...v_args: T[]): A; } +>T : T +>v_args : T[] +>T : T +>A : A +>T : T + +function Choice(...v_args: any[]): A{ +>Choice : { (args: T[]): A; (...v_args: T[]): A; } +>T : T +>v_args : any[] +>A : A +>T : T + + return new A(); +>new A() : A +>A : typeof A +>T : T +} + diff --git a/tests/baselines/reference/functionReturn.types b/tests/baselines/reference/functionReturn.types new file mode 100644 index 00000000000..0c1ee8eafc2 --- /dev/null +++ b/tests/baselines/reference/functionReturn.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/functionReturn.ts === +function f0(): void { } +>f0 : () => void + +function f1() { +>f1 : () => void + + var n: any = f0(); +>n : any +>f0() : void +>f0 : () => void +} +function f2(): any { } +>f2 : () => any + +function f3(): string { return; } +>f3 : () => string + +function f4(): string { +>f4 : () => string + + return ''; + return; +} +function f5(): string { +>f5 : () => string + + return ''; + return undefined; +>undefined : undefined +} diff --git a/tests/baselines/reference/functionReturningItself.types b/tests/baselines/reference/functionReturningItself.types new file mode 100644 index 00000000000..597202a55e2 --- /dev/null +++ b/tests/baselines/reference/functionReturningItself.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/functionReturningItself.ts === +function somefn() { +>somefn : () => typeof somefn + + return somefn; +>somefn : () => typeof somefn +} diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs.types b/tests/baselines/reference/functionSubtypingOfVarArgs.types new file mode 100644 index 00000000000..ab048380ae5 --- /dev/null +++ b/tests/baselines/reference/functionSubtypingOfVarArgs.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/functionSubtypingOfVarArgs.ts === +class EventBase { +>EventBase : EventBase + + private _listeners = []; +>_listeners : any[] +>[] : undefined[] + + add(listener: (...args: any[]) => void): void { +>add : (listener: (...args: any[]) => void) => void +>listener : (...args: any[]) => void +>args : any[] + + this._listeners.push(listener); +>this._listeners.push(listener) : number +>this._listeners.push : (...items: any[]) => number +>this._listeners : any[] +>this : EventBase +>_listeners : any[] +>push : (...items: any[]) => number +>listener : (...args: any[]) => void + } +} + +class StringEvent extends EventBase { // should work +>StringEvent : StringEvent +>EventBase : EventBase + + add(listener: (items: string) => void ) { // valid, items is subtype of args +>add : (listener: (items: string) => void) => void +>listener : (items: string) => void +>items : string + + super.add(listener); +>super.add(listener) : void +>super.add : (listener: (...args: any[]) => void) => void +>add : (listener: (...args: any[]) => void) => void +>listener : (items: string) => void + } +} + diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs2.types b/tests/baselines/reference/functionSubtypingOfVarArgs2.types new file mode 100644 index 00000000000..3aeec10f271 --- /dev/null +++ b/tests/baselines/reference/functionSubtypingOfVarArgs2.types @@ -0,0 +1,43 @@ +=== tests/cases/compiler/functionSubtypingOfVarArgs2.ts === +class EventBase { +>EventBase : EventBase + + private _listeners: { (...args: any[]): void; }[] = []; +>_listeners : { (...args: any[]): void; }[] +>args : any[] +>[] : { (...args: any[]): void; }[] + + add(listener: (...args: any[]) => void): void { +>add : (listener: (...args: any[]) => void) => void +>listener : (...args: any[]) => void +>args : any[] + + this._listeners.push(listener); +>this._listeners.push(listener) : number +>this._listeners.push : (...items: { (...args: any[]): void; }[]) => number +>this._listeners : { (...args: any[]): void; }[] +>this : EventBase +>_listeners : { (...args: any[]): void; }[] +>push : (...items: { (...args: any[]): void; }[]) => number +>listener : (...args: any[]) => void + } +} + +class StringEvent extends EventBase { +>StringEvent : StringEvent +>EventBase : EventBase + + add(listener: (items: string, moreitems: number) => void ) { +>add : (listener: (items: string, moreitems: number) => void) => void +>listener : (items: string, moreitems: number) => void +>items : string +>moreitems : number + + super.add(listener); +>super.add(listener) : void +>super.add : (listener: (...args: any[]) => void) => void +>add : (listener: (...args: any[]) => void) => void +>listener : (items: string, moreitems: number) => void + } +} + diff --git a/tests/baselines/reference/functionType.types b/tests/baselines/reference/functionType.types new file mode 100644 index 00000000000..4bbce7e096a --- /dev/null +++ b/tests/baselines/reference/functionType.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/functionType.ts === +function salt() {} +>salt : () => void + +salt.apply("hello", []); +>salt.apply("hello", []) : any +>salt.apply : (thisArg: any, argArray?: any) => any +>salt : () => void +>apply : (thisArg: any, argArray?: any) => any +>[] : undefined[] + +(new Function("return 5"))(); +>(new Function("return 5"))() : any +>(new Function("return 5")) : Function +>new Function("return 5") : Function +>Function : { (...args: string[]): Function; new (...args: string[]): Function; prototype: Function; } + + + diff --git a/tests/baselines/reference/functionWithAnyReturnTypeAndNoReturnExpression.types b/tests/baselines/reference/functionWithAnyReturnTypeAndNoReturnExpression.types new file mode 100644 index 00000000000..a5096d464d8 --- /dev/null +++ b/tests/baselines/reference/functionWithAnyReturnTypeAndNoReturnExpression.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/functionWithAnyReturnTypeAndNoReturnExpression.ts === +// All should be allowed +function f(): any { } +>f : () => any + +var f2: () => any = () => { }; +>f2 : () => any +>() => { } : () => void + +var f3 = (): any => { }; +>f3 : () => any +>(): any => { } : () => any + diff --git a/tests/baselines/reference/functionWithMultipleReturnStatements2.types b/tests/baselines/reference/functionWithMultipleReturnStatements2.types new file mode 100644 index 00000000000..706aca40c94 --- /dev/null +++ b/tests/baselines/reference/functionWithMultipleReturnStatements2.types @@ -0,0 +1,146 @@ +=== tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts === +// return type of a function with multiple returns is the BCT of each return statement +// no errors expected here + +function f1() { +>f1 : () => number + + if (true) { + return 1; + } else { + return null; + } +} + +function f2() { +>f2 : () => number + + if (true) { + return 1; + } else if (false) { + return null; + } else { + return 2; + } +} + +function f4() { +>f4 : () => number + + try { + return 1; + } + catch (e) { +>e : any + + return undefined; +>undefined : undefined + } + finally { + return 1; + } +} + +function f5() { +>f5 : () => Object + + return 1; + return new Object(); +>new Object() : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } +} + +function f6(x: T) { +>f6 : (x: T) => T +>T : T +>x : T +>T : T + + if (true) { + return x; +>x : T + + } else { + return null; + } +} + +//function f7(x: T, y: U) { +// if (true) { +// return x; +// } else { +// return y; +// } +//} + +var a: { x: number; y?: number }; +>a : { x: number; y?: number; } +>x : number +>y : number + +var b: { x: number; z?: number }; +>b : { x: number; z?: number; } +>x : number +>z : number + +// returns typeof a +function f9() { +>f9 : () => { x: number; y?: number; } + + if (true) { + return a; +>a : { x: number; y?: number; } + + } else { + return b; +>b : { x: number; z?: number; } + } +} + +// returns typeof b +function f10() { +>f10 : () => { x: number; z?: number; } + + if (true) { + return b; +>b : { x: number; z?: number; } + + } else { + return a; +>a : { x: number; y?: number; } + } +} + +// returns number => void +function f11() { +>f11 : () => (x: number) => void + + if (true) { + return (x: number) => { } +>(x: number) => { } : (x: number) => void +>x : number + + } else { + return (x: Object) => { } +>(x: Object) => { } : (x: Object) => void +>x : Object +>Object : Object + } +} + +// returns Object => void +function f12() { +>f12 : () => (x: Object) => void + + if (true) { + return (x: Object) => { } +>(x: Object) => { } : (x: Object) => void +>x : Object +>Object : Object + + } else { + return (x: number) => { } +>(x: number) => { } : (x: number) => void +>x : number + } +} diff --git a/tests/baselines/reference/funduleExportedClassIsUsedBeforeDeclaration.types b/tests/baselines/reference/funduleExportedClassIsUsedBeforeDeclaration.types new file mode 100644 index 00000000000..9a7d54c4eef --- /dev/null +++ b/tests/baselines/reference/funduleExportedClassIsUsedBeforeDeclaration.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/funduleExportedClassIsUsedBeforeDeclaration.ts === +interface A { // interface before module declaration +>A : A + + (): B.C; // uses defined below class in module +>B : B +>C : C +} +declare function B(): B.C; // function merged with module +>B : typeof B +>B : B +>C : C + +declare module B { +>B : typeof B + + export class C { // class defined in module +>C : C + } +} +new B.C(); +>new B.C() : C +>B.C : typeof C +>B : typeof B +>C : typeof C + diff --git a/tests/baselines/reference/funduleOfFunctionWithoutReturnTypeAnnotation.types b/tests/baselines/reference/funduleOfFunctionWithoutReturnTypeAnnotation.types new file mode 100644 index 00000000000..9284ce3e19d --- /dev/null +++ b/tests/baselines/reference/funduleOfFunctionWithoutReturnTypeAnnotation.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/funduleOfFunctionWithoutReturnTypeAnnotation.ts === +function fn() { +>fn : typeof fn + + return fn.n; +>fn.n : number +>fn : typeof fn +>n : number +} +module fn { +>fn : typeof fn + + export var n = 1; +>n : number +} + diff --git a/tests/baselines/reference/funduleUsedAcrossFileBoundary.types b/tests/baselines/reference/funduleUsedAcrossFileBoundary.types new file mode 100644 index 00000000000..d4817b827a2 --- /dev/null +++ b/tests/baselines/reference/funduleUsedAcrossFileBoundary.types @@ -0,0 +1,39 @@ +=== tests/cases/compiler/funduleUsedAcrossFileBoundary_file1.ts === +declare function Q(value: T): string; +>Q : typeof Q +>T : T +>value : T +>T : T + +declare module Q { +>Q : typeof Q + + interface Promise { +>Promise : Promise +>T : T + + foo: string; +>foo : string + } + export function defer(): string; +>defer : () => string +>T : T +} + +=== tests/cases/compiler/funduleUsedAcrossFileBoundary_file2.ts === +function promiseWithCancellation(promise: Q.Promise) { +>promiseWithCancellation : (promise: Promise) => void +>T : T +>promise : Promise +>Q : Q +>Promise : Promise +>T : T + + var deferred = Q.defer(); // used to be an error +>deferred : string +>Q.defer() : string +>Q.defer : () => string +>Q : typeof Q +>defer : () => string +>T : T +} diff --git a/tests/baselines/reference/generatedContextualTyping.types b/tests/baselines/reference/generatedContextualTyping.types new file mode 100644 index 00000000000..797a1a4798f --- /dev/null +++ b/tests/baselines/reference/generatedContextualTyping.types @@ -0,0 +1,3705 @@ +=== tests/cases/conformance/expressions/contextualTyping/generatedContextualTyping.ts === +class Base { private p; } +>Base : Base +>p : any + +class Derived1 extends Base { private m; } +>Derived1 : Derived1 +>Base : Base +>m : any + +class Derived2 extends Base { private n; } +>Derived2 : Derived2 +>Base : Base +>n : any + +interface Genric { func(n: T[]); } +>Genric : Genric +>T : T +>func : (n: T[]) => any +>n : T[] +>T : T + +var b = new Base(), d1 = new Derived1(), d2 = new Derived2(); +>b : Base +>new Base() : Base +>Base : typeof Base +>d1 : Derived1 +>new Derived1() : Derived1 +>Derived1 : typeof Derived1 +>d2 : Derived2 +>new Derived2() : Derived2 +>Derived2 : typeof Derived2 + +var x1: () => Base[] = () => [d1, d2]; +>x1 : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x2: () => Base[] = function() { return [d1, d2] }; +>x2 : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x3: () => Base[] = function named() { return [d1, d2] }; +>x3 : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x4: { (): Base[]; } = () => [d1, d2]; +>x4 : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x5: { (): Base[]; } = function() { return [d1, d2] }; +>x5 : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x6: { (): Base[]; } = function named() { return [d1, d2] }; +>x6 : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x7: Base[] = [d1, d2]; +>x7 : Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x8: Array = [d1, d2]; +>x8 : Base[] +>Array : Array +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x9: { [n: number]: Base; } = [d1, d2]; +>x9 : { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x10: {n: Base[]; } = { n: [d1, d2] }; +>x10 : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x11: (s: Base[]) => any = n => { var n: Base[]; return null; }; +>x11 : (s: Base[]) => any +>s : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +var x12: Genric = { func: n => { return [d1, d2]; } }; +>x12 : Genric +>Genric : Genric +>Base : Base +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +class x13 { member: () => Base[] = () => [d1, d2] } +>x13 : x13 +>member : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x14 { member: () => Base[] = function() { return [d1, d2] } } +>x14 : x14 +>member : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x15 { member: () => Base[] = function named() { return [d1, d2] } } +>x15 : x15 +>member : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x16 { member: { (): Base[]; } = () => [d1, d2] } +>x16 : x16 +>member : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x17 { member: { (): Base[]; } = function() { return [d1, d2] } } +>x17 : x17 +>member : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x18 { member: { (): Base[]; } = function named() { return [d1, d2] } } +>x18 : x18 +>member : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x19 { member: Base[] = [d1, d2] } +>x19 : x19 +>member : Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x20 { member: Array = [d1, d2] } +>x20 : x20 +>member : Base[] +>Array : Array +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x21 { member: { [n: number]: Base; } = [d1, d2] } +>x21 : x21 +>member : { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x22 { member: {n: Base[]; } = { n: [d1, d2] } } +>x22 : x22 +>member : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x23 { member: (s: Base[]) => any = n => { var n: Base[]; return null; } } +>x23 : x23 +>member : (s: Base[]) => any +>s : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +class x24 { member: Genric = { func: n => { return [d1, d2]; } } } +>x24 : x24 +>member : Genric +>Genric : Genric +>Base : Base +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +class x25 { private member: () => Base[] = () => [d1, d2] } +>x25 : x25 +>member : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x26 { private member: () => Base[] = function() { return [d1, d2] } } +>x26 : x26 +>member : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x27 { private member: () => Base[] = function named() { return [d1, d2] } } +>x27 : x27 +>member : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x28 { private member: { (): Base[]; } = () => [d1, d2] } +>x28 : x28 +>member : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x29 { private member: { (): Base[]; } = function() { return [d1, d2] } } +>x29 : x29 +>member : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x30 { private member: { (): Base[]; } = function named() { return [d1, d2] } } +>x30 : x30 +>member : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x31 { private member: Base[] = [d1, d2] } +>x31 : x31 +>member : Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x32 { private member: Array = [d1, d2] } +>x32 : x32 +>member : Base[] +>Array : Array +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x33 { private member: { [n: number]: Base; } = [d1, d2] } +>x33 : x33 +>member : { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x34 { private member: {n: Base[]; } = { n: [d1, d2] } } +>x34 : x34 +>member : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x35 { private member: (s: Base[]) => any = n => { var n: Base[]; return null; } } +>x35 : x35 +>member : (s: Base[]) => any +>s : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +class x36 { private member: Genric = { func: n => { return [d1, d2]; } } } +>x36 : x36 +>member : Genric +>Genric : Genric +>Base : Base +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +class x37 { public member: () => Base[] = () => [d1, d2] } +>x37 : x37 +>member : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x38 { public member: () => Base[] = function() { return [d1, d2] } } +>x38 : x38 +>member : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x39 { public member: () => Base[] = function named() { return [d1, d2] } } +>x39 : x39 +>member : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x40 { public member: { (): Base[]; } = () => [d1, d2] } +>x40 : x40 +>member : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x41 { public member: { (): Base[]; } = function() { return [d1, d2] } } +>x41 : x41 +>member : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x42 { public member: { (): Base[]; } = function named() { return [d1, d2] } } +>x42 : x42 +>member : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x43 { public member: Base[] = [d1, d2] } +>x43 : x43 +>member : Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x44 { public member: Array = [d1, d2] } +>x44 : x44 +>member : Base[] +>Array : Array +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x45 { public member: { [n: number]: Base; } = [d1, d2] } +>x45 : x45 +>member : { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x46 { public member: {n: Base[]; } = { n: [d1, d2] } } +>x46 : x46 +>member : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x47 { public member: (s: Base[]) => any = n => { var n: Base[]; return null; } } +>x47 : x47 +>member : (s: Base[]) => any +>s : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +class x48 { public member: Genric = { func: n => { return [d1, d2]; } } } +>x48 : x48 +>member : Genric +>Genric : Genric +>Base : Base +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +class x49 { static member: () => Base[] = () => [d1, d2] } +>x49 : x49 +>member : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x50 { static member: () => Base[] = function() { return [d1, d2] } } +>x50 : x50 +>member : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x51 { static member: () => Base[] = function named() { return [d1, d2] } } +>x51 : x51 +>member : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x52 { static member: { (): Base[]; } = () => [d1, d2] } +>x52 : x52 +>member : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x53 { static member: { (): Base[]; } = function() { return [d1, d2] } } +>x53 : x53 +>member : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x54 { static member: { (): Base[]; } = function named() { return [d1, d2] } } +>x54 : x54 +>member : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x55 { static member: Base[] = [d1, d2] } +>x55 : x55 +>member : Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x56 { static member: Array = [d1, d2] } +>x56 : x56 +>member : Base[] +>Array : Array +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x57 { static member: { [n: number]: Base; } = [d1, d2] } +>x57 : x57 +>member : { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x58 { static member: {n: Base[]; } = { n: [d1, d2] } } +>x58 : x58 +>member : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x59 { static member: (s: Base[]) => any = n => { var n: Base[]; return null; } } +>x59 : x59 +>member : (s: Base[]) => any +>s : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +class x60 { static member: Genric = { func: n => { return [d1, d2]; } } } +>x60 : x60 +>member : Genric +>Genric : Genric +>Base : Base +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +class x61 { private static member: () => Base[] = () => [d1, d2] } +>x61 : x61 +>member : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x62 { private static member: () => Base[] = function() { return [d1, d2] } } +>x62 : x62 +>member : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x63 { private static member: () => Base[] = function named() { return [d1, d2] } } +>x63 : x63 +>member : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x64 { private static member: { (): Base[]; } = () => [d1, d2] } +>x64 : x64 +>member : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x65 { private static member: { (): Base[]; } = function() { return [d1, d2] } } +>x65 : x65 +>member : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x66 { private static member: { (): Base[]; } = function named() { return [d1, d2] } } +>x66 : x66 +>member : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x67 { private static member: Base[] = [d1, d2] } +>x67 : x67 +>member : Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x68 { private static member: Array = [d1, d2] } +>x68 : x68 +>member : Base[] +>Array : Array +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x69 { private static member: { [n: number]: Base; } = [d1, d2] } +>x69 : x69 +>member : { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x70 { private static member: {n: Base[]; } = { n: [d1, d2] } } +>x70 : x70 +>member : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x71 { private static member: (s: Base[]) => any = n => { var n: Base[]; return null; } } +>x71 : x71 +>member : (s: Base[]) => any +>s : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +class x72 { private static member: Genric = { func: n => { return [d1, d2]; } } } +>x72 : x72 +>member : Genric +>Genric : Genric +>Base : Base +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +class x73 { public static member: () => Base[] = () => [d1, d2] } +>x73 : x73 +>member : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x74 { public static member: () => Base[] = function() { return [d1, d2] } } +>x74 : x74 +>member : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x75 { public static member: () => Base[] = function named() { return [d1, d2] } } +>x75 : x75 +>member : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x76 { public static member: { (): Base[]; } = () => [d1, d2] } +>x76 : x76 +>member : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x77 { public static member: { (): Base[]; } = function() { return [d1, d2] } } +>x77 : x77 +>member : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x78 { public static member: { (): Base[]; } = function named() { return [d1, d2] } } +>x78 : x78 +>member : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x79 { public static member: Base[] = [d1, d2] } +>x79 : x79 +>member : Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x80 { public static member: Array = [d1, d2] } +>x80 : x80 +>member : Base[] +>Array : Array +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x81 { public static member: { [n: number]: Base; } = [d1, d2] } +>x81 : x81 +>member : { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x82 { public static member: {n: Base[]; } = { n: [d1, d2] } } +>x82 : x82 +>member : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x83 { public static member: (s: Base[]) => any = n => { var n: Base[]; return null; } } +>x83 : x83 +>member : (s: Base[]) => any +>s : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +class x84 { public static member: Genric = { func: n => { return [d1, d2]; } } } +>x84 : x84 +>member : Genric +>Genric : Genric +>Base : Base +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +class x85 { constructor(parm: () => Base[] = () => [d1, d2]) { } } +>x85 : x85 +>parm : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x86 { constructor(parm: () => Base[] = function() { return [d1, d2] }) { } } +>x86 : x86 +>parm : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x87 { constructor(parm: () => Base[] = function named() { return [d1, d2] }) { } } +>x87 : x87 +>parm : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x88 { constructor(parm: { (): Base[]; } = () => [d1, d2]) { } } +>x88 : x88 +>parm : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x89 { constructor(parm: { (): Base[]; } = function() { return [d1, d2] }) { } } +>x89 : x89 +>parm : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x90 { constructor(parm: { (): Base[]; } = function named() { return [d1, d2] }) { } } +>x90 : x90 +>parm : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x91 { constructor(parm: Base[] = [d1, d2]) { } } +>x91 : x91 +>parm : Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x92 { constructor(parm: Array = [d1, d2]) { } } +>x92 : x92 +>parm : Base[] +>Array : Array +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x93 { constructor(parm: { [n: number]: Base; } = [d1, d2]) { } } +>x93 : x93 +>parm : { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x94 { constructor(parm: {n: Base[]; } = { n: [d1, d2] }) { } } +>x94 : x94 +>parm : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x95 { constructor(parm: (s: Base[]) => any = n => { var n: Base[]; return null; }) { } } +>x95 : x95 +>parm : (s: Base[]) => any +>s : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +class x96 { constructor(parm: Genric = { func: n => { return [d1, d2]; } }) { } } +>x96 : x96 +>parm : Genric +>Genric : Genric +>Base : Base +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +class x97 { constructor(public parm: () => Base[] = () => [d1, d2]) { } } +>x97 : x97 +>parm : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x98 { constructor(public parm: () => Base[] = function() { return [d1, d2] }) { } } +>x98 : x98 +>parm : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x99 { constructor(public parm: () => Base[] = function named() { return [d1, d2] }) { } } +>x99 : x99 +>parm : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x100 { constructor(public parm: { (): Base[]; } = () => [d1, d2]) { } } +>x100 : x100 +>parm : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x101 { constructor(public parm: { (): Base[]; } = function() { return [d1, d2] }) { } } +>x101 : x101 +>parm : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x102 { constructor(public parm: { (): Base[]; } = function named() { return [d1, d2] }) { } } +>x102 : x102 +>parm : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x103 { constructor(public parm: Base[] = [d1, d2]) { } } +>x103 : x103 +>parm : Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x104 { constructor(public parm: Array = [d1, d2]) { } } +>x104 : x104 +>parm : Base[] +>Array : Array +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x105 { constructor(public parm: { [n: number]: Base; } = [d1, d2]) { } } +>x105 : x105 +>parm : { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x106 { constructor(public parm: {n: Base[]; } = { n: [d1, d2] }) { } } +>x106 : x106 +>parm : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x107 { constructor(public parm: (s: Base[]) => any = n => { var n: Base[]; return null; }) { } } +>x107 : x107 +>parm : (s: Base[]) => any +>s : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +class x108 { constructor(public parm: Genric = { func: n => { return [d1, d2]; } }) { } } +>x108 : x108 +>parm : Genric +>Genric : Genric +>Base : Base +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +class x109 { constructor(private parm: () => Base[] = () => [d1, d2]) { } } +>x109 : x109 +>parm : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x110 { constructor(private parm: () => Base[] = function() { return [d1, d2] }) { } } +>x110 : x110 +>parm : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x111 { constructor(private parm: () => Base[] = function named() { return [d1, d2] }) { } } +>x111 : x111 +>parm : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x112 { constructor(private parm: { (): Base[]; } = () => [d1, d2]) { } } +>x112 : x112 +>parm : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x113 { constructor(private parm: { (): Base[]; } = function() { return [d1, d2] }) { } } +>x113 : x113 +>parm : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x114 { constructor(private parm: { (): Base[]; } = function named() { return [d1, d2] }) { } } +>x114 : x114 +>parm : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x115 { constructor(private parm: Base[] = [d1, d2]) { } } +>x115 : x115 +>parm : Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x116 { constructor(private parm: Array = [d1, d2]) { } } +>x116 : x116 +>parm : Base[] +>Array : Array +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x117 { constructor(private parm: { [n: number]: Base; } = [d1, d2]) { } } +>x117 : x117 +>parm : { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x118 { constructor(private parm: {n: Base[]; } = { n: [d1, d2] }) { } } +>x118 : x118 +>parm : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +class x119 { constructor(private parm: (s: Base[]) => any = n => { var n: Base[]; return null; }) { } } +>x119 : x119 +>parm : (s: Base[]) => any +>s : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +class x120 { constructor(private parm: Genric = { func: n => { return [d1, d2]; } }) { } } +>x120 : x120 +>parm : Genric +>Genric : Genric +>Base : Base +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +function x121(parm: () => Base[] = () => [d1, d2]) { } +>x121 : (parm?: () => Base[]) => void +>parm : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x122(parm: () => Base[] = function() { return [d1, d2] }) { } +>x122 : (parm?: () => Base[]) => void +>parm : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x123(parm: () => Base[] = function named() { return [d1, d2] }) { } +>x123 : (parm?: () => Base[]) => void +>parm : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x124(parm: { (): Base[]; } = () => [d1, d2]) { } +>x124 : (parm?: () => Base[]) => void +>parm : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x125(parm: { (): Base[]; } = function() { return [d1, d2] }) { } +>x125 : (parm?: () => Base[]) => void +>parm : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x126(parm: { (): Base[]; } = function named() { return [d1, d2] }) { } +>x126 : (parm?: () => Base[]) => void +>parm : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x127(parm: Base[] = [d1, d2]) { } +>x127 : (parm?: Base[]) => void +>parm : Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x128(parm: Array = [d1, d2]) { } +>x128 : (parm?: Base[]) => void +>parm : Base[] +>Array : Array +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x129(parm: { [n: number]: Base; } = [d1, d2]) { } +>x129 : (parm?: { [x: number]: Base; }) => void +>parm : { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x130(parm: {n: Base[]; } = { n: [d1, d2] }) { } +>x130 : (parm?: { n: Base[]; }) => void +>parm : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x131(parm: (s: Base[]) => any = n => { var n: Base[]; return null; }) { } +>x131 : (parm?: (s: Base[]) => any) => void +>parm : (s: Base[]) => any +>s : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +function x132(parm: Genric = { func: n => { return [d1, d2]; } }) { } +>x132 : (parm?: Genric) => void +>parm : Genric +>Genric : Genric +>Base : Base +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +function x133(): () => Base[] { return () => [d1, d2]; } +>x133 : () => () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x134(): () => Base[] { return function() { return [d1, d2] }; } +>x134 : () => () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x135(): () => Base[] { return function named() { return [d1, d2] }; } +>x135 : () => () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x136(): { (): Base[]; } { return () => [d1, d2]; } +>x136 : () => () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x137(): { (): Base[]; } { return function() { return [d1, d2] }; } +>x137 : () => () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x138(): { (): Base[]; } { return function named() { return [d1, d2] }; } +>x138 : () => () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x139(): Base[] { return [d1, d2]; } +>x139 : () => Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x140(): Array { return [d1, d2]; } +>x140 : () => Base[] +>Array : Array +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x141(): { [n: number]: Base; } { return [d1, d2]; } +>x141 : () => { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x142(): {n: Base[]; } { return { n: [d1, d2] }; } +>x142 : () => { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x143(): (s: Base[]) => any { return n => { var n: Base[]; return null; }; } +>x143 : () => (s: Base[]) => any +>s : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +function x144(): Genric { return { func: n => { return [d1, d2]; } }; } +>x144 : () => Genric +>Genric : Genric +>Base : Base +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +function x145(): () => Base[] { return () => [d1, d2]; return () => [d1, d2]; } +>x145 : () => () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x146(): () => Base[] { return function() { return [d1, d2] }; return function() { return [d1, d2] }; } +>x146 : () => () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x147(): () => Base[] { return function named() { return [d1, d2] }; return function named() { return [d1, d2] }; } +>x147 : () => () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x148(): { (): Base[]; } { return () => [d1, d2]; return () => [d1, d2]; } +>x148 : () => () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x149(): { (): Base[]; } { return function() { return [d1, d2] }; return function() { return [d1, d2] }; } +>x149 : () => () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x150(): { (): Base[]; } { return function named() { return [d1, d2] }; return function named() { return [d1, d2] }; } +>x150 : () => () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x151(): Base[] { return [d1, d2]; return [d1, d2]; } +>x151 : () => Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x152(): Array { return [d1, d2]; return [d1, d2]; } +>x152 : () => Base[] +>Array : Array +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x153(): { [n: number]: Base; } { return [d1, d2]; return [d1, d2]; } +>x153 : () => { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x154(): {n: Base[]; } { return { n: [d1, d2] }; return { n: [d1, d2] }; } +>x154 : () => { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x155(): (s: Base[]) => any { return n => { var n: Base[]; return null; }; return n => { var n: Base[]; return null; }; } +>x155 : () => (s: Base[]) => any +>s : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +function x156(): Genric { return { func: n => { return [d1, d2]; } }; return { func: n => { return [d1, d2]; } }; } +>x156 : () => Genric +>Genric : Genric +>Base : Base +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +var x157: () => () => Base[] = () => { return () => [d1, d2]; }; +>x157 : () => () => Base[] +>Base : Base +>() => { return () => [d1, d2]; } : () => () => Base[] +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x158: () => () => Base[] = () => { return function() { return [d1, d2] }; }; +>x158 : () => () => Base[] +>Base : Base +>() => { return function() { return [d1, d2] }; } : () => () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x159: () => () => Base[] = () => { return function named() { return [d1, d2] }; }; +>x159 : () => () => Base[] +>Base : Base +>() => { return function named() { return [d1, d2] }; } : () => () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x160: () => { (): Base[]; } = () => { return () => [d1, d2]; }; +>x160 : () => () => Base[] +>Base : Base +>() => { return () => [d1, d2]; } : () => () => Base[] +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x161: () => { (): Base[]; } = () => { return function() { return [d1, d2] }; }; +>x161 : () => () => Base[] +>Base : Base +>() => { return function() { return [d1, d2] }; } : () => () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x162: () => { (): Base[]; } = () => { return function named() { return [d1, d2] }; }; +>x162 : () => () => Base[] +>Base : Base +>() => { return function named() { return [d1, d2] }; } : () => () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x163: () => Base[] = () => { return [d1, d2]; }; +>x163 : () => Base[] +>Base : Base +>() => { return [d1, d2]; } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x164: () => Array = () => { return [d1, d2]; }; +>x164 : () => Base[] +>Array : Array +>Base : Base +>() => { return [d1, d2]; } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x165: () => { [n: number]: Base; } = () => { return [d1, d2]; }; +>x165 : () => { [x: number]: Base; } +>n : number +>Base : Base +>() => { return [d1, d2]; } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x166: () => {n: Base[]; } = () => { return { n: [d1, d2] }; }; +>x166 : () => { n: Base[]; } +>n : Base[] +>Base : Base +>() => { return { n: [d1, d2] }; } : () => { n: Base[]; } +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x167: () => (s: Base[]) => any = () => { return n => { var n: Base[]; return null; }; }; +>x167 : () => (s: Base[]) => any +>s : Base[] +>Base : Base +>() => { return n => { var n: Base[]; return null; }; } : () => (n: Base[]) => any +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +var x168: () => Genric = () => { return { func: n => { return [d1, d2]; } }; }; +>x168 : () => Genric +>Genric : Genric +>Base : Base +>() => { return { func: n => { return [d1, d2]; } }; } : () => { func: (n: Base[]) => {}[]; } +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +var x169: () => () => Base[] = function() { return () => [d1, d2]; }; +>x169 : () => () => Base[] +>Base : Base +>function() { return () => [d1, d2]; } : () => () => Base[] +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x170: () => () => Base[] = function() { return function() { return [d1, d2] }; }; +>x170 : () => () => Base[] +>Base : Base +>function() { return function() { return [d1, d2] }; } : () => () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x171: () => () => Base[] = function() { return function named() { return [d1, d2] }; }; +>x171 : () => () => Base[] +>Base : Base +>function() { return function named() { return [d1, d2] }; } : () => () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x172: () => { (): Base[]; } = function() { return () => [d1, d2]; }; +>x172 : () => () => Base[] +>Base : Base +>function() { return () => [d1, d2]; } : () => () => Base[] +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x173: () => { (): Base[]; } = function() { return function() { return [d1, d2] }; }; +>x173 : () => () => Base[] +>Base : Base +>function() { return function() { return [d1, d2] }; } : () => () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x174: () => { (): Base[]; } = function() { return function named() { return [d1, d2] }; }; +>x174 : () => () => Base[] +>Base : Base +>function() { return function named() { return [d1, d2] }; } : () => () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x175: () => Base[] = function() { return [d1, d2]; }; +>x175 : () => Base[] +>Base : Base +>function() { return [d1, d2]; } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x176: () => Array = function() { return [d1, d2]; }; +>x176 : () => Base[] +>Array : Array +>Base : Base +>function() { return [d1, d2]; } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x177: () => { [n: number]: Base; } = function() { return [d1, d2]; }; +>x177 : () => { [x: number]: Base; } +>n : number +>Base : Base +>function() { return [d1, d2]; } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x178: () => {n: Base[]; } = function() { return { n: [d1, d2] }; }; +>x178 : () => { n: Base[]; } +>n : Base[] +>Base : Base +>function() { return { n: [d1, d2] }; } : () => { n: Base[]; } +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x179: () => (s: Base[]) => any = function() { return n => { var n: Base[]; return null; }; }; +>x179 : () => (s: Base[]) => any +>s : Base[] +>Base : Base +>function() { return n => { var n: Base[]; return null; }; } : () => (n: Base[]) => any +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +var x180: () => Genric = function() { return { func: n => { return [d1, d2]; } }; }; +>x180 : () => Genric +>Genric : Genric +>Base : Base +>function() { return { func: n => { return [d1, d2]; } }; } : () => { func: (n: Base[]) => {}[]; } +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +module x181 { var t: () => Base[] = () => [d1, d2]; } +>x181 : typeof x181 +>t : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x182 { var t: () => Base[] = function() { return [d1, d2] }; } +>x182 : typeof x182 +>t : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x183 { var t: () => Base[] = function named() { return [d1, d2] }; } +>x183 : typeof x183 +>t : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x184 { var t: { (): Base[]; } = () => [d1, d2]; } +>x184 : typeof x184 +>t : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x185 { var t: { (): Base[]; } = function() { return [d1, d2] }; } +>x185 : typeof x185 +>t : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x186 { var t: { (): Base[]; } = function named() { return [d1, d2] }; } +>x186 : typeof x186 +>t : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x187 { var t: Base[] = [d1, d2]; } +>x187 : typeof x187 +>t : Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x188 { var t: Array = [d1, d2]; } +>x188 : typeof x188 +>t : Base[] +>Array : Array +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x189 { var t: { [n: number]: Base; } = [d1, d2]; } +>x189 : typeof x189 +>t : { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x190 { var t: {n: Base[]; } = { n: [d1, d2] }; } +>x190 : typeof x190 +>t : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x191 { var t: (s: Base[]) => any = n => { var n: Base[]; return null; }; } +>x191 : typeof x191 +>t : (s: Base[]) => any +>s : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +module x192 { var t: Genric = { func: n => { return [d1, d2]; } }; } +>x192 : typeof x192 +>t : Genric +>Genric : Genric +>Base : Base +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +module x193 { export var t: () => Base[] = () => [d1, d2]; } +>x193 : typeof x193 +>t : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x194 { export var t: () => Base[] = function() { return [d1, d2] }; } +>x194 : typeof x194 +>t : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x195 { export var t: () => Base[] = function named() { return [d1, d2] }; } +>x195 : typeof x195 +>t : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x196 { export var t: { (): Base[]; } = () => [d1, d2]; } +>x196 : typeof x196 +>t : () => Base[] +>Base : Base +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x197 { export var t: { (): Base[]; } = function() { return [d1, d2] }; } +>x197 : typeof x197 +>t : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x198 { export var t: { (): Base[]; } = function named() { return [d1, d2] }; } +>x198 : typeof x198 +>t : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x199 { export var t: Base[] = [d1, d2]; } +>x199 : typeof x199 +>t : Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x200 { export var t: Array = [d1, d2]; } +>x200 : typeof x200 +>t : Base[] +>Array : Array +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x201 { export var t: { [n: number]: Base; } = [d1, d2]; } +>x201 : typeof x201 +>t : { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x202 { export var t: {n: Base[]; } = { n: [d1, d2] }; } +>x202 : typeof x202 +>t : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +module x203 { export var t: (s: Base[]) => any = n => { var n: Base[]; return null; }; } +>x203 : typeof x203 +>t : (s: Base[]) => any +>s : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +module x204 { export var t: Genric = { func: n => { return [d1, d2]; } }; } +>x204 : typeof x204 +>t : Genric +>Genric : Genric +>Base : Base +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +var x206 = <() => Base[]>function() { return [d1, d2] }; +>x206 : () => Base[] +><() => Base[]>function() { return [d1, d2] } : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x207 = <() => Base[]>function named() { return [d1, d2] }; +>x207 : () => Base[] +><() => Base[]>function named() { return [d1, d2] } : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x209 = <{ (): Base[]; }>function() { return [d1, d2] }; +>x209 : () => Base[] +><{ (): Base[]; }>function() { return [d1, d2] } : () => Base[] +>Base : Base +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x210 = <{ (): Base[]; }>function named() { return [d1, d2] }; +>x210 : () => Base[] +><{ (): Base[]; }>function named() { return [d1, d2] } : () => Base[] +>Base : Base +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x211 = [d1, d2]; +>x211 : Base[] +>[d1, d2] : Base[] +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x212 = >[d1, d2]; +>x212 : Base[] +>>[d1, d2] : Base[] +>Array : Array +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x213 = <{ [n: number]: Base; }>[d1, d2]; +>x213 : { [x: number]: Base; } +><{ [n: number]: Base; }>[d1, d2] : { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x214 = <{n: Base[]; } >{ n: [d1, d2] }; +>x214 : { n: Base[]; } +><{n: Base[]; } >{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x216 = >{ func: n => { return [d1, d2]; } }; +>x216 : Genric +>>{ func: n => { return [d1, d2]; } } : Genric +>Genric : Genric +>Base : Base +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +var x217 = (<() => Base[]>undefined) || function() { return [d1, d2] }; +>x217 : () => Base[] +>(<() => Base[]>undefined) || function() { return [d1, d2] } : () => Base[] +>(<() => Base[]>undefined) : () => Base[] +><() => Base[]>undefined : () => Base[] +>Base : Base +>undefined : undefined +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x218 = (<() => Base[]>undefined) || function named() { return [d1, d2] }; +>x218 : () => Base[] +>(<() => Base[]>undefined) || function named() { return [d1, d2] } : () => Base[] +>(<() => Base[]>undefined) : () => Base[] +><() => Base[]>undefined : () => Base[] +>Base : Base +>undefined : undefined +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x219 = (<{ (): Base[]; }>undefined) || function() { return [d1, d2] }; +>x219 : () => Base[] +>(<{ (): Base[]; }>undefined) || function() { return [d1, d2] } : () => Base[] +>(<{ (): Base[]; }>undefined) : () => Base[] +><{ (): Base[]; }>undefined : () => Base[] +>Base : Base +>undefined : undefined +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x220 = (<{ (): Base[]; }>undefined) || function named() { return [d1, d2] }; +>x220 : () => Base[] +>(<{ (): Base[]; }>undefined) || function named() { return [d1, d2] } : () => Base[] +>(<{ (): Base[]; }>undefined) : () => Base[] +><{ (): Base[]; }>undefined : () => Base[] +>Base : Base +>undefined : undefined +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x221 = (undefined) || [d1, d2]; +>x221 : Base[] +>(undefined) || [d1, d2] : Base[] +>(undefined) : Base[] +>undefined : Base[] +>Base : Base +>undefined : undefined +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x222 = (>undefined) || [d1, d2]; +>x222 : Base[] +>(>undefined) || [d1, d2] : Base[] +>(>undefined) : Base[] +>>undefined : Base[] +>Array : Array +>Base : Base +>undefined : undefined +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x223 = (<{ [n: number]: Base; }>undefined) || [d1, d2]; +>x223 : { [x: number]: Base; } +>(<{ [n: number]: Base; }>undefined) || [d1, d2] : { [x: number]: Base; } +>(<{ [n: number]: Base; }>undefined) : { [x: number]: Base; } +><{ [n: number]: Base; }>undefined : { [x: number]: Base; } +>n : number +>Base : Base +>undefined : undefined +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x224 = (<{n: Base[]; } >undefined) || { n: [d1, d2] }; +>x224 : { n: Base[]; } +>(<{n: Base[]; } >undefined) || { n: [d1, d2] } : { n: Base[]; } +>(<{n: Base[]; } >undefined) : { n: Base[]; } +><{n: Base[]; } >undefined : { n: Base[]; } +>n : Base[] +>Base : Base +>undefined : undefined +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x225: () => Base[]; x225 = () => [d1, d2]; +>x225 : () => Base[] +>Base : Base +>x225 = () => [d1, d2] : () => Base[] +>x225 : () => Base[] +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x226: () => Base[]; x226 = function() { return [d1, d2] }; +>x226 : () => Base[] +>Base : Base +>x226 = function() { return [d1, d2] } : () => Base[] +>x226 : () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x227: () => Base[]; x227 = function named() { return [d1, d2] }; +>x227 : () => Base[] +>Base : Base +>x227 = function named() { return [d1, d2] } : () => Base[] +>x227 : () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x228: { (): Base[]; }; x228 = () => [d1, d2]; +>x228 : () => Base[] +>Base : Base +>x228 = () => [d1, d2] : () => Base[] +>x228 : () => Base[] +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x229: { (): Base[]; }; x229 = function() { return [d1, d2] }; +>x229 : () => Base[] +>Base : Base +>x229 = function() { return [d1, d2] } : () => Base[] +>x229 : () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x230: { (): Base[]; }; x230 = function named() { return [d1, d2] }; +>x230 : () => Base[] +>Base : Base +>x230 = function named() { return [d1, d2] } : () => Base[] +>x230 : () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x231: Base[]; x231 = [d1, d2]; +>x231 : Base[] +>Base : Base +>x231 = [d1, d2] : Base[] +>x231 : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x232: Array; x232 = [d1, d2]; +>x232 : Base[] +>Array : Array +>Base : Base +>x232 = [d1, d2] : Base[] +>x232 : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x233: { [n: number]: Base; }; x233 = [d1, d2]; +>x233 : { [x: number]: Base; } +>n : number +>Base : Base +>x233 = [d1, d2] : Base[] +>x233 : { [x: number]: Base; } +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x234: {n: Base[]; } ; x234 = { n: [d1, d2] }; +>x234 : { n: Base[]; } +>n : Base[] +>Base : Base +>x234 = { n: [d1, d2] } : { n: Base[]; } +>x234 : { n: Base[]; } +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x235: (s: Base[]) => any; x235 = n => { var n: Base[]; return null; }; +>x235 : (s: Base[]) => any +>s : Base[] +>Base : Base +>x235 = n => { var n: Base[]; return null; } : (n: Base[]) => any +>x235 : (s: Base[]) => any +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +var x236: Genric; x236 = { func: n => { return [d1, d2]; } }; +>x236 : Genric +>Genric : Genric +>Base : Base +>x236 = { func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>x236 : Genric +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +var x237: { n: () => Base[]; } = { n: () => [d1, d2] }; +>x237 : { n: () => Base[]; } +>n : () => Base[] +>Base : Base +>{ n: () => [d1, d2] } : { n: () => Base[]; } +>n : () => Base[] +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x238: { n: () => Base[]; } = { n: function() { return [d1, d2] } }; +>x238 : { n: () => Base[]; } +>n : () => Base[] +>Base : Base +>{ n: function() { return [d1, d2] } } : { n: () => Base[]; } +>n : () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x239: { n: () => Base[]; } = { n: function named() { return [d1, d2] } }; +>x239 : { n: () => Base[]; } +>n : () => Base[] +>Base : Base +>{ n: function named() { return [d1, d2] } } : { n: () => Base[]; } +>n : () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x240: { n: { (): Base[]; }; } = { n: () => [d1, d2] }; +>x240 : { n: () => Base[]; } +>n : () => Base[] +>Base : Base +>{ n: () => [d1, d2] } : { n: () => Base[]; } +>n : () => Base[] +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x241: { n: { (): Base[]; }; } = { n: function() { return [d1, d2] } }; +>x241 : { n: () => Base[]; } +>n : () => Base[] +>Base : Base +>{ n: function() { return [d1, d2] } } : { n: () => Base[]; } +>n : () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x242: { n: { (): Base[]; }; } = { n: function named() { return [d1, d2] } }; +>x242 : { n: () => Base[]; } +>n : () => Base[] +>Base : Base +>{ n: function named() { return [d1, d2] } } : { n: () => Base[]; } +>n : () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x243: { n: Base[]; } = { n: [d1, d2] }; +>x243 : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x244: { n: Array; } = { n: [d1, d2] }; +>x244 : { n: Base[]; } +>n : Base[] +>Array : Array +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x245: { n: { [n: number]: Base; }; } = { n: [d1, d2] }; +>x245 : { n: { [x: number]: Base; }; } +>n : { [x: number]: Base; } +>n : number +>Base : Base +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x246: { n: {n: Base[]; } ; } = { n: { n: [d1, d2] } }; +>x246 : { n: { n: Base[]; }; } +>n : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: { n: [d1, d2] } } : { n: { n: Base[]; }; } +>n : { n: Base[]; } +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x247: { n: (s: Base[]) => any; } = { n: n => { var n: Base[]; return null; } }; +>x247 : { n: (s: Base[]) => any; } +>n : (s: Base[]) => any +>s : Base[] +>Base : Base +>{ n: n => { var n: Base[]; return null; } } : { n: (n: Base[]) => any; } +>n : (n: Base[]) => any +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +var x248: { n: Genric; } = { n: { func: n => { return [d1, d2]; } } }; +>x248 : { n: Genric; } +>n : Genric +>Genric : Genric +>Base : Base +>{ n: { func: n => { return [d1, d2]; } } } : { n: { func: (n: Base[]) => {}[]; }; } +>n : { func: (n: Base[]) => {}[]; } +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +var x252: { (): Base[]; }[] = [() => [d1, d2]]; +>x252 : { (): Base[]; }[] +>Base : Base +>[() => [d1, d2]] : { (): Base[]; }[] +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x253: { (): Base[]; }[] = [function() { return [d1, d2] }]; +>x253 : { (): Base[]; }[] +>Base : Base +>[function() { return [d1, d2] }] : { (): Base[]; }[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x254: { (): Base[]; }[] = [function named() { return [d1, d2] }]; +>x254 : { (): Base[]; }[] +>Base : Base +>[function named() { return [d1, d2] }] : { (): Base[]; }[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x255: Base[][] = [[d1, d2]]; +>x255 : Base[][] +>Base : Base +>[[d1, d2]] : Base[][] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x256: Array[] = [[d1, d2]]; +>x256 : Base[][] +>Array : Array +>Base : Base +>[[d1, d2]] : Base[][] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x257: { [n: number]: Base; }[] = [[d1, d2]]; +>x257 : { [x: number]: Base; }[] +>n : number +>Base : Base +>[[d1, d2]] : { [x: number]: Base; }[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x258: {n: Base[]; } [] = [{ n: [d1, d2] }]; +>x258 : { n: Base[]; }[] +>n : Base[] +>Base : Base +>[{ n: [d1, d2] }] : { n: Base[]; }[] +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x260: Genric[] = [{ func: n => { return [d1, d2]; } }]; +>x260 : Genric[] +>Genric : Genric +>Base : Base +>[{ func: n => { return [d1, d2]; } }] : Genric[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +var x261: () => Base[] = function() { return [d1, d2] } || undefined; +>x261 : () => Base[] +>Base : Base +>function() { return [d1, d2] } || undefined : () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x262: () => Base[] = function named() { return [d1, d2] } || undefined; +>x262 : () => Base[] +>Base : Base +>function named() { return [d1, d2] } || undefined : () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x263: { (): Base[]; } = function() { return [d1, d2] } || undefined; +>x263 : () => Base[] +>Base : Base +>function() { return [d1, d2] } || undefined : () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x264: { (): Base[]; } = function named() { return [d1, d2] } || undefined; +>x264 : () => Base[] +>Base : Base +>function named() { return [d1, d2] } || undefined : () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x265: Base[] = [d1, d2] || undefined; +>x265 : Base[] +>Base : Base +>[d1, d2] || undefined : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x266: Array = [d1, d2] || undefined; +>x266 : Base[] +>Array : Array +>Base : Base +>[d1, d2] || undefined : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x267: { [n: number]: Base; } = [d1, d2] || undefined; +>x267 : { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] || undefined : { [x: number]: Base; } +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x268: {n: Base[]; } = { n: [d1, d2] } || undefined; +>x268 : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } || undefined : { n: Base[]; } +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x269: () => Base[] = undefined || function() { return [d1, d2] }; +>x269 : () => Base[] +>Base : Base +>undefined || function() { return [d1, d2] } : () => Base[] +>undefined : undefined +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x270: () => Base[] = undefined || function named() { return [d1, d2] }; +>x270 : () => Base[] +>Base : Base +>undefined || function named() { return [d1, d2] } : () => Base[] +>undefined : undefined +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x271: { (): Base[]; } = undefined || function() { return [d1, d2] }; +>x271 : () => Base[] +>Base : Base +>undefined || function() { return [d1, d2] } : () => Base[] +>undefined : undefined +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x272: { (): Base[]; } = undefined || function named() { return [d1, d2] }; +>x272 : () => Base[] +>Base : Base +>undefined || function named() { return [d1, d2] } : () => Base[] +>undefined : undefined +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x273: Base[] = undefined || [d1, d2]; +>x273 : Base[] +>Base : Base +>undefined || [d1, d2] : Base[] +>undefined : undefined +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x274: Array = undefined || [d1, d2]; +>x274 : Base[] +>Array : Array +>Base : Base +>undefined || [d1, d2] : Base[] +>undefined : undefined +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x275: { [n: number]: Base; } = undefined || [d1, d2]; +>x275 : { [x: number]: Base; } +>n : number +>Base : Base +>undefined || [d1, d2] : { [x: number]: Base; } +>undefined : undefined +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x276: {n: Base[]; } = undefined || { n: [d1, d2] }; +>x276 : { n: Base[]; } +>n : Base[] +>Base : Base +>undefined || { n: [d1, d2] } : { n: Base[]; } +>undefined : undefined +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x277: () => Base[] = function() { return [d1, d2] } || function() { return [d1, d2] }; +>x277 : () => Base[] +>Base : Base +>function() { return [d1, d2] } || function() { return [d1, d2] } : () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x278: () => Base[] = function named() { return [d1, d2] } || function named() { return [d1, d2] }; +>x278 : () => Base[] +>Base : Base +>function named() { return [d1, d2] } || function named() { return [d1, d2] } : () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x279: { (): Base[]; } = function() { return [d1, d2] } || function() { return [d1, d2] }; +>x279 : () => Base[] +>Base : Base +>function() { return [d1, d2] } || function() { return [d1, d2] } : () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x280: { (): Base[]; } = function named() { return [d1, d2] } || function named() { return [d1, d2] }; +>x280 : () => Base[] +>Base : Base +>function named() { return [d1, d2] } || function named() { return [d1, d2] } : () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x281: Base[] = [d1, d2] || [d1, d2]; +>x281 : Base[] +>Base : Base +>[d1, d2] || [d1, d2] : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x282: Array = [d1, d2] || [d1, d2]; +>x282 : Base[] +>Array : Array +>Base : Base +>[d1, d2] || [d1, d2] : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x283: { [n: number]: Base; } = [d1, d2] || [d1, d2]; +>x283 : { [x: number]: Base; } +>n : number +>Base : Base +>[d1, d2] || [d1, d2] : { [x: number]: Base; } +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x284: {n: Base[]; } = { n: [d1, d2] } || { n: [d1, d2] }; +>x284 : { n: Base[]; } +>n : Base[] +>Base : Base +>{ n: [d1, d2] } || { n: [d1, d2] } : { n: Base[]; } +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x285: () => Base[] = true ? () => [d1, d2] : () => [d1, d2]; +>x285 : () => Base[] +>Base : Base +>true ? () => [d1, d2] : () => [d1, d2] : () => Base[] +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x286: () => Base[] = true ? function() { return [d1, d2] } : function() { return [d1, d2] }; +>x286 : () => Base[] +>Base : Base +>true ? function() { return [d1, d2] } : function() { return [d1, d2] } : () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x287: () => Base[] = true ? function named() { return [d1, d2] } : function named() { return [d1, d2] }; +>x287 : () => Base[] +>Base : Base +>true ? function named() { return [d1, d2] } : function named() { return [d1, d2] } : () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x288: { (): Base[]; } = true ? () => [d1, d2] : () => [d1, d2]; +>x288 : () => Base[] +>Base : Base +>true ? () => [d1, d2] : () => [d1, d2] : () => Base[] +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x289: { (): Base[]; } = true ? function() { return [d1, d2] } : function() { return [d1, d2] }; +>x289 : () => Base[] +>Base : Base +>true ? function() { return [d1, d2] } : function() { return [d1, d2] } : () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x290: { (): Base[]; } = true ? function named() { return [d1, d2] } : function named() { return [d1, d2] }; +>x290 : () => Base[] +>Base : Base +>true ? function named() { return [d1, d2] } : function named() { return [d1, d2] } : () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x291: Base[] = true ? [d1, d2] : [d1, d2]; +>x291 : Base[] +>Base : Base +>true ? [d1, d2] : [d1, d2] : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x292: Array = true ? [d1, d2] : [d1, d2]; +>x292 : Base[] +>Array : Array +>Base : Base +>true ? [d1, d2] : [d1, d2] : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x293: { [n: number]: Base; } = true ? [d1, d2] : [d1, d2]; +>x293 : { [x: number]: Base; } +>n : number +>Base : Base +>true ? [d1, d2] : [d1, d2] : { [x: number]: Base; } +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x294: {n: Base[]; } = true ? { n: [d1, d2] } : { n: [d1, d2] }; +>x294 : { n: Base[]; } +>n : Base[] +>Base : Base +>true ? { n: [d1, d2] } : { n: [d1, d2] } : { n: Base[]; } +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x295: (s: Base[]) => any = true ? n => { var n: Base[]; return null; } : n => { var n: Base[]; return null; }; +>x295 : (s: Base[]) => any +>s : Base[] +>Base : Base +>true ? n => { var n: Base[]; return null; } : n => { var n: Base[]; return null; } : (s: Base[]) => any +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +var x296: Genric = true ? { func: n => { return [d1, d2]; } } : { func: n => { return [d1, d2]; } }; +>x296 : Genric +>Genric : Genric +>Base : Base +>true ? { func: n => { return [d1, d2]; } } : { func: n => { return [d1, d2]; } } : Genric +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +var x297: () => Base[] = true ? undefined : () => [d1, d2]; +>x297 : () => Base[] +>Base : Base +>true ? undefined : () => [d1, d2] : () => Base[] +>undefined : undefined +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x298: () => Base[] = true ? undefined : function() { return [d1, d2] }; +>x298 : () => Base[] +>Base : Base +>true ? undefined : function() { return [d1, d2] } : () => Base[] +>undefined : undefined +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x299: () => Base[] = true ? undefined : function named() { return [d1, d2] }; +>x299 : () => Base[] +>Base : Base +>true ? undefined : function named() { return [d1, d2] } : () => Base[] +>undefined : undefined +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x300: { (): Base[]; } = true ? undefined : () => [d1, d2]; +>x300 : () => Base[] +>Base : Base +>true ? undefined : () => [d1, d2] : () => Base[] +>undefined : undefined +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x301: { (): Base[]; } = true ? undefined : function() { return [d1, d2] }; +>x301 : () => Base[] +>Base : Base +>true ? undefined : function() { return [d1, d2] } : () => Base[] +>undefined : undefined +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x302: { (): Base[]; } = true ? undefined : function named() { return [d1, d2] }; +>x302 : () => Base[] +>Base : Base +>true ? undefined : function named() { return [d1, d2] } : () => Base[] +>undefined : undefined +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x303: Base[] = true ? undefined : [d1, d2]; +>x303 : Base[] +>Base : Base +>true ? undefined : [d1, d2] : Base[] +>undefined : undefined +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x304: Array = true ? undefined : [d1, d2]; +>x304 : Base[] +>Array : Array +>Base : Base +>true ? undefined : [d1, d2] : Base[] +>undefined : undefined +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x305: { [n: number]: Base; } = true ? undefined : [d1, d2]; +>x305 : { [x: number]: Base; } +>n : number +>Base : Base +>true ? undefined : [d1, d2] : { [x: number]: Base; } +>undefined : undefined +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x306: {n: Base[]; } = true ? undefined : { n: [d1, d2] }; +>x306 : { n: Base[]; } +>n : Base[] +>Base : Base +>true ? undefined : { n: [d1, d2] } : { n: Base[]; } +>undefined : undefined +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x307: (s: Base[]) => any = true ? undefined : n => { var n: Base[]; return null; }; +>x307 : (s: Base[]) => any +>s : Base[] +>Base : Base +>true ? undefined : n => { var n: Base[]; return null; } : (s: Base[]) => any +>undefined : undefined +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +var x308: Genric = true ? undefined : { func: n => { return [d1, d2]; } }; +>x308 : Genric +>Genric : Genric +>Base : Base +>true ? undefined : { func: n => { return [d1, d2]; } } : Genric +>undefined : undefined +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +var x309: () => Base[] = true ? () => [d1, d2] : undefined; +>x309 : () => Base[] +>Base : Base +>true ? () => [d1, d2] : undefined : () => Base[] +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x310: () => Base[] = true ? function() { return [d1, d2] } : undefined; +>x310 : () => Base[] +>Base : Base +>true ? function() { return [d1, d2] } : undefined : () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x311: () => Base[] = true ? function named() { return [d1, d2] } : undefined; +>x311 : () => Base[] +>Base : Base +>true ? function named() { return [d1, d2] } : undefined : () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x312: { (): Base[]; } = true ? () => [d1, d2] : undefined; +>x312 : () => Base[] +>Base : Base +>true ? () => [d1, d2] : undefined : () => Base[] +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x313: { (): Base[]; } = true ? function() { return [d1, d2] } : undefined; +>x313 : () => Base[] +>Base : Base +>true ? function() { return [d1, d2] } : undefined : () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x314: { (): Base[]; } = true ? function named() { return [d1, d2] } : undefined; +>x314 : () => Base[] +>Base : Base +>true ? function named() { return [d1, d2] } : undefined : () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x315: Base[] = true ? [d1, d2] : undefined; +>x315 : Base[] +>Base : Base +>true ? [d1, d2] : undefined : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x316: Array = true ? [d1, d2] : undefined; +>x316 : Base[] +>Array : Array +>Base : Base +>true ? [d1, d2] : undefined : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x317: { [n: number]: Base; } = true ? [d1, d2] : undefined; +>x317 : { [x: number]: Base; } +>n : number +>Base : Base +>true ? [d1, d2] : undefined : { [x: number]: Base; } +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x318: {n: Base[]; } = true ? { n: [d1, d2] } : undefined; +>x318 : { n: Base[]; } +>n : Base[] +>Base : Base +>true ? { n: [d1, d2] } : undefined : { n: Base[]; } +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +var x319: (s: Base[]) => any = true ? n => { var n: Base[]; return null; } : undefined; +>x319 : (s: Base[]) => any +>s : Base[] +>Base : Base +>true ? n => { var n: Base[]; return null; } : undefined : (s: Base[]) => any +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base +>undefined : undefined + +var x320: Genric = true ? { func: n => { return [d1, d2]; } } : undefined; +>x320 : Genric +>Genric : Genric +>Base : Base +>true ? { func: n => { return [d1, d2]; } } : undefined : Genric +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 +>undefined : undefined + +function x321(n: () => Base[]) { }; x321(() => [d1, d2]); +>x321 : (n: () => Base[]) => void +>n : () => Base[] +>Base : Base +>x321(() => [d1, d2]) : void +>x321 : (n: () => Base[]) => void +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x322(n: () => Base[]) { }; x322(function() { return [d1, d2] }); +>x322 : (n: () => Base[]) => void +>n : () => Base[] +>Base : Base +>x322(function() { return [d1, d2] }) : void +>x322 : (n: () => Base[]) => void +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x323(n: () => Base[]) { }; x323(function named() { return [d1, d2] }); +>x323 : (n: () => Base[]) => void +>n : () => Base[] +>Base : Base +>x323(function named() { return [d1, d2] }) : void +>x323 : (n: () => Base[]) => void +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x324(n: { (): Base[]; }) { }; x324(() => [d1, d2]); +>x324 : (n: () => Base[]) => void +>n : () => Base[] +>Base : Base +>x324(() => [d1, d2]) : void +>x324 : (n: () => Base[]) => void +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x325(n: { (): Base[]; }) { }; x325(function() { return [d1, d2] }); +>x325 : (n: () => Base[]) => void +>n : () => Base[] +>Base : Base +>x325(function() { return [d1, d2] }) : void +>x325 : (n: () => Base[]) => void +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x326(n: { (): Base[]; }) { }; x326(function named() { return [d1, d2] }); +>x326 : (n: () => Base[]) => void +>n : () => Base[] +>Base : Base +>x326(function named() { return [d1, d2] }) : void +>x326 : (n: () => Base[]) => void +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x327(n: Base[]) { }; x327([d1, d2]); +>x327 : (n: Base[]) => void +>n : Base[] +>Base : Base +>x327([d1, d2]) : void +>x327 : (n: Base[]) => void +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x328(n: Array) { }; x328([d1, d2]); +>x328 : (n: Base[]) => void +>n : Base[] +>Array : Array +>Base : Base +>x328([d1, d2]) : void +>x328 : (n: Base[]) => void +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x329(n: { [n: number]: Base; }) { }; x329([d1, d2]); +>x329 : (n: { [x: number]: Base; }) => void +>n : { [x: number]: Base; } +>n : number +>Base : Base +>x329([d1, d2]) : void +>x329 : (n: { [x: number]: Base; }) => void +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x330(n: {n: Base[]; } ) { }; x330({ n: [d1, d2] }); +>x330 : (n: { n: Base[]; }) => void +>n : { n: Base[]; } +>n : Base[] +>Base : Base +>x330({ n: [d1, d2] }) : void +>x330 : (n: { n: Base[]; }) => void +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +function x331(n: (s: Base[]) => any) { }; x331(n => { var n: Base[]; return null; }); +>x331 : (n: (s: Base[]) => any) => void +>n : (s: Base[]) => any +>s : Base[] +>Base : Base +>x331(n => { var n: Base[]; return null; }) : void +>x331 : (n: (s: Base[]) => any) => void +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +function x332(n: Genric) { }; x332({ func: n => { return [d1, d2]; } }); +>x332 : (n: Genric) => void +>n : Genric +>Genric : Genric +>Base : Base +>x332({ func: n => { return [d1, d2]; } }) : void +>x332 : (n: Genric) => void +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +var x333 = (n: () => Base[]) => n; x333(() => [d1, d2]); +>x333 : (n: () => Base[]) => () => Base[] +>(n: () => Base[]) => n : (n: () => Base[]) => () => Base[] +>n : () => Base[] +>Base : Base +>n : () => Base[] +>x333(() => [d1, d2]) : () => Base[] +>x333 : (n: () => Base[]) => () => Base[] +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x334 = (n: () => Base[]) => n; x334(function() { return [d1, d2] }); +>x334 : (n: () => Base[]) => () => Base[] +>(n: () => Base[]) => n : (n: () => Base[]) => () => Base[] +>n : () => Base[] +>Base : Base +>n : () => Base[] +>x334(function() { return [d1, d2] }) : () => Base[] +>x334 : (n: () => Base[]) => () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x335 = (n: () => Base[]) => n; x335(function named() { return [d1, d2] }); +>x335 : (n: () => Base[]) => () => Base[] +>(n: () => Base[]) => n : (n: () => Base[]) => () => Base[] +>n : () => Base[] +>Base : Base +>n : () => Base[] +>x335(function named() { return [d1, d2] }) : () => Base[] +>x335 : (n: () => Base[]) => () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x336 = (n: { (): Base[]; }) => n; x336(() => [d1, d2]); +>x336 : (n: () => Base[]) => () => Base[] +>(n: { (): Base[]; }) => n : (n: () => Base[]) => () => Base[] +>n : () => Base[] +>Base : Base +>n : () => Base[] +>x336(() => [d1, d2]) : () => Base[] +>x336 : (n: () => Base[]) => () => Base[] +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x337 = (n: { (): Base[]; }) => n; x337(function() { return [d1, d2] }); +>x337 : (n: () => Base[]) => () => Base[] +>(n: { (): Base[]; }) => n : (n: () => Base[]) => () => Base[] +>n : () => Base[] +>Base : Base +>n : () => Base[] +>x337(function() { return [d1, d2] }) : () => Base[] +>x337 : (n: () => Base[]) => () => Base[] +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x338 = (n: { (): Base[]; }) => n; x338(function named() { return [d1, d2] }); +>x338 : (n: () => Base[]) => () => Base[] +>(n: { (): Base[]; }) => n : (n: () => Base[]) => () => Base[] +>n : () => Base[] +>Base : Base +>n : () => Base[] +>x338(function named() { return [d1, d2] }) : () => Base[] +>x338 : (n: () => Base[]) => () => Base[] +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x339 = (n: Base[]) => n; x339([d1, d2]); +>x339 : (n: Base[]) => Base[] +>(n: Base[]) => n : (n: Base[]) => Base[] +>n : Base[] +>Base : Base +>n : Base[] +>x339([d1, d2]) : Base[] +>x339 : (n: Base[]) => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x340 = (n: Array) => n; x340([d1, d2]); +>x340 : (n: Base[]) => Base[] +>(n: Array) => n : (n: Base[]) => Base[] +>n : Base[] +>Array : Array +>Base : Base +>n : Base[] +>x340([d1, d2]) : Base[] +>x340 : (n: Base[]) => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x341 = (n: { [n: number]: Base; }) => n; x341([d1, d2]); +>x341 : (n: { [x: number]: Base; }) => { [x: number]: Base; } +>(n: { [n: number]: Base; }) => n : (n: { [x: number]: Base; }) => { [x: number]: Base; } +>n : { [x: number]: Base; } +>n : number +>Base : Base +>n : { [x: number]: Base; } +>x341([d1, d2]) : { [x: number]: Base; } +>x341 : (n: { [x: number]: Base; }) => { [x: number]: Base; } +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x342 = (n: {n: Base[]; } ) => n; x342({ n: [d1, d2] }); +>x342 : (n: { n: Base[]; }) => { n: Base[]; } +>(n: {n: Base[]; } ) => n : (n: { n: Base[]; }) => { n: Base[]; } +>n : { n: Base[]; } +>n : Base[] +>Base : Base +>n : { n: Base[]; } +>x342({ n: [d1, d2] }) : { n: Base[]; } +>x342 : (n: { n: Base[]; }) => { n: Base[]; } +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x343 = (n: (s: Base[]) => any) => n; x343(n => { var n: Base[]; return null; }); +>x343 : (n: (s: Base[]) => any) => (s: Base[]) => any +>(n: (s: Base[]) => any) => n : (n: (s: Base[]) => any) => (s: Base[]) => any +>n : (s: Base[]) => any +>s : Base[] +>Base : Base +>n : (s: Base[]) => any +>x343(n => { var n: Base[]; return null; }) : (s: Base[]) => any +>x343 : (n: (s: Base[]) => any) => (s: Base[]) => any +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +var x344 = (n: Genric) => n; x344({ func: n => { return [d1, d2]; } }); +>x344 : (n: Genric) => Genric +>(n: Genric) => n : (n: Genric) => Genric +>n : Genric +>Genric : Genric +>Base : Base +>n : Genric +>x344({ func: n => { return [d1, d2]; } }) : Genric +>x344 : (n: Genric) => Genric +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + +var x345 = function(n: () => Base[]) { }; x345(() => [d1, d2]); +>x345 : (n: () => Base[]) => void +>function(n: () => Base[]) { } : (n: () => Base[]) => void +>n : () => Base[] +>Base : Base +>x345(() => [d1, d2]) : void +>x345 : (n: () => Base[]) => void +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x346 = function(n: () => Base[]) { }; x346(function() { return [d1, d2] }); +>x346 : (n: () => Base[]) => void +>function(n: () => Base[]) { } : (n: () => Base[]) => void +>n : () => Base[] +>Base : Base +>x346(function() { return [d1, d2] }) : void +>x346 : (n: () => Base[]) => void +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x347 = function(n: () => Base[]) { }; x347(function named() { return [d1, d2] }); +>x347 : (n: () => Base[]) => void +>function(n: () => Base[]) { } : (n: () => Base[]) => void +>n : () => Base[] +>Base : Base +>x347(function named() { return [d1, d2] }) : void +>x347 : (n: () => Base[]) => void +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x348 = function(n: { (): Base[]; }) { }; x348(() => [d1, d2]); +>x348 : (n: () => Base[]) => void +>function(n: { (): Base[]; }) { } : (n: () => Base[]) => void +>n : () => Base[] +>Base : Base +>x348(() => [d1, d2]) : void +>x348 : (n: () => Base[]) => void +>() => [d1, d2] : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x349 = function(n: { (): Base[]; }) { }; x349(function() { return [d1, d2] }); +>x349 : (n: () => Base[]) => void +>function(n: { (): Base[]; }) { } : (n: () => Base[]) => void +>n : () => Base[] +>Base : Base +>x349(function() { return [d1, d2] }) : void +>x349 : (n: () => Base[]) => void +>function() { return [d1, d2] } : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x350 = function(n: { (): Base[]; }) { }; x350(function named() { return [d1, d2] }); +>x350 : (n: () => Base[]) => void +>function(n: { (): Base[]; }) { } : (n: () => Base[]) => void +>n : () => Base[] +>Base : Base +>x350(function named() { return [d1, d2] }) : void +>x350 : (n: () => Base[]) => void +>function named() { return [d1, d2] } : () => Base[] +>named : () => Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x351 = function(n: Base[]) { }; x351([d1, d2]); +>x351 : (n: Base[]) => void +>function(n: Base[]) { } : (n: Base[]) => void +>n : Base[] +>Base : Base +>x351([d1, d2]) : void +>x351 : (n: Base[]) => void +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x352 = function(n: Array) { }; x352([d1, d2]); +>x352 : (n: Base[]) => void +>function(n: Array) { } : (n: Base[]) => void +>n : Base[] +>Array : Array +>Base : Base +>x352([d1, d2]) : void +>x352 : (n: Base[]) => void +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x353 = function(n: { [n: number]: Base; }) { }; x353([d1, d2]); +>x353 : (n: { [x: number]: Base; }) => void +>function(n: { [n: number]: Base; }) { } : (n: { [x: number]: Base; }) => void +>n : { [x: number]: Base; } +>n : number +>Base : Base +>x353([d1, d2]) : void +>x353 : (n: { [x: number]: Base; }) => void +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x354 = function(n: {n: Base[]; } ) { }; x354({ n: [d1, d2] }); +>x354 : (n: { n: Base[]; }) => void +>function(n: {n: Base[]; } ) { } : (n: { n: Base[]; }) => void +>n : { n: Base[]; } +>n : Base[] +>Base : Base +>x354({ n: [d1, d2] }) : void +>x354 : (n: { n: Base[]; }) => void +>{ n: [d1, d2] } : { n: Base[]; } +>n : Base[] +>[d1, d2] : Base[] +>d1 : Derived1 +>d2 : Derived2 + +var x355 = function(n: (s: Base[]) => any) { }; x355(n => { var n: Base[]; return null; }); +>x355 : (n: (s: Base[]) => any) => void +>function(n: (s: Base[]) => any) { } : (n: (s: Base[]) => any) => void +>n : (s: Base[]) => any +>s : Base[] +>Base : Base +>x355(n => { var n: Base[]; return null; }) : void +>x355 : (n: (s: Base[]) => any) => void +>n => { var n: Base[]; return null; } : (n: Base[]) => any +>n : Base[] +>n : Base[] +>Base : Base + +var x356 = function(n: Genric) { }; x356({ func: n => { return [d1, d2]; } }); +>x356 : (n: Genric) => void +>function(n: Genric) { } : (n: Genric) => void +>n : Genric +>Genric : Genric +>Base : Base +>x356({ func: n => { return [d1, d2]; } }) : void +>x356 : (n: Genric) => void +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>func : (n: Base[]) => {}[] +>n => { return [d1, d2]; } : (n: Base[]) => {}[] +>n : Base[] +>[d1, d2] : {}[] +>d1 : Derived1 +>d2 : Derived2 + diff --git a/tests/baselines/reference/generativeRecursionWithTypeOf.types b/tests/baselines/reference/generativeRecursionWithTypeOf.types new file mode 100644 index 00000000000..1447c51358f --- /dev/null +++ b/tests/baselines/reference/generativeRecursionWithTypeOf.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/generativeRecursionWithTypeOf.ts === +class C { +>C : C +>T : T + + static foo(x: number) { } +>foo : (x: number) => void +>x : number + + type: T; +>type : T +>T : T +} + +module M { +>M : typeof M + + export function f(x: typeof C) { +>f : (x: typeof C) => C +>x : typeof C +>C : typeof C + + return new x(); +>new x() : C +>x : typeof C +>x : typeof C + } +} diff --git a/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName2.types b/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName2.types new file mode 100644 index 00000000000..27d9f801dcd --- /dev/null +++ b/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName2.types @@ -0,0 +1,54 @@ +=== tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName2.ts === +// generic and non-generic interfaces with the same name do not merge + +module M { +>M : M + + interface A { +>A : A +>T : T + + bar: T; +>bar : T +>T : T + } +} + +module M2 { +>M2 : M2 + + interface A { // ok +>A : A + + foo: string; +>foo : string + } +} + +module N { +>N : N + + module M { +>M : M + + interface A { +>A : A +>T : T + + bar: T; +>bar : T +>T : T + } + } + + module M2 { +>M2 : M2 + + interface A { // ok +>A : A + + foo: string; +>foo : string + } + } +} diff --git a/tests/baselines/reference/genericAndNonGenericOverload1.types b/tests/baselines/reference/genericAndNonGenericOverload1.types new file mode 100644 index 00000000000..13f8d49fc10 --- /dev/null +++ b/tests/baselines/reference/genericAndNonGenericOverload1.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/genericAndNonGenericOverload1.ts === +interface callable2 { +>callable2 : callable2 +>T : T + + (a: T): T; +>a : T +>T : T +>T : T + + (a: T): Z; +>Z : Z +>a : T +>T : T +>Z : Z +} +var c2: callable2; +>c2 : callable2 +>callable2 : callable2 + +c2(1); +>c2(1) : string +>c2 : callable2 + diff --git a/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types b/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types new file mode 100644 index 00000000000..d585e896c8f --- /dev/null +++ b/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types @@ -0,0 +1,67 @@ +=== tests/cases/compiler/genericArgumentCallSigAssignmentCompat.ts === +module Underscore { +>Underscore : Underscore + + export interface Iterator { +>Iterator : Iterator +>T : T +>U : U + + (value: T, index: any, list: any): U; +>value : T +>T : T +>index : any +>list : any +>U : U + } + + export interface Static { +>Static : Static + + all(list: T[], iterator?: Iterator, context?: any): boolean; +>all : (list: T[], iterator?: Iterator, context?: any) => boolean +>T : T +>list : T[] +>T : T +>iterator : Iterator +>Iterator : Iterator +>T : T +>context : any + + identity(value: T): T; +>identity : (value: T) => T +>T : T +>value : T +>T : T +>T : T + } +} + +declare var _: Underscore.Static; +>_ : Static +>Underscore : Underscore +>Static : Static + +// No error, Call signatures of types '(value: T) => T' and 'Underscore.Iterator<{}, boolean>' are compatible when instantiated with any. +// Ideally, we would not have a generic signature here, because it should be instantiated with {} during inferential typing +_.all([true, 1, null, 'yes'], _.identity); +>_.all([true, 1, null, 'yes'], _.identity) : boolean +>_.all : (list: T[], iterator?: Iterator, context?: any) => boolean +>_ : Static +>all : (list: T[], iterator?: Iterator, context?: any) => boolean +>[true, 1, null, 'yes'] : {}[] +>_.identity : (value: T) => T +>_ : Static +>identity : (value: T) => T + +// Ok, because fixing makes us infer boolean for T +_.all([true], _.identity); +>_.all([true], _.identity) : boolean +>_.all : (list: T[], iterator?: Iterator, context?: any) => boolean +>_ : Static +>all : (list: T[], iterator?: Iterator, context?: any) => boolean +>[true] : boolean[] +>_.identity : (value: T) => T +>_ : Static +>identity : (value: T) => T + diff --git a/tests/baselines/reference/genericArray0.types b/tests/baselines/reference/genericArray0.types new file mode 100644 index 00000000000..80a9d5199bd --- /dev/null +++ b/tests/baselines/reference/genericArray0.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/genericArray0.ts === + + +var x:number[]; +>x : number[] + + +var y = x; +>y : number[] +>x : number[] + +function map() { +>map : () => void +>U : U + + var ys: U[] = []; +>ys : U[] +>U : U +>[] : U[] +} + diff --git a/tests/baselines/reference/genericArray1.types b/tests/baselines/reference/genericArray1.types new file mode 100644 index 00000000000..09dbc55771d --- /dev/null +++ b/tests/baselines/reference/genericArray1.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/genericArray1.ts === +/* +var n: number[]; + +interface Array { +map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; +} + +interface String{ + length: number; +} +*/ + +var lengths = ["a", "b", "c"].map(x => x.length); +>lengths : number[] +>["a", "b", "c"].map(x => x.length) : number[] +>["a", "b", "c"].map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>["a", "b", "c"] : string[] +>map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>x => x.length : (x: string) => number +>x : string +>x.length : number +>x : string +>length : number + diff --git a/tests/baselines/reference/genericArrayPropertyAssignment.types b/tests/baselines/reference/genericArrayPropertyAssignment.types new file mode 100644 index 00000000000..ab3f47de813 --- /dev/null +++ b/tests/baselines/reference/genericArrayPropertyAssignment.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/genericArrayPropertyAssignment.ts === +function isEmpty(list: {length:number;}) +>isEmpty : (list: { length: number; }) => boolean +>list : { length: number; } +>length : number +{ +return list.length ===0; +>list.length ===0 : boolean +>list.length : number +>list : { length: number; } +>length : number +} + +isEmpty([]); // error +>isEmpty([]) : boolean +>isEmpty : (list: { length: number; }) => boolean +>[] : undefined[] + + diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty.types b/tests/baselines/reference/genericBaseClassLiteralProperty.types new file mode 100644 index 00000000000..4ed9b3f4d7d --- /dev/null +++ b/tests/baselines/reference/genericBaseClassLiteralProperty.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/genericBaseClassLiteralProperty.ts === +class BaseClass { +>BaseClass : BaseClass +>T : T + + public _getValue1: { (): T; }; +>_getValue1 : () => T +>T : T + + public _getValue2: () => T; +>_getValue2 : () => T +>T : T +} + +class SubClass extends BaseClass { +>SubClass : SubClass +>BaseClass : BaseClass + + public Error(): void { +>Error : () => void + + var x : number = this._getValue1(); +>x : number +>this._getValue1() : number +>this._getValue1 : () => number +>this : SubClass +>_getValue1 : () => number + + var y : number = this._getValue2(); +>y : number +>this._getValue2() : number +>this._getValue2 : () => number +>this : SubClass +>_getValue2 : () => number + } +} diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty2.types b/tests/baselines/reference/genericBaseClassLiteralProperty2.types new file mode 100644 index 00000000000..004dbac45bf --- /dev/null +++ b/tests/baselines/reference/genericBaseClassLiteralProperty2.types @@ -0,0 +1,44 @@ +=== tests/cases/compiler/genericBaseClassLiteralProperty2.ts === +class CollectionItem2 { } +>CollectionItem2 : CollectionItem2 + +class BaseCollection2 { +>BaseCollection2 : BaseCollection2 +>TItem : TItem +>CollectionItem2 : CollectionItem2 + + _itemsByKey: { [key: string]: TItem; }; +>_itemsByKey : { [x: string]: TItem; } +>key : string +>TItem : TItem + + constructor() { + this._itemsByKey = {}; +>this._itemsByKey = {} : { [x: string]: TItem; } +>this._itemsByKey : { [x: string]: TItem; } +>this : BaseCollection2 +>_itemsByKey : { [x: string]: TItem; } +>{} : { [x: string]: TItem; } + } +} + +class DataView2 extends BaseCollection2 { +>DataView2 : DataView2 +>BaseCollection2 : BaseCollection2 +>CollectionItem2 : CollectionItem2 + + fillItems(item: CollectionItem2) { +>fillItems : (item: CollectionItem2) => void +>item : CollectionItem2 +>CollectionItem2 : CollectionItem2 + + this._itemsByKey['dummy'] = item; +>this._itemsByKey['dummy'] = item : CollectionItem2 +>this._itemsByKey['dummy'] : CollectionItem2 +>this._itemsByKey : { [x: string]: CollectionItem2; } +>this : DataView2 +>_itemsByKey : { [x: string]: CollectionItem2; } +>item : CollectionItem2 + } +} + diff --git a/tests/baselines/reference/genericCallTypeArgumentInference.types b/tests/baselines/reference/genericCallTypeArgumentInference.types new file mode 100644 index 00000000000..b1ba19baac8 --- /dev/null +++ b/tests/baselines/reference/genericCallTypeArgumentInference.types @@ -0,0 +1,366 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallTypeArgumentInference.ts === +// Basic type inference with generic calls, no errors expected + +function foo(t: T) { +>foo : (t: T) => T +>T : T +>t : T +>T : T + + return t; +>t : T +} + +var r = foo(''); // string +>r : string +>foo('') : string +>foo : (t: T) => T + +function foo2(t: T, u: U) { +>foo2 : (t: T, u: U) => U +>T : T +>U : U +>t : T +>T : T +>u : U +>U : U + + return u; +>u : U +} + +function foo2b(u: U) { +>foo2b : (u: U) => T +>T : T +>U : U +>u : U +>U : U + + var x: T; +>x : T +>T : T + + return x; +>x : T +} + +var r2 = foo2('', 1); // number +>r2 : number +>foo2('', 1) : number +>foo2 : (t: T, u: U) => U + +var r3 = foo2b(1); // {} +>r3 : {} +>foo2b(1) : {} +>foo2b : (u: U) => T + +class C { +>C : C +>T : T +>U : U + + constructor(public t: T, public u: U) { +>t : T +>T : T +>u : U +>U : U + } + + foo(t: T, u: U) { +>foo : (t: T, u: U) => T +>t : T +>T : T +>u : U +>U : U + + return t; +>t : T + } + + foo2(t: T, u: U) { +>foo2 : (t: T, u: U) => U +>t : T +>T : T +>u : U +>U : U + + return u; +>u : U + } + + foo3(t: T, u: U) { +>foo3 : (t: T, u: U) => T +>T : T +>t : T +>T : T +>u : U +>U : U + + return t; +>t : T + } + + foo4(t: T, u: U) { +>foo4 : (t: T, u: U) => T +>U : U +>t : T +>T : T +>u : U +>U : U + + return t; +>t : T + } + + foo5(t: T, u: U) { +>foo5 : (t: T, u: U) => T +>T : T +>U : U +>t : T +>T : T +>u : U +>U : U + + return t; +>t : T + } + + foo6() { +>foo6 : () => T +>T : T +>U : U + + var x: T; +>x : T +>T : T + + return x; +>x : T + } + + foo7(u: U) { +>foo7 : (u: U) => T +>T : T +>U : U +>u : U +>U : U + + var x: T; +>x : T +>T : T + + return x; +>x : T + } + + foo8() { +>foo8 : () => T +>T : T +>U : U + + var x: T; +>x : T +>T : T + + return x; +>x : T + } +} + +var c = new C('', 1); +>c : C +>new C('', 1) : C +>C : typeof C + +var r4 = c.foo('', 1); // string +>r4 : string +>c.foo('', 1) : string +>c.foo : (t: string, u: number) => string +>c : C +>foo : (t: string, u: number) => string + +var r5 = c.foo2('', 1); // number +>r5 : number +>c.foo2('', 1) : number +>c.foo2 : (t: string, u: number) => number +>c : C +>foo2 : (t: string, u: number) => number + +var r6 = c.foo3(true, 1); // boolean +>r6 : boolean +>c.foo3(true, 1) : boolean +>c.foo3 : (t: T, u: number) => T +>c : C +>foo3 : (t: T, u: number) => T + +var r7 = c.foo4('', true); // string +>r7 : string +>c.foo4('', true) : string +>c.foo4 : (t: string, u: U) => string +>c : C +>foo4 : (t: string, u: U) => string + +var r8 = c.foo5(true, 1); // boolean +>r8 : boolean +>c.foo5(true, 1) : boolean +>c.foo5 : (t: T, u: U) => T +>c : C +>foo5 : (t: T, u: U) => T + +var r9 = c.foo6(); // {} +>r9 : {} +>c.foo6() : {} +>c.foo6 : () => T +>c : C +>foo6 : () => T + +var r10 = c.foo7(''); // {} +>r10 : {} +>c.foo7('') : {} +>c.foo7 : (u: U) => T +>c : C +>foo7 : (u: U) => T + +var r11 = c.foo8(); // {} +>r11 : {} +>c.foo8() : {} +>c.foo8 : () => T +>c : C +>foo8 : () => T + +interface I { +>I : I +>T : T +>U : U + + new (t: T, u: U); +>t : T +>T : T +>u : U +>U : U + + foo(t: T, u: U): T; +>foo : (t: T, u: U) => T +>t : T +>T : T +>u : U +>U : U +>T : T + + foo2(t: T, u: U): U; +>foo2 : (t: T, u: U) => U +>t : T +>T : T +>u : U +>U : U +>U : U + + foo3(t: T, u: U): T; +>foo3 : (t: T, u: U) => T +>T : T +>t : T +>T : T +>u : U +>U : U +>T : T + + foo4(t: T, u: U): T; +>foo4 : (t: T, u: U) => T +>U : U +>t : T +>T : T +>u : U +>U : U +>T : T + + foo5(t: T, u: U): T; +>foo5 : (t: T, u: U) => T +>T : T +>U : U +>t : T +>T : T +>u : U +>U : U +>T : T + + foo6(): T; +>foo6 : () => T +>T : T +>U : U +>T : T + + foo7(u: U): T; +>foo7 : (u: U) => T +>T : T +>U : U +>u : U +>U : U +>T : T + + foo8(): T; +>foo8 : () => T +>T : T +>U : U +>T : T +} + +var i: I; +>i : I +>I : I + +var r4 = i.foo('', 1); // string +>r4 : string +>i.foo('', 1) : string +>i.foo : (t: string, u: number) => string +>i : I +>foo : (t: string, u: number) => string + +var r5 = i.foo2('', 1); // number +>r5 : number +>i.foo2('', 1) : number +>i.foo2 : (t: string, u: number) => number +>i : I +>foo2 : (t: string, u: number) => number + +var r6 = i.foo3(true, 1); // boolean +>r6 : boolean +>i.foo3(true, 1) : boolean +>i.foo3 : (t: T, u: number) => T +>i : I +>foo3 : (t: T, u: number) => T + +var r7 = i.foo4('', true); // string +>r7 : string +>i.foo4('', true) : string +>i.foo4 : (t: string, u: U) => string +>i : I +>foo4 : (t: string, u: U) => string + +var r8 = i.foo5(true, 1); // boolean +>r8 : boolean +>i.foo5(true, 1) : boolean +>i.foo5 : (t: T, u: U) => T +>i : I +>foo5 : (t: T, u: U) => T + +var r9 = i.foo6(); // {} +>r9 : {} +>i.foo6() : {} +>i.foo6 : () => T +>i : I +>foo6 : () => T + +var r10 = i.foo7(''); // {} +>r10 : {} +>i.foo7('') : {} +>i.foo7 : (u: U) => T +>i : I +>foo7 : (u: U) => T + +var r11 = i.foo8(); // {} +>r11 : {} +>i.foo8() : {} +>i.foo8 : () => T +>i : I +>foo8 : () => T + diff --git a/tests/baselines/reference/genericCallWithArrayLiteralArgs.types b/tests/baselines/reference/genericCallWithArrayLiteralArgs.types new file mode 100644 index 00000000000..c79efb0792c --- /dev/null +++ b/tests/baselines/reference/genericCallWithArrayLiteralArgs.types @@ -0,0 +1,60 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithArrayLiteralArgs.ts === +function foo(t: T) { +>foo : (t: T) => T +>T : T +>t : T +>T : T + + return t; +>t : T +} + +var r = foo([1, 2]); // number[] +>r : number[] +>foo([1, 2]) : number[] +>foo : (t: T) => T +>[1, 2] : number[] + +var r = foo([1, 2]); // number[] +>r : number[] +>foo([1, 2]) : number[] +>foo : (t: T) => T +>[1, 2] : number[] + +var ra = foo([1, 2]); // any[] +>ra : any[] +>foo([1, 2]) : any[] +>foo : (t: T) => T +>[1, 2] : any[] + +var r2 = foo([]); // any[] +>r2 : any[] +>foo([]) : any[] +>foo : (t: T) => T +>[] : any[] + +var r3 = foo([]); // number[] +>r3 : number[] +>foo([]) : number[] +>foo : (t: T) => T +>[] : number[] + +var r4 = foo([1, '']); // {}[] +>r4 : {}[] +>foo([1, '']) : {}[] +>foo : (t: T) => T +>[1, ''] : {}[] + +var r5 = foo([1, '']); // any[] +>r5 : any[] +>foo([1, '']) : any[] +>foo : (t: T) => T +>[1, ''] : any[] + +var r6 = foo([1, '']); // Object[] +>r6 : Object[] +>foo([1, '']) : Object[] +>foo : (t: T) => T +>Object : Object +>[1, ''] : Object[] + diff --git a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.types b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.types new file mode 100644 index 00000000000..ee6e2388eae --- /dev/null +++ b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.types @@ -0,0 +1,488 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference.ts === +// Basic type inference with generic calls and constraints, no errors expected + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Derived { baz: string; } +>Derived2 : Derived2 +>Derived : Derived +>baz : string + +var b: Base; +>b : Base +>Base : Base + +var d1: Derived; +>d1 : Derived +>Derived : Derived + +var d2: Derived2; +>d2 : Derived2 +>Derived2 : Derived2 + +function foo(t: T) { +>foo : (t: T) => T +>T : T +>Base : Base +>t : T +>T : T + + return t; +>t : T +} + +var r = foo(b); // Base +>r : Base +>foo(b) : Base +>foo : (t: T) => T +>b : Base + +var r2 = foo(d1); // Derived +>r2 : Derived +>foo(d1) : Derived +>foo : (t: T) => T +>d1 : Derived + +function foo2(t: T, u: U) { +>foo2 : (t: T, u: U) => U +>T : T +>Base : Base +>U : U +>Derived : Derived +>t : T +>T : T +>u : U +>U : U + + return u; +>u : U +} + +function foo2b(u: U) { +>foo2b : (u: U) => T +>T : T +>Base : Base +>U : U +>Derived : Derived +>u : U +>U : U + + var x: T; +>x : T +>T : T + + return x; +>x : T +} + +function foo2c() { +>foo2c : () => T +>T : T +>Base : Base +>U : U +>Derived : Derived + + var x: T; +>x : T +>T : T + + return x; +>x : T +} + +var r3 = foo2b(d1); // Base +>r3 : Base +>foo2b(d1) : Base +>foo2b : (u: U) => T +>d1 : Derived + +var r3b = foo2c(); // Base +>r3b : Base +>foo2c() : Base +>foo2c : () => T + +class C { +>C : C +>T : T +>Base : Base +>U : U +>Derived : Derived + + constructor(public t: T, public u: U) { +>t : T +>T : T +>u : U +>U : U + } + + foo(t: T, u: U) { +>foo : (t: T, u: U) => T +>t : T +>T : T +>u : U +>U : U + + return t; +>t : T + } + + foo2(t: T, u: U) { +>foo2 : (t: T, u: U) => U +>t : T +>T : T +>u : U +>U : U + + return u; +>u : U + } + + foo3(t: T, u: U) { +>foo3 : (t: T, u: U) => T +>T : T +>Derived : Derived +>t : T +>T : T +>u : U +>U : U + + return t; +>t : T + } + + foo4(t: T, u: U) { +>foo4 : (t: T, u: U) => T +>U : U +>Derived2 : Derived2 +>t : T +>T : T +>u : U +>U : U + + return t; +>t : T + } + + foo5(t: T, u: U) { +>foo5 : (t: T, u: U) => T +>T : T +>Derived : Derived +>U : U +>Derived2 : Derived2 +>t : T +>T : T +>u : U +>U : U + + return t; +>t : T + } + + foo6() { +>foo6 : () => T +>T : T +>Derived : Derived +>U : U +>Derived2 : Derived2 + + var x: T; +>x : T +>T : T + + return x; +>x : T + } + + foo7(u: U) { +>foo7 : (u: U) => T +>T : T +>Base : Base +>U : U +>Derived : Derived +>u : U +>U : U + + var x: T; +>x : T +>T : T + + return x; +>x : T + } + + foo8() { +>foo8 : () => T +>T : T +>Base : Base +>U : U +>Derived : Derived + + var x: T; +>x : T +>T : T + + return x; +>x : T + } +} + +var c = new C(b, d1); +>c : C +>new C(b, d1) : C +>C : typeof C +>b : Base +>d1 : Derived + +var r4 = c.foo(d1, d2); // Base +>r4 : Base +>c.foo(d1, d2) : Base +>c.foo : (t: Base, u: Derived) => Base +>c : C +>foo : (t: Base, u: Derived) => Base +>d1 : Derived +>d2 : Derived2 + +var r5 = c.foo2(b, d2); // Derived +>r5 : Derived +>c.foo2(b, d2) : Derived +>c.foo2 : (t: Base, u: Derived) => Derived +>c : C +>foo2 : (t: Base, u: Derived) => Derived +>b : Base +>d2 : Derived2 + +var r6 = c.foo3(d1, d1); // Derived +>r6 : Derived +>c.foo3(d1, d1) : Derived +>c.foo3 : (t: T, u: Derived) => T +>c : C +>foo3 : (t: T, u: Derived) => T +>d1 : Derived +>d1 : Derived + +var r7 = c.foo4(d1, d2); // Base +>r7 : Base +>c.foo4(d1, d2) : Base +>c.foo4 : (t: Base, u: U) => Base +>c : C +>foo4 : (t: Base, u: U) => Base +>d1 : Derived +>d2 : Derived2 + +var r8 = c.foo5(d1, d2); // Derived +>r8 : Derived +>c.foo5(d1, d2) : Derived +>c.foo5 : (t: T, u: U) => T +>c : C +>foo5 : (t: T, u: U) => T +>d1 : Derived +>d2 : Derived2 + +var r8b = c.foo5(d2, d2); // Derived2 +>r8b : Derived2 +>c.foo5(d2, d2) : Derived2 +>c.foo5 : (t: T, u: U) => T +>c : C +>foo5 : (t: T, u: U) => T +>d2 : Derived2 +>d2 : Derived2 + +var r9 = c.foo6(); // Derived +>r9 : Derived +>c.foo6() : Derived +>c.foo6 : () => T +>c : C +>foo6 : () => T + +var r10 = c.foo7(d1); // Base +>r10 : Base +>c.foo7(d1) : Base +>c.foo7 : (u: U) => T +>c : C +>foo7 : (u: U) => T +>d1 : Derived + +var r11 = c.foo8(); // Base +>r11 : Base +>c.foo8() : Base +>c.foo8 : () => T +>c : C +>foo8 : () => T + +interface I { +>I : I +>T : T +>Base : Base +>U : U +>Derived : Derived + + new (t: T, u: U); +>t : T +>T : T +>u : U +>U : U + + foo(t: T, u: U): T; +>foo : (t: T, u: U) => T +>t : T +>T : T +>u : U +>U : U +>T : T + + foo2(t: T, u: U): U; +>foo2 : (t: T, u: U) => U +>t : T +>T : T +>u : U +>U : U +>U : U + + foo3(t: T, u: U): T; +>foo3 : (t: T, u: U) => T +>T : T +>Derived : Derived +>t : T +>T : T +>u : U +>U : U +>T : T + + foo4(t: T, u: U): T; +>foo4 : (t: T, u: U) => T +>U : U +>Derived2 : Derived2 +>t : T +>T : T +>u : U +>U : U +>T : T + + foo5(t: T, u: U): T; +>foo5 : (t: T, u: U) => T +>T : T +>Derived : Derived +>U : U +>Derived2 : Derived2 +>t : T +>T : T +>u : U +>U : U +>T : T + + foo6(): T; +>foo6 : () => T +>T : T +>Derived : Derived +>U : U +>Derived2 : Derived2 +>T : T + + foo7(u: U): T; +>foo7 : (u: U) => T +>T : T +>Base : Base +>U : U +>Derived : Derived +>u : U +>U : U +>T : T + + foo8(): T; +>foo8 : () => T +>T : T +>Base : Base +>U : U +>Derived : Derived +>T : T +} + +var i: I; +>i : I +>I : I +>Base : Base +>Derived : Derived + +var r4 = i.foo(d1, d2); // Base +>r4 : Base +>i.foo(d1, d2) : Base +>i.foo : (t: Base, u: Derived) => Base +>i : I +>foo : (t: Base, u: Derived) => Base +>d1 : Derived +>d2 : Derived2 + +var r5 = i.foo2(b, d2); // Derived +>r5 : Derived +>i.foo2(b, d2) : Derived +>i.foo2 : (t: Base, u: Derived) => Derived +>i : I +>foo2 : (t: Base, u: Derived) => Derived +>b : Base +>d2 : Derived2 + +var r6 = i.foo3(d1, d1); // Derived +>r6 : Derived +>i.foo3(d1, d1) : Derived +>i.foo3 : (t: T, u: Derived) => T +>i : I +>foo3 : (t: T, u: Derived) => T +>d1 : Derived +>d1 : Derived + +var r7 = i.foo4(d1, d2); // Base +>r7 : Base +>i.foo4(d1, d2) : Base +>i.foo4 : (t: Base, u: U) => Base +>i : I +>foo4 : (t: Base, u: U) => Base +>d1 : Derived +>d2 : Derived2 + +var r8 = i.foo5(d1, d2); // Derived +>r8 : Derived +>i.foo5(d1, d2) : Derived +>i.foo5 : (t: T, u: U) => T +>i : I +>foo5 : (t: T, u: U) => T +>d1 : Derived +>d2 : Derived2 + +var r8b = i.foo5(d2, d2); // Derived2 +>r8b : Derived2 +>i.foo5(d2, d2) : Derived2 +>i.foo5 : (t: T, u: U) => T +>i : I +>foo5 : (t: T, u: U) => T +>d2 : Derived2 +>d2 : Derived2 + +var r9 = i.foo6(); // Derived +>r9 : Derived +>i.foo6() : Derived +>i.foo6 : () => T +>i : I +>foo6 : () => T + +var r10 = i.foo7(d1); // Base +>r10 : Base +>i.foo7(d1) : Base +>i.foo7 : (u: U) => T +>i : I +>foo7 : (u: U) => T +>d1 : Derived + +var r11 = i.foo8(); // Base +>r11 : Base +>i.foo8() : Base +>i.foo8 : () => T +>i : I +>foo8 : () => T + diff --git a/tests/baselines/reference/genericCallWithFixedArguments.types b/tests/baselines/reference/genericCallWithFixedArguments.types new file mode 100644 index 00000000000..acfad45a0f2 --- /dev/null +++ b/tests/baselines/reference/genericCallWithFixedArguments.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/genericCallWithFixedArguments.ts === +class A { foo() { } } +>A : A +>foo : () => void + +class B { bar() { }} +>B : B +>bar : () => void + +function g(x) { } +>g : (x: any) => void +>T : T +>U : U +>x : any + +g(7) // the parameter list is fixed, so this should not error +>g(7) : void +>g : (x: any) => void +>A : A +>B : B + + diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.types b/tests/baselines/reference/genericCallWithFunctionTypedArguments.types new file mode 100644 index 00000000000..2d3b234d0e1 --- /dev/null +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.types @@ -0,0 +1,173 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts === +// Generic functions used as arguments for function typed parameters are not used to make inferences from +// Using function arguments, no errors expected + +function foo(x: (a: T) => T) { +>foo : (x: (a: T) => T) => T +>T : T +>x : (a: T) => T +>a : T +>T : T +>T : T + + return x(null); +>x(null) : T +>x : (a: T) => T +} + +var r = foo((x: U) => ''); // {} +>r : {} +>foo((x: U) => '') : {} +>foo : (x: (a: T) => T) => T +>(x: U) => '' : (x: U) => string +>U : U +>x : U +>U : U + +var r2 = foo((x: U) => ''); // string +>r2 : string +>foo((x: U) => '') : string +>foo : (x: (a: T) => T) => T +>(x: U) => '' : (x: U) => string +>U : U +>x : U +>U : U + +var r3 = foo(x => ''); // {} +>r3 : {} +>foo(x => '') : {} +>foo : (x: (a: T) => T) => T +>x => '' : (x: {}) => string +>x : {} + +function foo2(x: T, cb: (a: T) => U) { +>foo2 : (x: T, cb: (a: T) => U) => U +>T : T +>U : U +>x : T +>T : T +>cb : (a: T) => U +>a : T +>T : T +>U : U + + return cb(x); +>cb(x) : U +>cb : (a: T) => U +>x : T +} + +var r4 = foo2(1, function (a: Z) { return '' }); // string, contextual signature instantiation is applied to generic functions +>r4 : string +>foo2(1, function (a: Z) { return '' }) : string +>foo2 : (x: T, cb: (a: T) => U) => U +>function (a: Z) { return '' } : (a: Z) => string +>Z : Z +>a : Z +>Z : Z + +var r5 = foo2(1, (a) => ''); // string +>r5 : string +>foo2(1, (a) => '') : string +>foo2 : (x: T, cb: (a: T) => U) => U +>(a) => '' : (a: number) => string +>a : number + +var r6 = foo2('', (a: Z) => 1); +>r6 : number +>foo2('', (a: Z) => 1) : number +>foo2 : (x: T, cb: (a: T) => U) => U +>(a: Z) => 1 : (a: Z) => number +>Z : Z +>a : Z +>Z : Z + +function foo3(x: T, cb: (a: T) => U, y: U) { +>foo3 : (x: T, cb: (a: T) => U, y: U) => U +>T : T +>U : U +>x : T +>T : T +>cb : (a: T) => U +>a : T +>T : T +>U : U +>y : U +>U : U + + return cb(x); +>cb(x) : U +>cb : (a: T) => U +>x : T +} + +var r7 = foo3(1, (a: Z) => '', ''); // string +>r7 : string +>foo3(1, (a: Z) => '', '') : string +>foo3 : (x: T, cb: (a: T) => U, y: U) => U +>(a: Z) => '' : (a: Z) => string +>Z : Z +>a : Z +>Z : Z + +var r8 = foo3(1, function (a) { return '' }, 1); // {} +>r8 : {} +>foo3(1, function (a) { return '' }, 1) : {} +>foo3 : (x: T, cb: (a: T) => U, y: U) => U +>function (a) { return '' } : (a: number) => string +>a : number + +var r9 = foo3(1, (a) => '', ''); // string +>r9 : string +>foo3(1, (a) => '', '') : string +>foo3 : (x: T, cb: (a: T) => U, y: U) => U +>(a) => '' : (a: number) => string +>a : number + +function other(t: T, u: U) { +>other : (t: T, u: U) => void +>T : T +>U : U +>t : T +>T : T +>u : U +>U : U + + var r10 = foo2(1, (x: T) => ''); // string, non-generic signature allows inferences to be made +>r10 : string +>foo2(1, (x: T) => '') : string +>foo2 : (x: T, cb: (a: T) => U) => U +>(x: T) => '' : (x: T) => string +>x : T +>T : T + + var r10 = foo2(1, (x) => ''); // string +>r10 : string +>foo2(1, (x) => '') : string +>foo2 : (x: T, cb: (a: T) => U) => U +>(x) => '' : (x: number) => string +>x : number + + var r11 = foo3(1, (x: T) => '', ''); // string +>r11 : string +>foo3(1, (x: T) => '', '') : string +>foo3 : (x: T, cb: (a: T) => U, y: U) => U +>(x: T) => '' : (x: T) => string +>x : T +>T : T + + var r11b = foo3(1, (x: T) => '', 1); // {} +>r11b : {} +>foo3(1, (x: T) => '', 1) : {} +>foo3 : (x: T, cb: (a: T) => U, y: U) => U +>(x: T) => '' : (x: T) => string +>x : T +>T : T + + var r12 = foo3(1, function (a) { return '' }, 1); // {} +>r12 : {} +>foo3(1, function (a) { return '' }, 1) : {} +>foo3 : (x: T, cb: (a: T) => U, y: U) => U +>function (a) { return '' } : (a: number) => string +>a : number +} diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments2.types b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.types new file mode 100644 index 00000000000..11b1ca59aae --- /dev/null +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.types @@ -0,0 +1,161 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts === +// Generic functions used as arguments for function typed parameters are not used to make inferences from +// Using construct signature arguments, no errors expected + +function foo(x: new(a: T) => T) { +>foo : (x: new (a: T) => T) => T +>T : T +>x : new (a: T) => T +>a : T +>T : T +>T : T + + return new x(null); +>new x(null) : T +>x : new (a: T) => T +} + +interface I { +>I : I + + new (x: T): T; +>T : T +>x : T +>T : T +>T : T +} +interface I2 { +>I2 : I2 +>T : T + + new (x: T): T; +>x : T +>T : T +>T : T +} +var i: I; +>i : I +>I : I + +var i2: I2; +>i2 : I2 +>I2 : I2 + +var a: { +>a : new (x: T) => T + + new (x: T): T; +>T : T +>x : T +>T : T +>T : T +} + +var r = foo(i); // any +>r : any +>foo(i) : any +>foo : (x: new (a: T) => T) => T +>i : I + +var r2 = foo(i); // string +>r2 : string +>foo(i) : string +>foo : (x: new (a: T) => T) => T +>i : I + +var r3 = foo(i2); // string +>r3 : string +>foo(i2) : string +>foo : (x: new (a: T) => T) => T +>i2 : I2 + +var r3b = foo(a); // any +>r3b : any +>foo(a) : any +>foo : (x: new (a: T) => T) => T +>a : new (x: T) => T + +function foo2(x: T, cb: new(a: T) => U) { +>foo2 : (x: T, cb: new (a: T) => U) => U +>T : T +>U : U +>x : T +>T : T +>cb : new (a: T) => U +>a : T +>T : T +>U : U + + return new cb(x); +>new cb(x) : U +>cb : new (a: T) => U +>x : T +} + +var r4 = foo2(1, i2); // string, instantiated generic +>r4 : string +>foo2(1, i2) : string +>foo2 : (x: T, cb: new (a: T) => U) => U +>i2 : I2 + +var r4b = foo2(1, a); // any +>r4b : any +>foo2(1, a) : any +>foo2 : (x: T, cb: new (a: T) => U) => U +>a : new (x: T) => T + +var r5 = foo2(1, i); // any +>r5 : any +>foo2(1, i) : any +>foo2 : (x: T, cb: new (a: T) => U) => U +>i : I + +var r6 = foo2('', i2); // string +>r6 : string +>foo2('', i2) : string +>foo2 : (x: T, cb: new (a: T) => U) => U +>i2 : I2 + +function foo3(x: T, cb: new(a: T) => U, y: U) { +>foo3 : (x: T, cb: new (a: T) => U, y: U) => U +>T : T +>U : U +>x : T +>T : T +>cb : new (a: T) => U +>a : T +>T : T +>U : U +>y : U +>U : U + + return new cb(x); +>new cb(x) : U +>cb : new (a: T) => U +>x : T +} + +var r7 = foo3(null, i, ''); // any +>r7 : any +>foo3(null, i, '') : any +>foo3 : (x: T, cb: new (a: T) => U, y: U) => U +>i : I + +var r7b = foo3(null, a, ''); // any +>r7b : any +>foo3(null, a, '') : any +>foo3 : (x: T, cb: new (a: T) => U, y: U) => U +>a : new (x: T) => T + +var r8 = foo3(1, i2, 1); // {} +>r8 : {} +>foo3(1, i2, 1) : {} +>foo3 : (x: T, cb: new (a: T) => U, y: U) => U +>i2 : I2 + +var r9 = foo3('', i2, ''); // string +>r9 : string +>foo3('', i2, '') : string +>foo3 : (x: T, cb: new (a: T) => U, y: U) => U +>i2 : I2 + diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments3.types b/tests/baselines/reference/genericCallWithFunctionTypedArguments3.types new file mode 100644 index 00000000000..a6e491d3eb8 --- /dev/null +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments3.types @@ -0,0 +1,56 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments3.ts === +// No inference is made from function typed arguments which have multiple call signatures + +var a: { +>a : { (x: boolean): boolean; (x: string): any; } + + (x: boolean): boolean; +>x : boolean + + (x: string): any; +>x : string +} + +function foo4(cb: (x: T) => U) { +>foo4 : (cb: (x: T) => U) => U +>T : T +>U : U +>cb : (x: T) => U +>x : T +>T : T +>U : U + + var u: U; +>u : U +>U : U + + return u; +>u : U +} + +var r = foo4(a); // T is {} (candidates boolean and string), U is any (candidates any and boolean) +>r : any +>foo4(a) : any +>foo4 : (cb: (x: T) => U) => U +>a : { (x: boolean): boolean; (x: string): any; } + +var b: { +>b : { (x: boolean): T; (x: T): any; } + + (x: boolean): T; +>T : T +>x : boolean +>T : T + + (x: T): any; +>T : T +>x : T +>T : T +} + +var r2 = foo4(b); // T is {} (candidates boolean and {}), U is any (candidates any and {}) +>r2 : any +>foo4(b) : any +>foo4 : (cb: (x: T) => U) => U +>b : { (x: boolean): T; (x: T): any; } + diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments4.types b/tests/baselines/reference/genericCallWithFunctionTypedArguments4.types new file mode 100644 index 00000000000..bf4e1eb749c --- /dev/null +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments4.types @@ -0,0 +1,66 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments4.ts === +// No inference is made from function typed arguments which have multiple call signatures + +class C { foo: string } +>C : C +>foo : string + +class D { bar: string } +>D : D +>bar : string + +var a: { +>a : { new (x: boolean): C; new (x: string): D; } + + new(x: boolean): C; +>x : boolean +>C : C + + new(x: string): D; +>x : string +>D : D +} + +function foo4(cb: new(x: T) => U) { +>foo4 : (cb: new (x: T) => U) => U +>T : T +>U : U +>cb : new (x: T) => U +>x : T +>T : T +>U : U + + var u: U; +>u : U +>U : U + + return u; +>u : U +} + +var r = foo4(a); // T is {} (candidates boolean and string), U is {} (candidates C and D) +>r : D +>foo4(a) : D +>foo4 : (cb: new (x: T) => U) => U +>a : { new (x: boolean): C; new (x: string): D; } + +var b: { +>b : { new (x: boolean): T; new (x: T): any; } + + new(x: boolean): T; +>T : T +>x : boolean +>T : T + + new(x: T): any; +>T : T +>x : T +>T : T +} + +var r2 = foo4(b); // T is {} (candidates boolean and {}), U is any (candidates any and {}) +>r2 : any +>foo4(b) : any +>foo4 : (cb: new (x: T) => U) => U +>b : { new (x: boolean): T; new (x: T): any; } + diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments.types b/tests/baselines/reference/genericCallWithGenericSignatureArguments.types new file mode 100644 index 00000000000..9f634070b56 --- /dev/null +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments.types @@ -0,0 +1,216 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts === +// When a function expression is inferentially typed (section 4.9.3) and a type assigned to a parameter in that expression references type parameters for which inferences are being made, +// the corresponding inferred type arguments to become fixed and no further candidate inferences are made for them. + +function foo(a: (x: T) => T, b: (x: T) => T) { +>foo : (a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>T : T +>a : (x: T) => T +>x : T +>T : T +>T : T +>b : (x: T) => T +>x : T +>T : T +>T : T + + var r: (x: T) => T; +>r : (x: T) => T +>x : T +>T : T +>T : T + + return r; +>r : (x: T) => T +} + +//var r1 = foo((x: number) => 1, (x: string) => ''); // error +var r1b = foo((x) => 1, (x) => ''); // {} => {} +>r1b : (x: {}) => {} +>foo((x) => 1, (x) => '') : (x: {}) => {} +>foo : (a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>(x) => 1 : (x: {}) => number +>x : {} +>(x) => '' : (x: {}) => string +>x : {} + +var r2 = foo((x: Object) => null, (x: string) => ''); // Object => Object +>r2 : (x: any) => any +>foo((x: Object) => null, (x: string) => '') : (x: any) => any +>foo : (a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>(x: Object) => null : (x: Object) => any +>x : Object +>Object : Object +>(x: string) => '' : (x: string) => string +>x : string + +var r3 = foo((x: number) => 1, (x: Object) => null); // number => number +>r3 : (x: any) => any +>foo((x: number) => 1, (x: Object) => null) : (x: any) => any +>foo : (a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>(x: number) => 1 : (x: number) => number +>x : number +>(x: Object) => null : (x: Object) => any +>x : Object +>Object : Object + +var r3ii = foo((x: number) => 1, (x: number) => 1); // number => number +>r3ii : (x: number) => number +>foo((x: number) => 1, (x: number) => 1) : (x: number) => number +>foo : (a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>(x: number) => 1 : (x: number) => number +>x : number +>(x: number) => 1 : (x: number) => number +>x : number + +var a: { x: number; y?: number; }; +>a : { x: number; y?: number; } +>x : number +>y : number + +var b: { x: number; z?: number; }; +>b : { x: number; z?: number; } +>x : number +>z : number + +var r4 = foo((x: typeof a) => a, (x: typeof b) => b); // typeof a => typeof a +>r4 : (x: { x: number; y?: number; }) => { x: number; y?: number; } +>foo((x: typeof a) => a, (x: typeof b) => b) : (x: { x: number; y?: number; }) => { x: number; y?: number; } +>foo : (a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>(x: typeof a) => a : (x: { x: number; y?: number; }) => { x: number; y?: number; } +>x : { x: number; y?: number; } +>a : { x: number; y?: number; } +>a : { x: number; y?: number; } +>(x: typeof b) => b : (x: { x: number; z?: number; }) => { x: number; z?: number; } +>x : { x: number; z?: number; } +>b : { x: number; z?: number; } +>b : { x: number; z?: number; } + +var r5 = foo((x: typeof b) => b, (x: typeof a) => a); // typeof b => typeof b +>r5 : (x: { x: number; z?: number; }) => { x: number; z?: number; } +>foo((x: typeof b) => b, (x: typeof a) => a) : (x: { x: number; z?: number; }) => { x: number; z?: number; } +>foo : (a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>(x: typeof b) => b : (x: { x: number; z?: number; }) => { x: number; z?: number; } +>x : { x: number; z?: number; } +>b : { x: number; z?: number; } +>b : { x: number; z?: number; } +>(x: typeof a) => a : (x: { x: number; y?: number; }) => { x: number; y?: number; } +>x : { x: number; y?: number; } +>a : { x: number; y?: number; } +>a : { x: number; y?: number; } + +function other(x: T) { +>other : (x: T) => void +>T : T +>x : T +>T : T + + var r6 = foo((a: T) => a, (b: T) => b); // T => T +>r6 : (x: T) => T +>foo((a: T) => a, (b: T) => b) : (x: T) => T +>foo : (a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>(a: T) => a : (a: T) => T +>a : T +>T : T +>a : T +>(b: T) => b : (b: T) => T +>b : T +>T : T +>b : T + + var r6b = foo((a) => a, (b) => b); // {} => {} +>r6b : (x: {}) => {} +>foo((a) => a, (b) => b) : (x: {}) => {} +>foo : (a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>(a) => a : (a: {}) => {} +>a : {} +>a : {} +>(b) => b : (b: {}) => {} +>b : {} +>b : {} +} + +function other2(x: T) { +>other2 : (x: T) => void +>T : T +>Date : Date +>x : T +>T : T + + var r7 = foo((a: T) => a, (b: T) => b); // T => T +>r7 : (x: T) => T +>foo((a: T) => a, (b: T) => b) : (x: T) => T +>foo : (a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>(a: T) => a : (a: T) => T +>a : T +>T : T +>a : T +>(b: T) => b : (b: T) => T +>b : T +>T : T +>b : T + + var r7b = foo((a) => a, (b) => b); // {} => {} +>r7b : (x: {}) => {} +>foo((a) => a, (b) => b) : (x: {}) => {} +>foo : (a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>(a) => a : (a: {}) => {} +>a : {} +>a : {} +>(b) => b : (b: {}) => {} +>b : {} +>b : {} + + var r8 = r7(null); +>r8 : T +>r7(null) : T +>r7 : (x: T) => T + + // BUG 835518 + //var r9 = r7(new Date()); +} + + +function foo2(a: (x: T) => T, b: (x: T) => T) { +>foo2 : (a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>T : T +>Date : Date +>a : (x: T) => T +>x : T +>T : T +>T : T +>b : (x: T) => T +>x : T +>T : T +>T : T + + var r: (x: T) => T; +>r : (x: T) => T +>x : T +>T : T +>T : T + + return r; +>r : (x: T) => T +} + +function other3(x: T) { +>other3 : (x: T) => void +>T : T +>RegExp : RegExp +>x : T +>T : T + + var r8 = foo2((a: Date) => a, (b: Date) => b); // Date => Date +>r8 : (x: Date) => Date +>foo2((a: Date) => a, (b: Date) => b) : (x: Date) => Date +>foo2 : (a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>(a: Date) => a : (a: Date) => Date +>a : Date +>Date : Date +>a : Date +>(b: Date) => b : (b: Date) => Date +>b : Date +>Date : Date +>b : Date +} diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments3.types b/tests/baselines/reference/genericCallWithGenericSignatureArguments3.types new file mode 100644 index 00000000000..2c0d21a5a07 --- /dev/null +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments3.types @@ -0,0 +1,202 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts === +// When a function expression is inferentially typed (section 4.9.3) and a type assigned to a parameter in that expression references type parameters for which inferences are being made, +// the corresponding inferred type arguments to become fixed and no further candidate inferences are made for them. + +function foo(x: T, a: (x: T) => T, b: (x: T) => T) { +>foo : (x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>T : T +>x : T +>T : T +>a : (x: T) => T +>x : T +>T : T +>T : T +>b : (x: T) => T +>x : T +>T : T +>T : T + + var r: (x: T) => T; +>r : (x: T) => T +>x : T +>T : T +>T : T + + return r; +>r : (x: T) => T +} + +var r1 = foo('', (x: string) => '', (x: Object) => null); // any => any +>r1 : (x: any) => any +>foo('', (x: string) => '', (x: Object) => null) : (x: any) => any +>foo : (x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>(x: string) => '' : (x: string) => string +>x : string +>(x: Object) => null : (x: Object) => any +>x : Object +>Object : Object + +var r1ii = foo('', (x) => '', (x) => null); // string => string +>r1ii : (x: string) => string +>foo('', (x) => '', (x) => null) : (x: string) => string +>foo : (x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>(x) => '' : (x: string) => string +>x : string +>(x) => null : (x: string) => any +>x : string + +var r2 = foo('', (x: string) => '', (x: Object) => ''); // string => string +>r2 : (x: Object) => Object +>foo('', (x: string) => '', (x: Object) => '') : (x: Object) => Object +>foo : (x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>(x: string) => '' : (x: string) => string +>x : string +>(x: Object) => '' : (x: Object) => string +>x : Object +>Object : Object + +var r3 = foo(null, (x: Object) => '', (x: string) => ''); // Object => Object +>r3 : (x: Object) => Object +>foo(null, (x: Object) => '', (x: string) => '') : (x: Object) => Object +>foo : (x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>(x: Object) => '' : (x: Object) => string +>x : Object +>Object : Object +>(x: string) => '' : (x: string) => string +>x : string + +var r4 = foo(null, (x) => '', (x) => ''); // any => any +>r4 : (x: any) => any +>foo(null, (x) => '', (x) => '') : (x: any) => any +>foo : (x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>(x) => '' : (x: any) => string +>x : any +>(x) => '' : (x: any) => string +>x : any + +var r5 = foo(new Object(), (x) => '', (x) => ''); // Object => Object +>r5 : (x: Object) => Object +>foo(new Object(), (x) => '', (x) => '') : (x: Object) => Object +>foo : (x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>new Object() : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } +>(x) => '' : (x: Object) => string +>x : Object +>(x) => '' : (x: Object) => string +>x : Object + +enum E { A } +>E : E +>A : E + +enum F { A } +>F : F +>A : F + +var r6 = foo(E.A, (x: number) => E.A, (x: F) => F.A); // number => number +>r6 : (x: number) => number +>foo(E.A, (x: number) => E.A, (x: F) => F.A) : (x: number) => number +>foo : (x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T +>E.A : E +>E : typeof E +>A : E +>(x: number) => E.A : (x: number) => E +>x : number +>E.A : E +>E : typeof E +>A : E +>(x: F) => F.A : (x: F) => F +>x : F +>F : F +>F.A : F +>F : typeof F +>A : F + + +function foo2(x: T, a: (x: T) => U, b: (x: T) => U) { +>foo2 : (x: T, a: (x: T) => U, b: (x: T) => U) => (x: T) => U +>T : T +>U : U +>x : T +>T : T +>a : (x: T) => U +>x : T +>T : T +>U : U +>b : (x: T) => U +>x : T +>T : T +>U : U + + var r: (x: T) => U; +>r : (x: T) => U +>x : T +>T : T +>U : U + + return r; +>r : (x: T) => U +} + +var r8 = foo2('', (x) => '', (x) => null); // string => string +>r8 : (x: string) => any +>foo2('', (x) => '', (x) => null) : (x: string) => any +>foo2 : (x: T, a: (x: T) => U, b: (x: T) => U) => (x: T) => U +>(x) => '' : (x: string) => string +>x : string +>(x) => null : (x: string) => any +>x : string + +var r9 = foo2(null, (x) => '', (x) => ''); // any => any +>r9 : (x: any) => string +>foo2(null, (x) => '', (x) => '') : (x: any) => string +>foo2 : (x: T, a: (x: T) => U, b: (x: T) => U) => (x: T) => U +>(x) => '' : (x: any) => string +>x : any +>(x) => '' : (x: any) => string +>x : any + +var r10 = foo2(null, (x: Object) => '', (x: string) => ''); // Object => Object +>r10 : (x: Object) => string +>foo2(null, (x: Object) => '', (x: string) => '') : (x: Object) => string +>foo2 : (x: T, a: (x: T) => U, b: (x: T) => U) => (x: T) => U +>(x: Object) => '' : (x: Object) => string +>x : Object +>Object : Object +>(x: string) => '' : (x: string) => string +>x : string + +var x: (a: string) => boolean; +>x : (a: string) => boolean +>a : string + +var r11 = foo2(x, (a1: (y: string) => string) => (n: Object) => 1, (a2: (z: string) => string) => 2); // {} => {} +>r11 : (x: {}) => {} +>foo2(x, (a1: (y: string) => string) => (n: Object) => 1, (a2: (z: string) => string) => 2) : (x: {}) => {} +>foo2 : (x: T, a: (x: T) => U, b: (x: T) => U) => (x: T) => U +>x : (a: string) => boolean +>(a1: (y: string) => string) => (n: Object) => 1 : (a1: (y: string) => string) => (n: Object) => number +>a1 : (y: string) => string +>y : string +>(n: Object) => 1 : (n: Object) => number +>n : Object +>Object : Object +>(a2: (z: string) => string) => 2 : (a2: (z: string) => string) => number +>a2 : (z: string) => string +>z : string + +var r12 = foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2); // (string => boolean) => {} +>r12 : (x: (a: string) => boolean) => {} +>foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2) : (x: (a: string) => boolean) => {} +>foo2 : (x: T, a: (x: T) => U, b: (x: T) => U) => (x: T) => U +>x : (a: string) => boolean +>(a1: (y: string) => boolean) => (n: Object) => 1 : (a1: (y: string) => boolean) => (n: Object) => number +>a1 : (y: string) => boolean +>y : string +>(n: Object) => 1 : (n: Object) => number +>n : Object +>Object : Object +>(a2: (z: string) => boolean) => 2 : (a2: (z: string) => boolean) => number +>a2 : (z: string) => boolean +>z : string + diff --git a/tests/baselines/reference/genericCallWithNonGenericArgs1.types b/tests/baselines/reference/genericCallWithNonGenericArgs1.types new file mode 100644 index 00000000000..f08f8503075 --- /dev/null +++ b/tests/baselines/reference/genericCallWithNonGenericArgs1.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/genericCallWithNonGenericArgs1.ts === +function f(x: any) { } +>f : (x: any) => void +>T : T +>x : any + +f(null) +>f(null) : void +>f : (x: any) => void + diff --git a/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.types b/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.types new file mode 100644 index 00000000000..e37a010baed --- /dev/null +++ b/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.types @@ -0,0 +1,117 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts === +// generic type argument inference where inference leads to two candidates that are both supertypes of all candidates +// we choose the first candidate so the result is dependent on the order of the arguments provided + +function foo(x: T, y: T) { +>foo : (x: T, y: T) => T +>T : T +>x : T +>T : T +>y : T +>T : T + + var r: T; +>r : T +>T : T + + return r; +>r : T +} + +var a: { x: number; y?: number; }; +>a : { x: number; y?: number; } +>x : number +>y : number + +var b: { x: number; z?: number; }; +>b : { x: number; z?: number; } +>x : number +>z : number + +var r = foo(a, b); // { x: number; y?: number; }; +>r : { x: number; y?: number; } +>foo(a, b) : { x: number; y?: number; } +>foo : (x: T, y: T) => T +>a : { x: number; y?: number; } +>b : { x: number; z?: number; } + +var r2 = foo(b, a); // { x: number; z?: number; }; +>r2 : { x: number; z?: number; } +>foo(b, a) : { x: number; z?: number; } +>foo : (x: T, y: T) => T +>b : { x: number; z?: number; } +>a : { x: number; y?: number; } + +var x: { x: number; }; +>x : { x: number; } +>x : number + +var y: { x?: number; }; +>y : { x?: number; } +>x : number + +var r3 = foo(a, x); // { x: number; y?: number; }; +>r3 : { x: number; y?: number; } +>foo(a, x) : { x: number; y?: number; } +>foo : (x: T, y: T) => T +>a : { x: number; y?: number; } +>x : { x: number; } + +var r4 = foo(x, a); // { x: number; }; +>r4 : { x: number; } +>foo(x, a) : { x: number; } +>foo : (x: T, y: T) => T +>x : { x: number; } +>a : { x: number; y?: number; } + +var r5 = foo(a, y); // { x?: number; }; +>r5 : { x?: number; } +>foo(a, y) : { x?: number; } +>foo : (x: T, y: T) => T +>a : { x: number; y?: number; } +>y : { x?: number; } + +var r5 = foo(y, a); // { x?: number; }; +>r5 : { x?: number; } +>foo(y, a) : { x?: number; } +>foo : (x: T, y: T) => T +>y : { x?: number; } +>a : { x: number; y?: number; } + +var r6 = foo(x, y); // { x?: number; }; +>r6 : { x?: number; } +>foo(x, y) : { x?: number; } +>foo : (x: T, y: T) => T +>x : { x: number; } +>y : { x?: number; } + +var r6 = foo(y, x); // { x?: number; }; +>r6 : { x?: number; } +>foo(y, x) : { x?: number; } +>foo : (x: T, y: T) => T +>y : { x?: number; } +>x : { x: number; } + +var s1: (x: Object) => string; +>s1 : (x: Object) => string +>x : Object +>Object : Object + +var s2: (x: string) => string; +>s2 : (x: string) => string +>x : string + +var r7 = foo(s1, s2); // (x: Object) => string; +>r7 : (x: Object) => string +>foo(s1, s2) : (x: Object) => string +>foo : (x: T, y: T) => T +>s1 : (x: Object) => string +>s2 : (x: string) => string + +var r8 = foo(s2, s1); // (x: string) => string; +>r8 : (x: string) => string +>foo(s2, s1) : (x: string) => string +>foo : (x: T, y: T) => T +>s2 : (x: string) => string +>s1 : (x: Object) => string + diff --git a/tests/baselines/reference/genericCallWithObjectLiteralArgs.types b/tests/baselines/reference/genericCallWithObjectLiteralArgs.types new file mode 100644 index 00000000000..5cf8f12164a --- /dev/null +++ b/tests/baselines/reference/genericCallWithObjectLiteralArgs.types @@ -0,0 +1,50 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectLiteralArgs.ts === +function foo(x: { bar: T; baz: T }) { +>foo : (x: { bar: T; baz: T; }) => { bar: T; baz: T; } +>T : T +>x : { bar: T; baz: T; } +>bar : T +>T : T +>baz : T +>T : T + + return x; +>x : { bar: T; baz: T; } +} + +var r = foo({ bar: 1, baz: '' }); // T = {} +>r : { bar: {}; baz: {}; } +>foo({ bar: 1, baz: '' }) : { bar: {}; baz: {}; } +>foo : (x: { bar: T; baz: T; }) => { bar: T; baz: T; } +>{ bar: 1, baz: '' } : { bar: number; baz: string; } +>bar : number +>baz : string + +var r2 = foo({ bar: 1, baz: 1 }); // T = number +>r2 : { bar: number; baz: number; } +>foo({ bar: 1, baz: 1 }) : { bar: number; baz: number; } +>foo : (x: { bar: T; baz: T; }) => { bar: T; baz: T; } +>{ bar: 1, baz: 1 } : { bar: number; baz: number; } +>bar : number +>baz : number + +// BUG 835724 +var r3 = foo({ bar: foo, baz: foo }); // T = any +>r3 : { bar: (x: { bar: T; baz: T; }) => { bar: T; baz: T; }; baz: (x: { bar: T; baz: T; }) => { bar: T; baz: T; }; } +>foo({ bar: foo, baz: foo }) : { bar: (x: { bar: T; baz: T; }) => { bar: T; baz: T; }; baz: (x: { bar: T; baz: T; }) => { bar: T; baz: T; }; } +>foo : (x: { bar: T; baz: T; }) => { bar: T; baz: T; } +>{ bar: foo, baz: foo } : { bar: (x: { bar: T; baz: T; }) => { bar: T; baz: T; }; baz: (x: { bar: T; baz: T; }) => { bar: T; baz: T; }; } +>bar : (x: { bar: T; baz: T; }) => { bar: T; baz: T; } +>foo : foo +>baz : (x: { bar: T; baz: T; }) => { bar: T; baz: T; } +>foo : foo + +var r4 = foo({ bar: 1, baz: '' }); // T = Object +>r4 : { bar: Object; baz: Object; } +>foo({ bar: 1, baz: '' }) : { bar: Object; baz: Object; } +>foo : (x: { bar: T; baz: T; }) => { bar: T; baz: T; } +>Object : Object +>{ bar: 1, baz: '' } : { bar: number; baz: string; } +>bar : number +>baz : string + diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs.types b/tests/baselines/reference/genericCallWithObjectTypeArgs.types new file mode 100644 index 00000000000..73b773d039d --- /dev/null +++ b/tests/baselines/reference/genericCallWithObjectTypeArgs.types @@ -0,0 +1,68 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs.ts === +class C { +>C : C + + private x: string; +>x : string +} + +class D { +>D : D + + private x: string; +>x : string +} + +class X { +>X : X +>T : T + + x: T; +>x : T +>T : T +} + +function foo(t: X, t2: X) { +>foo : (t: X, t2: X) => T +>T : T +>t : X +>X : X +>T : T +>t2 : X +>X : X +>T : T + + var x: T; +>x : T +>T : T + + return x; +>x : T +} + +var c1 = new X(); +>c1 : X +>new X() : X +>X : typeof X +>C : C + +var d1 = new X(); +>d1 : X +>new X() : X +>X : typeof X +>D : D + +var r = foo(c1, d1); // error +>r : {} +>foo(c1, d1) : {} +>foo : (t: X, t2: X) => T +>c1 : X +>d1 : X + +var r2 = foo(c1, c1); // ok +>r2 : C +>foo(c1, c1) : C +>foo : (t: X, t2: X) => T +>c1 : X +>c1 : X + diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs2.types b/tests/baselines/reference/genericCallWithObjectTypeArgs2.types new file mode 100644 index 00000000000..6721176c20a --- /dev/null +++ b/tests/baselines/reference/genericCallWithObjectTypeArgs2.types @@ -0,0 +1,129 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs2.ts === +class Base { +>Base : Base + + x: string; +>x : string +} +class Derived extends Base { +>Derived : Derived +>Base : Base + + y: string; +>y : string +} +class Derived2 extends Base { +>Derived2 : Derived2 +>Base : Base + + z: string; +>z : string +} + +// returns {}[] +function f(a: { x: T; y: U }) { +>f : (a: { x: T; y: U; }) => {}[] +>T : T +>Base : Base +>U : U +>Base : Base +>a : { x: T; y: U; } +>x : T +>T : T +>y : U +>U : U + + return [a.x, a.y]; +>[a.x, a.y] : {}[] +>a.x : T +>a : { x: T; y: U; } +>x : T +>a.y : U +>a : { x: T; y: U; } +>y : U +} + +var r = f({ x: new Derived(), y: new Derived2() }); // {}[] +>r : {}[] +>f({ x: new Derived(), y: new Derived2() }) : {}[] +>f : (a: { x: T; y: U; }) => {}[] +>{ x: new Derived(), y: new Derived2() } : { x: Derived; y: Derived2; } +>x : Derived +>new Derived() : Derived +>Derived : typeof Derived +>y : Derived2 +>new Derived2() : Derived2 +>Derived2 : typeof Derived2 + +var r2 = f({ x: new Base(), y: new Derived2() }); // {}[] +>r2 : {}[] +>f({ x: new Base(), y: new Derived2() }) : {}[] +>f : (a: { x: T; y: U; }) => {}[] +>{ x: new Base(), y: new Derived2() } : { x: Base; y: Derived2; } +>x : Base +>new Base() : Base +>Base : typeof Base +>y : Derived2 +>new Derived2() : Derived2 +>Derived2 : typeof Derived2 + + +function f2(a: { x: T; y: U }) { +>f2 : (a: { x: T; y: U; }) => (x: T) => U +>T : T +>Base : Base +>U : U +>Base : Base +>a : { x: T; y: U; } +>x : T +>T : T +>y : U +>U : U + + return (x: T) => a.y; +>(x: T) => a.y : (x: T) => U +>x : T +>T : T +>a.y : U +>a : { x: T; y: U; } +>y : U +} + +var r3 = f2({ x: new Derived(), y: new Derived2() }); // Derived => Derived2 +>r3 : (x: Derived) => Derived2 +>f2({ x: new Derived(), y: new Derived2() }) : (x: Derived) => Derived2 +>f2 : (a: { x: T; y: U; }) => (x: T) => U +>{ x: new Derived(), y: new Derived2() } : { x: Derived; y: Derived2; } +>x : Derived +>new Derived() : Derived +>Derived : typeof Derived +>y : Derived2 +>new Derived2() : Derived2 +>Derived2 : typeof Derived2 + +interface I { +>I : I +>T : T +>U : U + + x: T; +>x : T +>T : T + + y: U; +>y : U +>U : U +} + +var i: I; +>i : I +>I : I +>Base : Base +>Derived : Derived + +var r4 = f2(i); // Base => Derived +>r4 : (x: Base) => Derived +>f2(i) : (x: Base) => Derived +>f2 : (a: { x: T; y: U; }) => (x: T) => U +>i : I + diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints.types b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints.types new file mode 100644 index 00000000000..9dad9313319 --- /dev/null +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints.types @@ -0,0 +1,108 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints.ts === +// Generic call with constraints infering type parameter from object member properties +// No errors expected + +class C { +>C : C + + x: string; +>x : string +} + +class D { +>D : D + + x: string; +>x : string + + y: string; +>y : string +} + +class X { +>X : X +>T : T + + x: T; +>x : T +>T : T +} + +function foo(t: X, t2: X) { +>foo : (t: X, t2: X) => T +>T : T +>x : string +>t : X +>X : X +>T : T +>t2 : X +>X : X +>T : T + + var x: T; +>x : T +>T : T + + return x; +>x : T +} + +var c1 = new X(); +>c1 : X +>new X() : X +>X : typeof X +>C : C + +var d1 = new X(); +>d1 : X +>new X() : X +>X : typeof X +>D : D + +var r = foo(c1, d1); +>r : C +>foo(c1, d1) : C +>foo : (t: X, t2: X) => T +>c1 : X +>d1 : X + +var r2 = foo(c1, c1); +>r2 : C +>foo(c1, c1) : C +>foo : (t: X, t2: X) => T +>c1 : X +>c1 : X + +function foo2(t: X, t2: X) { +>foo2 : (t: X, t2: X) => T +>T : T +>C : C +>t : X +>X : X +>T : T +>t2 : X +>X : X +>T : T + + var x: T; +>x : T +>T : T + + return x; +>x : T +} + +var r = foo2(c1, d1); +>r : C +>foo2(c1, d1) : C +>foo2 : (t: X, t2: X) => T +>c1 : X +>d1 : X + +var r2 = foo2(c1, c1); +>r2 : C +>foo2(c1, c1) : C +>foo2 : (t: X, t2: X) => T +>c1 : X +>c1 : X + diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.types b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.types new file mode 100644 index 00000000000..5819569bf7f --- /dev/null +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.types @@ -0,0 +1,143 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints2.ts === +// Generic call with constraints infering type parameter from object member properties +// No errors expected + +class Base { +>Base : Base + + x: string; +>x : string +} +class Derived extends Base { +>Derived : Derived +>Base : Base + + y: string; +>y : string +} + +function f(x: { foo: T; bar: T }) { +>f : (x: { foo: T; bar: T; }) => T +>T : T +>Base : Base +>x : { foo: T; bar: T; } +>foo : T +>T : T +>bar : T +>T : T + + var r: T; +>r : T +>T : T + + return r; +>r : T +} +var r = f({ foo: new Base(), bar: new Derived() }); +>r : Base +>f({ foo: new Base(), bar: new Derived() }) : Base +>f : (x: { foo: T; bar: T; }) => T +>{ foo: new Base(), bar: new Derived() } : { foo: Base; bar: Derived; } +>foo : Base +>new Base() : Base +>Base : typeof Base +>bar : Derived +>new Derived() : Derived +>Derived : typeof Derived + +var r2 = f({ foo: new Derived(), bar: new Derived() }); +>r2 : Derived +>f({ foo: new Derived(), bar: new Derived() }) : Derived +>f : (x: { foo: T; bar: T; }) => T +>{ foo: new Derived(), bar: new Derived() } : { foo: Derived; bar: Derived; } +>foo : Derived +>new Derived() : Derived +>Derived : typeof Derived +>bar : Derived +>new Derived() : Derived +>Derived : typeof Derived + + +interface I { +>I : I +>T : T + + a: T; +>a : T +>T : T +} +function f2(x: I) { +>f2 : (x: I) => T +>T : T +>Base : Base +>x : I +>I : I +>T : T + + var r: T; +>r : T +>T : T + + return r; +>r : T +} +var i: I; +>i : I +>I : I +>Derived : Derived + +var r3 = f2(i); +>r3 : Derived +>f2(i) : Derived +>f2 : (x: I) => T +>i : I + + +function f3(x: T, y: (a: T) => T) { +>f3 : (x: T, y: (a: T) => T) => T +>T : T +>Base : Base +>x : T +>T : T +>y : (a: T) => T +>a : T +>T : T +>T : T + + return y(null); +>y(null) : T +>y : (a: T) => T +} +var r4 = f3(new Base(), x => x); +>r4 : Base +>f3(new Base(), x => x) : Base +>f3 : (x: T, y: (a: T) => T) => T +>new Base() : Base +>Base : typeof Base +>x => x : (x: Base) => Base +>x : Base +>x : Base + +var r5 = f3(new Derived(), x => x); +>r5 : Derived +>f3(new Derived(), x => x) : Derived +>f3 : (x: T, y: (a: T) => T) => T +>new Derived() : Derived +>Derived : typeof Derived +>x => x : (x: Derived) => Derived +>x : Derived +>x : Derived + +var r6 = f3(null, null); // any +>r6 : any +>f3(null, null) : any +>f3 : (x: T, y: (a: T) => T) => T + +var r7 = f3(null, x => x); // any +>r7 : any +>f3(null, x => x) : any +>f3 : (x: T, y: (a: T) => T) => T +>x => x : (x: any) => any +>x : any +>x : any + diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexers.types b/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexers.types new file mode 100644 index 00000000000..9a7ca1dbb91 --- /dev/null +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexers.types @@ -0,0 +1,66 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndIndexers.ts === +// Type inference infers from indexers in target type, no errors expected + +function foo(x: T) { +>foo : (x: T) => T +>T : T +>x : T +>T : T + + return x; +>x : T +} + +var a: { +>a : { [x: string]: Object; [x: number]: Date; } + + [x: string]: Object; +>x : string +>Object : Object + + [x: number]: Date; +>x : number +>Date : Date + +}; +var r = foo(a); +>r : { [x: string]: Object; [x: number]: Date; } +>foo(a) : { [x: string]: Object; [x: number]: Date; } +>foo : (x: T) => T +>a : { [x: string]: Object; [x: number]: Date; } + +function other(arg: T) { +>other : (arg: T) => void +>T : T +>Date : Date +>arg : T +>T : T + + var b: { +>b : { [x: string]: Object; [x: number]: T; } + + [x: string]: Object; +>x : string +>Object : Object + + [x: number]: T +>x : number +>T : T + + }; + var r2 = foo(b); +>r2 : { [x: string]: Object; [x: number]: T; } +>foo(b) : { [x: string]: Object; [x: number]: T; } +>foo : (x: T) => T +>b : { [x: string]: Object; [x: number]: T; } + + var d = r2[1]; +>d : T +>r2[1] : T +>r2 : { [x: string]: Object; [x: number]: T; } + + var e = r2['1']; +>e : Object +>r2['1'] : Object +>r2 : { [x: string]: Object; [x: number]: T; } +} diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndNumericIndexer.types b/tests/baselines/reference/genericCallWithObjectTypeArgsAndNumericIndexer.types new file mode 100644 index 00000000000..f4b3f5960f0 --- /dev/null +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndNumericIndexer.types @@ -0,0 +1,101 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndNumericIndexer.ts === +// Type inference infers from indexers in target type, no errors expected + +function foo(x: T) { +>foo : (x: T) => T +>T : T +>x : T +>T : T + + return x; +>x : T +} + +var a: { [x: number]: Date }; +>a : { [x: number]: Date; } +>x : number +>Date : Date + +var r = foo(a); +>r : { [x: number]: Date; } +>foo(a) : { [x: number]: Date; } +>foo : (x: T) => T +>a : { [x: number]: Date; } + +function other(arg: T) { +>other : (arg: T) => void +>T : T +>arg : T +>T : T + + var b: { [x: number]: T }; +>b : { [x: number]: T; } +>x : number +>T : T + + var r2 = foo(b); // T +>r2 : { [x: number]: T; } +>foo(b) : { [x: number]: T; } +>foo : (x: T) => T +>b : { [x: number]: T; } +} + +function other2(arg: T) { +>other2 : (arg: T) => void +>T : T +>Date : Date +>arg : T +>T : T + + var b: { [x: number]: T }; +>b : { [x: number]: T; } +>x : number +>T : T + + var r2 = foo(b); +>r2 : { [x: number]: T; } +>foo(b) : { [x: number]: T; } +>foo : (x: T) => T +>b : { [x: number]: T; } + + var d = r2[1]; +>d : T +>r2[1] : T +>r2 : { [x: number]: T; } +} + +function other3(arg: T) { +>other3 : (arg: T) => void +>T : T +>Date : Date +>U : U +>Date : Date +>arg : T +>T : T + + var b: { [x: number]: T }; +>b : { [x: number]: T; } +>x : number +>T : T + + var r2 = foo(b); +>r2 : { [x: number]: T; } +>foo(b) : { [x: number]: T; } +>foo : (x: T) => T +>b : { [x: number]: T; } + + var d = r2[1]; +>d : T +>r2[1] : T +>r2 : { [x: number]: T; } + + // BUG 821629 + //var u: U = r2[1]; // ok +} +//function other3(arg: T) { +// var b: { [x: number]: T }; +// var r2 = foo(b); +// var d = r2[1]; +// // BUG 821629 +// //var u: U = r2[1]; // ok +//} diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndStringIndexer.types b/tests/baselines/reference/genericCallWithObjectTypeArgsAndStringIndexer.types new file mode 100644 index 00000000000..e52e6cff113 --- /dev/null +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndStringIndexer.types @@ -0,0 +1,104 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndStringIndexer.ts === +// Type inference infers from indexers in target type, no errors expected + +function foo(x: T) { +>foo : (x: T) => T +>T : T +>x : T +>T : T + + return x; +>x : T +} + +var a: { [x: string]: Date }; +>a : { [x: string]: Date; } +>x : string +>Date : Date + +var r = foo(a); +>r : { [x: string]: Date; } +>foo(a) : { [x: string]: Date; } +>foo : (x: T) => T +>a : { [x: string]: Date; } + +function other(arg: T) { +>other : (arg: T) => void +>T : T +>arg : T +>T : T + + var b: { [x: string]: T }; +>b : { [x: string]: T; } +>x : string +>T : T + + var r2 = foo(b); // T +>r2 : { [x: string]: T; } +>foo(b) : { [x: string]: T; } +>foo : (x: T) => T +>b : { [x: string]: T; } +} + +function other2(arg: T) { +>other2 : (arg: T) => void +>T : T +>Date : Date +>arg : T +>T : T + + var b: { [x: string]: T }; +>b : { [x: string]: T; } +>x : string +>T : T + + var r2 = foo(b); +>r2 : { [x: string]: T; } +>foo(b) : { [x: string]: T; } +>foo : (x: T) => T +>b : { [x: string]: T; } + + var d: Date = r2['hm']; // ok +>d : Date +>Date : Date +>r2['hm'] : T +>r2 : { [x: string]: T; } +} + +function other3(arg: T) { +>other3 : (arg: T) => void +>T : T +>Date : Date +>U : U +>Date : Date +>arg : T +>T : T + + var b: { [x: string]: T }; +>b : { [x: string]: T; } +>x : string +>T : T + + var r2 = foo(b); +>r2 : { [x: string]: T; } +>foo(b) : { [x: string]: T; } +>foo : (x: T) => T +>b : { [x: string]: T; } + + var d: Date = r2['hm']; // ok +>d : Date +>Date : Date +>r2['hm'] : T +>r2 : { [x: string]: T; } + + // BUG 821629 + //var u: U = r2['hm']; // ok +} + +//function other3(arg: T) { +// var b: { [x: string]: T }; +// var r2 = foo(b); +// var d: Date = r2['hm']; // ok +// // BUG 821629 +// //var u: U = r2['hm']; // ok +//} diff --git a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.types b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.types new file mode 100644 index 00000000000..6c16ad0259c --- /dev/null +++ b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.types @@ -0,0 +1,173 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments.ts === +// Function typed arguments with multiple signatures must be passed an implementation that matches all of them +// Inferences are made quadratic-pairwise to and from these overload sets + +module NonGenericParameter { +>NonGenericParameter : typeof NonGenericParameter + + var a: { +>a : { new (x: boolean): boolean; new (x: string): string; } + + new(x: boolean): boolean; +>x : boolean + + new(x: string): string; +>x : string + } + + function foo4(cb: typeof a) { +>foo4 : (cb: { new (x: boolean): boolean; new (x: string): string; }) => boolean +>cb : { new (x: boolean): boolean; new (x: string): string; } +>a : { new (x: boolean): boolean; new (x: string): string; } + + return new cb(null); +>new cb(null) : boolean +>cb : { new (x: boolean): boolean; new (x: string): string; } + } + + var r = foo4(a); +>r : boolean +>foo4(a) : boolean +>foo4 : (cb: { new (x: boolean): boolean; new (x: string): string; }) => boolean +>a : { new (x: boolean): boolean; new (x: string): string; } + + var b: { new (x: T): T }; +>b : new (x: T) => T +>T : T +>x : T +>T : T +>T : T + + var r2 = foo4(b); +>r2 : boolean +>foo4(b) : boolean +>foo4 : (cb: { new (x: boolean): boolean; new (x: string): string; }) => boolean +>b : new (x: T) => T +} + +module GenericParameter { +>GenericParameter : typeof GenericParameter + + function foo5(cb: { new(x: T): string; new(x: number): T }) { +>foo5 : (cb: { new (x: T): string; new (x: number): T; }) => { new (x: T): string; new (x: number): T; } +>T : T +>cb : { new (x: T): string; new (x: number): T; } +>x : T +>T : T +>x : number +>T : T + + return cb; +>cb : { new (x: T): string; new (x: number): T; } + } + + var a: { +>a : { new (x: boolean): string; new (x: number): boolean; } + + new (x: boolean): string; +>x : boolean + + new (x: number): boolean; +>x : number + } + var r5 = foo5(a); // new{} => string; new(x:number) => {} +>r5 : { new (x: boolean): string; new (x: number): boolean; } +>foo5(a) : { new (x: boolean): string; new (x: number): boolean; } +>foo5 : (cb: { new (x: T): string; new (x: number): T; }) => { new (x: T): string; new (x: number): T; } +>a : { new (x: boolean): string; new (x: number): boolean; } + + var b: { new(x: T): string; new(x: number): T; } +>b : { new (x: T): string; new (x: number): T; } +>T : T +>x : T +>T : T +>T : T +>x : number +>T : T + + var r7 = foo5(b); // new any => string; new(x:number) => any +>r7 : { new (x: any): string; new (x: number): any; } +>foo5(b) : { new (x: any): string; new (x: number): any; } +>foo5 : (cb: { new (x: T): string; new (x: number): T; }) => { new (x: T): string; new (x: number): T; } +>b : { new (x: T): string; new (x: number): T; } + + function foo6(cb: { new(x: T): string; new(x: T, y?: T): string }) { +>foo6 : (cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } +>T : T +>cb : { new (x: T): string; new (x: T, y?: T): string; } +>x : T +>T : T +>x : T +>T : T +>y : T +>T : T + + return cb; +>cb : { new (x: T): string; new (x: T, y?: T): string; } + } + + var r8 = foo6(a); // new{} => string; new(x:{}, y?:{}) => string +>r8 : { new (x: {}): string; new (x: {}, y?: {}): string; } +>foo6(a) : { new (x: {}): string; new (x: {}, y?: {}): string; } +>foo6 : (cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } +>a : { new (x: boolean): string; new (x: number): boolean; } + + var r9 = foo6(b); // new any => string; new(x:any, y?:any) => string +>r9 : { new (x: any): string; new (x: any, y?: any): string; } +>foo6(b) : { new (x: any): string; new (x: any, y?: any): string; } +>foo6 : (cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } +>b : { new (x: T): string; new (x: number): T; } + + function foo7(x:T, cb: { new(x: T): string; new(x: T, y?: T): string }) { +>foo7 : (x: T, cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } +>T : T +>x : T +>T : T +>cb : { new (x: T): string; new (x: T, y?: T): string; } +>x : T +>T : T +>x : T +>T : T +>y : T +>T : T + + return cb; +>cb : { new (x: T): string; new (x: T, y?: T): string; } + } + + var r13 = foo7(1, b); // new any => string; new(x:any, y?:any) => string +>r13 : { new (x: any): string; new (x: any, y?: any): string; } +>foo7(1, b) : { new (x: any): string; new (x: any, y?: any): string; } +>foo7 : (x: T, cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } +>b : { new (x: T): string; new (x: number): T; } + + var c: { new (x: T): string; (x: number): T; } +>c : { (x: number): T; new (x: T): string; } +>T : T +>x : T +>T : T +>T : T +>x : number +>T : T + + var c2: { new (x: T): string; new(x: number): T; } +>c2 : { new (x: T): string; new (x: number): T; } +>T : T +>x : T +>T : T +>T : T +>x : number +>T : T + + var r14 = foo7(1, c); // new any => string; new(x:any, y?:any) => string +>r14 : { new (x: any): string; new (x: any, y?: any): string; } +>foo7(1, c) : { new (x: any): string; new (x: any, y?: any): string; } +>foo7 : (x: T, cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } +>c : { (x: number): T; new (x: T): string; } + + var r15 = foo7(1, c2); // new any => string; new(x:any, y?:any) => string +>r15 : { new (x: any): string; new (x: any, y?: any): string; } +>foo7(1, c2) : { new (x: any): string; new (x: any, y?: any): string; } +>foo7 : (x: T, cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } +>c2 : { new (x: T): string; new (x: number): T; } +} diff --git a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments.types b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments.types new file mode 100644 index 00000000000..ad491206be6 --- /dev/null +++ b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments.types @@ -0,0 +1,182 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedFunctionTypedArguments.ts === +// Function typed arguments with multiple signatures must be passed an implementation that matches all of them +// Inferences are made quadratic-pairwise to and from these overload sets + +module NonGenericParameter { +>NonGenericParameter : typeof NonGenericParameter + + var a: { +>a : { (x: boolean): boolean; (x: string): string; } + + (x: boolean): boolean; +>x : boolean + + (x: string): string; +>x : string + } + + function foo4(cb: typeof a) { +>foo4 : (cb: { (x: boolean): boolean; (x: string): string; }) => { (x: boolean): boolean; (x: string): string; } +>cb : { (x: boolean): boolean; (x: string): string; } +>a : { (x: boolean): boolean; (x: string): string; } + + return cb; +>cb : { (x: boolean): boolean; (x: string): string; } + } + + var r = foo4(a); +>r : { (x: boolean): boolean; (x: string): string; } +>foo4(a) : { (x: boolean): boolean; (x: string): string; } +>foo4 : (cb: { (x: boolean): boolean; (x: string): string; }) => { (x: boolean): boolean; (x: string): string; } +>a : { (x: boolean): boolean; (x: string): string; } + + var r2 = foo4((x: T) => x); +>r2 : { (x: boolean): boolean; (x: string): string; } +>foo4((x: T) => x) : { (x: boolean): boolean; (x: string): string; } +>foo4 : (cb: { (x: boolean): boolean; (x: string): string; }) => { (x: boolean): boolean; (x: string): string; } +>(x: T) => x : (x: T) => T +>T : T +>x : T +>T : T +>x : T + + var r4 = foo4(x => x); +>r4 : { (x: boolean): boolean; (x: string): string; } +>foo4(x => x) : { (x: boolean): boolean; (x: string): string; } +>foo4 : (cb: { (x: boolean): boolean; (x: string): string; }) => { (x: boolean): boolean; (x: string): string; } +>x => x : (x: any) => any +>x : any +>x : any +} + +module GenericParameter { +>GenericParameter : typeof GenericParameter + + function foo5(cb: { (x: T): string; (x: number): T }) { +>foo5 : (cb: { (x: T): string; (x: number): T; }) => { (x: T): string; (x: number): T; } +>T : T +>cb : { (x: T): string; (x: number): T; } +>x : T +>T : T +>x : number +>T : T + + return cb; +>cb : { (x: T): string; (x: number): T; } + } + + var r5 = foo5(x => x); // any => string (+1 overload) [inferences are made for T, but lambda not contextually typed]. T is any +>r5 : { (x: any): string; (x: number): any; } +>foo5(x => x) : { (x: any): string; (x: number): any; } +>foo5 : (cb: { (x: T): string; (x: number): T; }) => { (x: T): string; (x: number): T; } +>x => x : (x: any) => any +>x : any +>x : any + + var a: { (x: T): string; (x: number): T; } +>a : { (x: T): string; (x: number): T; } +>T : T +>x : T +>T : T +>T : T +>x : number +>T : T + + var r7 = foo5(a); // any => string (+1 overload) +>r7 : { (x: any): string; (x: number): any; } +>foo5(a) : { (x: any): string; (x: number): any; } +>foo5 : (cb: { (x: T): string; (x: number): T; }) => { (x: T): string; (x: number): T; } +>a : { (x: T): string; (x: number): T; } + + function foo6(cb: { (x: T): string; (x: T, y?: T): string }) { +>foo6 : (cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; } +>T : T +>cb : { (x: T): string; (x: T, y?: T): string; } +>x : T +>T : T +>x : T +>T : T +>y : T +>T : T + + return cb; +>cb : { (x: T): string; (x: T, y?: T): string; } + } + + var r8 = foo6(x => x); // any => string (+1 overload) [inferences are made for T, but lambda not contextually typed]. T is any +>r8 : { (x: any): string; (x: any, y?: any): string; } +>foo6(x => x) : { (x: any): string; (x: any, y?: any): string; } +>foo6 : (cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; } +>x => x : (x: any) => any +>x : any +>x : any + + var r9 = foo6((x: T) => ''); // any => string (+1 overload) +>r9 : { (x: any): string; (x: any, y?: any): string; } +>foo6((x: T) => '') : { (x: any): string; (x: any, y?: any): string; } +>foo6 : (cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; } +>(x: T) => '' : (x: T) => string +>T : T +>x : T +>T : T + + var r11 = foo6((x: T, y?: T) => ''); // any => string (+1 overload) +>r11 : { (x: any): string; (x: any, y?: any): string; } +>foo6((x: T, y?: T) => '') : { (x: any): string; (x: any, y?: any): string; } +>foo6 : (cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; } +>(x: T, y?: T) => '' : (x: T, y?: T) => string +>T : T +>x : T +>T : T +>y : T +>T : T + + function foo7(x:T, cb: { (x: T): string; (x: T, y?: T): string }) { +>foo7 : (x: T, cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; } +>T : T +>x : T +>T : T +>cb : { (x: T): string; (x: T, y?: T): string; } +>x : T +>T : T +>x : T +>T : T +>y : T +>T : T + + return cb; +>cb : { (x: T): string; (x: T, y?: T): string; } + } + + var r12 = foo7(1, (x) => x); // any => string (+1 overload) [inferences are made for T, but lambda not contextually typed] +>r12 : { (x: any): string; (x: any, y?: any): string; } +>foo7(1, (x) => x) : { (x: any): string; (x: any, y?: any): string; } +>foo7 : (x: T, cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; } +>(x) => x : (x: any) => any +>x : any +>x : any + + var r13 = foo7(1, (x: T) => ''); // any => string (+1 overload) [inferences are made for T, but lambda not contextually typed] +>r13 : { (x: any): string; (x: any, y?: any): string; } +>foo7(1, (x: T) => '') : { (x: any): string; (x: any, y?: any): string; } +>foo7 : (x: T, cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; } +>(x: T) => '' : (x: T) => string +>T : T +>x : T +>T : T + + var a: { (x: T): string; (x: number): T; } +>a : { (x: T): string; (x: number): T; } +>T : T +>x : T +>T : T +>T : T +>x : number +>T : T + + var r14 = foo7(1, a); // any => string (+1 overload) [inferences are made for T, but lambda not contextually typed] +>r14 : { (x: any): string; (x: any, y?: any): string; } +>foo7(1, a) : { (x: any): string; (x: any, y?: any): string; } +>foo7 : (x: T, cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; } +>a : { (x: T): string; (x: number): T; } +} diff --git a/tests/baselines/reference/genericCallbacksAndClassHierarchy.types b/tests/baselines/reference/genericCallbacksAndClassHierarchy.types new file mode 100644 index 00000000000..d4cb5dcd14b --- /dev/null +++ b/tests/baselines/reference/genericCallbacksAndClassHierarchy.types @@ -0,0 +1,83 @@ +=== tests/cases/compiler/genericCallbacksAndClassHierarchy.ts === +module M { +>M : typeof M + + export interface I { +>I : I +>T : T + + subscribe(callback: (newValue: T) => void ): any; +>subscribe : (callback: (newValue: T) => void) => any +>callback : (newValue: T) => void +>newValue : T +>T : T + } + export class C1 { +>C1 : C1 +>T : T + + public value: I; +>value : I +>I : I +>T : T + } + export class A { +>A : A +>T : T + + public dummy: any; +>dummy : any + } + export class B extends C1> { } +>B : B +>T : T +>C1 : C1 +>A : A +>T : T + + export class D { +>D : D +>T : T + + _subscribe(viewModel: B): void { +>_subscribe : (viewModel: B) => void +>viewModel : B +>B : B +>T : T + + var f = (newValue: A) => { }; +>f : (newValue: A) => void +>(newValue: A) => { } : (newValue: A) => void +>newValue : A +>A : A +>T : T + + var v: I> = viewModel.value; +>v : I> +>I : I +>A : A +>T : T +>viewModel.value : I> +>viewModel : B +>value : I> + + // both of these should work + v.subscribe(f); +>v.subscribe(f) : any +>v.subscribe : (callback: (newValue: A) => void) => any +>v : I> +>subscribe : (callback: (newValue: A) => void) => any +>f : (newValue: A) => void + + v.subscribe((newValue: A) => { }); +>v.subscribe((newValue: A) => { }) : any +>v.subscribe : (callback: (newValue: A) => void) => any +>v : I> +>subscribe : (callback: (newValue: A) => void) => any +>(newValue: A) => { } : (newValue: A) => void +>newValue : A +>A : A +>T : T + } + } +} diff --git a/tests/baselines/reference/genericClassImplementingGenericInterfaceFromAnotherModule.types b/tests/baselines/reference/genericClassImplementingGenericInterfaceFromAnotherModule.types new file mode 100644 index 00000000000..81236d74f42 --- /dev/null +++ b/tests/baselines/reference/genericClassImplementingGenericInterfaceFromAnotherModule.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/genericClassImplementingGenericInterfaceFromAnotherModule.ts === +module foo { +>foo : foo + + export interface IFoo { } +>IFoo : IFoo +>T : T +} +module bar { +>bar : typeof bar + + export class Foo implements foo.IFoo { } +>Foo : Foo +>T : T +>foo : foo +>IFoo : IFoo +>T : T +} + diff --git a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.types b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.types new file mode 100644 index 00000000000..66b21c54d06 --- /dev/null +++ b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/genericClassInheritsConstructorFromNonGenericClass.ts === +class A extends B { } +>A : A +>B : B + +class B extends C { } +>B : B +>U : U +>C : C + +class C { +>C : C + + constructor(p: string) { } +>p : string +} diff --git a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.types b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.types new file mode 100644 index 00000000000..7f1e931268d --- /dev/null +++ b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.types @@ -0,0 +1,254 @@ +=== tests/cases/compiler/genericClassPropertyInheritanceSpecialization.ts === +interface KnockoutObservableBase { +>KnockoutObservableBase : KnockoutObservableBase +>T : T + + peek(): T; +>peek : () => T +>T : T + + (): T; +>T : T + + (value: T): void; +>value : T +>T : T +} + +interface KnockoutObservable extends KnockoutObservableBase { +>KnockoutObservable : KnockoutObservable +>T : T +>KnockoutObservableBase : KnockoutObservableBase +>T : T + + equalityComparer(a: T, b: T): boolean; +>equalityComparer : (a: T, b: T) => boolean +>a : T +>T : T +>b : T +>T : T + + valueHasMutated(): void; +>valueHasMutated : () => void + + valueWillMutate(): void; +>valueWillMutate : () => void +} + +interface KnockoutObservableArray extends KnockoutObservable { +>KnockoutObservableArray : KnockoutObservableArray +>T : T +>KnockoutObservable : KnockoutObservable +>T : T + + indexOf(searchElement: T, fromIndex?: number): number; +>indexOf : (searchElement: T, fromIndex?: number) => number +>searchElement : T +>T : T +>fromIndex : number + + slice(start: number, end?: number): T[]; +>slice : (start: number, end?: number) => T[] +>start : number +>end : number +>T : T + + splice(start: number, deleteCount?: number, ...items: T[]): T[]; +>splice : (start: number, deleteCount?: number, ...items: T[]) => T[] +>start : number +>deleteCount : number +>items : T[] +>T : T +>T : T + + pop(): T; +>pop : () => T +>T : T + + push(...items: T[]): void; +>push : (...items: T[]) => void +>items : T[] +>T : T + + shift(): T; +>shift : () => T +>T : T + + unshift(...items: T[]): number; +>unshift : (...items: T[]) => number +>items : T[] +>T : T + + reverse(): T[]; +>reverse : () => T[] +>T : T + + sort(compareFunction?: (a: T, b: T) => number): void; +>sort : (compareFunction?: (a: T, b: T) => number) => void +>compareFunction : (a: T, b: T) => number +>a : T +>T : T +>b : T +>T : T + + replace(oldItem: T, newItem: T): void; +>replace : (oldItem: T, newItem: T) => void +>oldItem : T +>T : T +>newItem : T +>T : T + + remove(item: T): T[]; +>remove : (item: T) => T[] +>item : T +>T : T +>T : T + + removeAll(items?: T[]): T[]; +>removeAll : (items?: T[]) => T[] +>items : T[] +>T : T +>T : T + + destroy(item: T): void; +>destroy : (item: T) => void +>item : T +>T : T + + destroyAll(items?: T[]): void; +>destroyAll : (items?: T[]) => void +>items : T[] +>T : T +} + +interface KnockoutObservableArrayStatic { +>KnockoutObservableArrayStatic : KnockoutObservableArrayStatic + + fn: KnockoutObservableArray; +>fn : KnockoutObservableArray +>KnockoutObservableArray : KnockoutObservableArray + + (value?: T[]): KnockoutObservableArray; +>T : T +>value : T[] +>T : T +>KnockoutObservableArray : KnockoutObservableArray +>T : T +} + +declare module ko { +>ko : typeof ko + + export var observableArray: KnockoutObservableArrayStatic; +>observableArray : KnockoutObservableArrayStatic +>KnockoutObservableArrayStatic : KnockoutObservableArrayStatic +} + +module Portal.Controls.Validators { +>Portal : typeof Portal +>Controls : typeof Controls +>Validators : typeof Validators + + export class Validator { +>Validator : Validator +>TValue : TValue + + private _subscription; +>_subscription : any + + public message: KnockoutObservable; +>message : KnockoutObservable +>KnockoutObservable : KnockoutObservable + + public validationState: KnockoutObservable; +>validationState : KnockoutObservable +>KnockoutObservable : KnockoutObservable + + public validate: KnockoutObservable; +>validate : KnockoutObservable +>KnockoutObservable : KnockoutObservable +>TValue : TValue + + constructor(message?: string) { } +>message : string + + public destroy(): void { } +>destroy : () => void + + public _validate(value: TValue): number {return 0 } +>_validate : (value: TValue) => number +>value : TValue +>TValue : TValue + } +} + +module PortalFx.ViewModels.Controls.Validators { +>PortalFx : typeof PortalFx +>ViewModels : typeof ViewModels +>Controls : typeof Controls +>Validators : typeof Validators + + export class Validator extends Portal.Controls.Validators.Validator { +>Validator : Validator +>TValue : TValue +>Portal : Portal +>Controls : Controls +>Validators : Validators +>Validator : Validator +>TValue : TValue + + constructor(message?: string) { +>message : string + + super(message); +>super(message) : void +>message : string + } + } + +} + +interface Contract { +>Contract : Contract +>TValue : TValue + + validators: KnockoutObservableArray>; +>validators : KnockoutObservableArray> +>KnockoutObservableArray : KnockoutObservableArray +>PortalFx : PortalFx +>ViewModels : ViewModels +>Controls : Controls +>Validators : Validators +>Validator : Validator +>TValue : TValue +} + + +class ViewModel implements Contract { +>ViewModel : ViewModel +>TValue : TValue +>Contract : Contract +>TValue : TValue + + public validators: KnockoutObservableArray> = ko.observableArray>(); +>validators : KnockoutObservableArray> +>KnockoutObservableArray : KnockoutObservableArray +>PortalFx : PortalFx +>ViewModels : ViewModels +>Controls : Controls +>Validators : Validators +>Validator : Validator +>TValue : TValue +>ko.observableArray>() : KnockoutObservableArray> +>ko.observableArray : KnockoutObservableArrayStatic +>ko : typeof ko +>observableArray : KnockoutObservableArrayStatic +>PortalFx : PortalFx +>ViewModels : ViewModels +>Controls : Controls +>Validators : Validators +>Validator : Validator +>TValue : TValue +} + + diff --git a/tests/baselines/reference/genericClassStaticMethod.types b/tests/baselines/reference/genericClassStaticMethod.types new file mode 100644 index 00000000000..509a700e65c --- /dev/null +++ b/tests/baselines/reference/genericClassStaticMethod.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/genericClassStaticMethod.ts === +class Foo { +>Foo : Foo +>T : T + + static getFoo() { +>getFoo : () => void + } +} + +class Bar extends Foo { +>Bar : Bar +>T : T +>Foo : Foo +>T : T + + static getFoo() { +>getFoo : () => void + } +} + diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.types b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.types new file mode 100644 index 00000000000..c0ed09cc300 --- /dev/null +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.types @@ -0,0 +1,297 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts === +// Generic functions used as arguments for function typed parameters are not used to make inferences from +// Using function arguments, no errors expected + +module ImmediatelyFix { +>ImmediatelyFix : typeof ImmediatelyFix + + class C { +>C : C +>T : T + + foo(x: (a: T) => T) { +>foo : (x: (a: T) => T) => T +>T : T +>x : (a: T) => T +>a : T +>T : T +>T : T + + return x(null); +>x(null) : T +>x : (a: T) => T + } + } + + var c = new C(); +>c : C +>new C() : C +>C : typeof C + + var r = c.foo((x: U) => ''); // {} +>r : {} +>c.foo((x: U) => '') : {} +>c.foo : (x: (a: T) => T) => T +>c : C +>foo : (x: (a: T) => T) => T +>(x: U) => '' : (x: U) => string +>U : U +>x : U +>U : U + + var r2 = c.foo((x: U) => ''); // string +>r2 : string +>c.foo((x: U) => '') : string +>c.foo : (x: (a: T) => T) => T +>c : C +>foo : (x: (a: T) => T) => T +>(x: U) => '' : (x: U) => string +>U : U +>x : U +>U : U + + var r3 = c.foo(x => ''); // {} +>r3 : {} +>c.foo(x => '') : {} +>c.foo : (x: (a: T) => T) => T +>c : C +>foo : (x: (a: T) => T) => T +>x => '' : (x: {}) => string +>x : {} + + class C2 { +>C2 : C2 +>T : T + + foo(x: (a: T) => T) { +>foo : (x: (a: T) => T) => T +>x : (a: T) => T +>a : T +>T : T +>T : T + + return x(null); +>x(null) : T +>x : (a: T) => T + } + } + + var c2 = new C2(); +>c2 : C2 +>new C2() : C2 +>C2 : typeof C2 + + var ra = c2.foo((x: U) => 1); // number +>ra : number +>c2.foo((x: U) => 1) : number +>c2.foo : (x: (a: number) => number) => number +>c2 : C2 +>foo : (x: (a: number) => number) => number +>(x: U) => 1 : (x: U) => number +>U : U +>x : U +>U : U + + var r3a = c2.foo(x => 1); // number +>r3a : number +>c2.foo(x => 1) : number +>c2.foo : (x: (a: number) => number) => number +>c2 : C2 +>foo : (x: (a: number) => number) => number +>x => 1 : (x: number) => number +>x : number +} + +module WithCandidates { +>WithCandidates : typeof WithCandidates + + class C { +>C : C +>T : T + + foo2(x: T, cb: (a: T) => U) { +>foo2 : (x: T, cb: (a: T) => U) => U +>T : T +>U : U +>x : T +>T : T +>cb : (a: T) => U +>a : T +>T : T +>U : U + + return cb(x); +>cb(x) : U +>cb : (a: T) => U +>x : T + } + } + + var c: C; +>c : C +>C : C + + var r4 = c.foo2(1, function (a: Z) { return '' }); // string, contextual signature instantiation is applied to generic functions +>r4 : string +>c.foo2(1, function (a: Z) { return '' }) : string +>c.foo2 : (x: T, cb: (a: T) => U) => U +>c : C +>foo2 : (x: T, cb: (a: T) => U) => U +>function (a: Z) { return '' } : (a: Z) => string +>Z : Z +>a : Z +>Z : Z + + var r5 = c.foo2(1, (a) => ''); // string +>r5 : string +>c.foo2(1, (a) => '') : string +>c.foo2 : (x: T, cb: (a: T) => U) => U +>c : C +>foo2 : (x: T, cb: (a: T) => U) => U +>(a) => '' : (a: number) => string +>a : number + + var r6 = c.foo2('', (a: Z) => 1); // number +>r6 : number +>c.foo2('', (a: Z) => 1) : number +>c.foo2 : (x: T, cb: (a: T) => U) => U +>c : C +>foo2 : (x: T, cb: (a: T) => U) => U +>(a: Z) => 1 : (a: Z) => number +>Z : Z +>a : Z +>Z : Z + + class C2 { +>C2 : C2 +>T : T +>U : U + + foo3(x: T, cb: (a: T) => U, y: U) { +>foo3 : (x: T, cb: (a: T) => U, y: U) => U +>x : T +>T : T +>cb : (a: T) => U +>a : T +>T : T +>U : U +>y : U +>U : U + + return cb(x); +>cb(x) : U +>cb : (a: T) => U +>x : T + } + } + + var c2: C2; +>c2 : C2 +>C2 : C2 + + var r7 = c2.foo3(1, (a: Z) => '', ''); // string +>r7 : string +>c2.foo3(1, (a: Z) => '', '') : string +>c2.foo3 : (x: number, cb: (a: number) => string, y: string) => string +>c2 : C2 +>foo3 : (x: number, cb: (a: number) => string, y: string) => string +>(a: Z) => '' : (a: Z) => string +>Z : Z +>a : Z +>Z : Z + + var r8 = c2.foo3(1, function (a) { return '' }, ''); // string +>r8 : string +>c2.foo3(1, function (a) { return '' }, '') : string +>c2.foo3 : (x: number, cb: (a: number) => string, y: string) => string +>c2 : C2 +>foo3 : (x: number, cb: (a: number) => string, y: string) => string +>function (a) { return '' } : (a: number) => string +>a : number + + class C3 { +>C3 : C3 +>T : T +>U : U + + foo3(x: T, cb: (a: T) => U, y: U) { +>foo3 : (x: T, cb: (a: T) => U, y: U) => U +>T : T +>U : U +>x : T +>T : T +>cb : (a: T) => U +>a : T +>T : T +>U : U +>y : U +>U : U + + return cb(x); +>cb(x) : U +>cb : (a: T) => U +>x : T + } + } + var c3: C3; +>c3 : C3 +>C3 : C3 + + function other(t: T, u: U) { +>other : (t: T, u: U) => void +>T : T +>U : U +>t : T +>T : T +>u : U +>U : U + + var r10 = c.foo2(1, (x: T) => ''); // string, non-generic signature allows inferences to be made +>r10 : string +>c.foo2(1, (x: T) => '') : string +>c.foo2 : (x: T, cb: (a: T) => U) => U +>c : C +>foo2 : (x: T, cb: (a: T) => U) => U +>(x: T) => '' : (x: T) => string +>x : T +>T : T + + var r10 = c.foo2(1, (x) => ''); // string +>r10 : string +>c.foo2(1, (x) => '') : string +>c.foo2 : (x: T, cb: (a: T) => U) => U +>c : C +>foo2 : (x: T, cb: (a: T) => U) => U +>(x) => '' : (x: number) => string +>x : number + + var r11 = c3.foo3(1, (x: T) => '', ''); // string +>r11 : string +>c3.foo3(1, (x: T) => '', '') : string +>c3.foo3 : (x: T, cb: (a: T) => U, y: U) => U +>c3 : C3 +>foo3 : (x: T, cb: (a: T) => U, y: U) => U +>(x: T) => '' : (x: T) => string +>x : T +>T : T + + var r11b = c3.foo3(1, (x: T) => '', 1); // {} +>r11b : {} +>c3.foo3(1, (x: T) => '', 1) : {} +>c3.foo3 : (x: T, cb: (a: T) => U, y: U) => U +>c3 : C3 +>foo3 : (x: T, cb: (a: T) => U, y: U) => U +>(x: T) => '' : (x: T) => string +>x : T +>T : T + + var r12 = c3.foo3(1, function (a) { return '' }, 1); // {} +>r12 : {} +>c3.foo3(1, function (a) { return '' }, 1) : {} +>c3.foo3 : (x: T, cb: (a: T) => U, y: U) => U +>c3 : C3 +>foo3 : (x: T, cb: (a: T) => U, y: U) => U +>function (a) { return '' } : (a: number) => string +>a : number + } +} diff --git a/tests/baselines/reference/genericClassWithObjectTypeArgsAndConstraints.types b/tests/baselines/reference/genericClassWithObjectTypeArgsAndConstraints.types new file mode 100644 index 00000000000..a256deca0a2 --- /dev/null +++ b/tests/baselines/reference/genericClassWithObjectTypeArgsAndConstraints.types @@ -0,0 +1,240 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithObjectTypeArgsAndConstraints.ts === +// Generic call with constraints infering type parameter from object member properties +// No errors expected + +class C { +>C : C + + x: string; +>x : string +} + +class D { +>D : D + + x: string; +>x : string + + y: string; +>y : string +} + +class X { +>X : X +>T : T + + x: T; +>x : T +>T : T +} + +module Class { +>Class : typeof Class + + class G { +>G : G +>T : T +>x : string + + foo(t: X, t2: X) { +>foo : (t: X, t2: X) => T +>T : T +>x : string +>t : X +>X : X +>T : T +>t2 : X +>X : X +>T : T + + var x: T; +>x : T +>T : T + + return x; +>x : T + } + } + + var c1 = new X(); +>c1 : X +>new X() : X +>X : typeof X +>C : C + + var d1 = new X(); +>d1 : X +>new X() : X +>X : typeof X +>D : D + + var g: G<{ x: string; y: string }>; +>g : G<{ x: string; y: string; }> +>G : G +>x : string +>y : string + + var r = g.foo(c1, d1); +>r : C +>g.foo(c1, d1) : C +>g.foo : (t: X, t2: X) => T +>g : G<{ x: string; y: string; }> +>foo : (t: X, t2: X) => T +>c1 : X +>d1 : X + + var r2 = g.foo(c1, c1); +>r2 : C +>g.foo(c1, c1) : C +>g.foo : (t: X, t2: X) => T +>g : G<{ x: string; y: string; }> +>foo : (t: X, t2: X) => T +>c1 : X +>c1 : X + + class G2 { +>G2 : G2 +>T : T +>C : C + + foo2(t: X, t2: X) { +>foo2 : (t: X, t2: X) => T +>T : T +>C : C +>t : X +>X : X +>T : T +>t2 : X +>X : X +>T : T + + var x: T; +>x : T +>T : T + + return x; +>x : T + } + } + var g2: G2; +>g2 : G2 +>G2 : G2 +>D : D + + var r = g2.foo2(c1, d1); +>r : C +>g2.foo2(c1, d1) : C +>g2.foo2 : (t: X, t2: X) => T +>g2 : G2 +>foo2 : (t: X, t2: X) => T +>c1 : X +>d1 : X + + var r2 = g2.foo2(c1, c1); +>r2 : C +>g2.foo2(c1, c1) : C +>g2.foo2 : (t: X, t2: X) => T +>g2 : G2 +>foo2 : (t: X, t2: X) => T +>c1 : X +>c1 : X +} + +module Interface { +>Interface : typeof Interface + + interface G { +>G : G +>T : T +>x : string + + foo(t: X, t2: X): T; +>foo : (t: X, t2: X) => T +>T : T +>x : string +>t : X +>X : X +>T : T +>t2 : X +>X : X +>T : T +>T : T + } + + var c1 = new X(); +>c1 : X +>new X() : X +>X : typeof X +>C : C + + var d1 = new X(); +>d1 : X +>new X() : X +>X : typeof X +>D : D + + var g: G<{ x: string; y: string }>; +>g : G<{ x: string; y: string; }> +>G : G +>x : string +>y : string + + var r = g.foo(c1, d1); +>r : C +>g.foo(c1, d1) : C +>g.foo : (t: X, t2: X) => T +>g : G<{ x: string; y: string; }> +>foo : (t: X, t2: X) => T +>c1 : X +>d1 : X + + var r2 = g.foo(c1, c1); +>r2 : C +>g.foo(c1, c1) : C +>g.foo : (t: X, t2: X) => T +>g : G<{ x: string; y: string; }> +>foo : (t: X, t2: X) => T +>c1 : X +>c1 : X + + interface G2 { +>G2 : G2 +>T : T +>C : C + + foo2(t: X, t2: X): T; +>foo2 : (t: X, t2: X) => T +>T : T +>C : C +>t : X +>X : X +>T : T +>t2 : X +>X : X +>T : T +>T : T + } + + var g2: G2; +>g2 : G2 +>G2 : G2 +>D : D + + var r = g2.foo2(c1, d1); +>r : C +>g2.foo2(c1, d1) : C +>g2.foo2 : (t: X, t2: X) => T +>g2 : G2 +>foo2 : (t: X, t2: X) => T +>c1 : X +>d1 : X + + var r2 = g2.foo2(c1, c1); +>r2 : C +>g2.foo2(c1, c1) : C +>g2.foo2 : (t: X, t2: X) => T +>g2 : G2 +>foo2 : (t: X, t2: X) => T +>c1 : X +>c1 : X +} diff --git a/tests/baselines/reference/genericClassWithStaticFactory.types b/tests/baselines/reference/genericClassWithStaticFactory.types new file mode 100644 index 00000000000..e5b291e2b02 --- /dev/null +++ b/tests/baselines/reference/genericClassWithStaticFactory.types @@ -0,0 +1,603 @@ +=== tests/cases/compiler/genericClassWithStaticFactory.ts === +module Editor { +>Editor : typeof Editor + + export class List { +>List : List +>T : T + + public next: List; +>next : List +>List : List +>T : T + + public prev: List; +>prev : List +>List : List +>T : T + + private listFactory: ListFactory; +>listFactory : ListFactory +>ListFactory : ListFactory +>T : T + + constructor(public isHead: boolean, public data: T) { +>isHead : boolean +>data : T +>T : T + + this.listFactory = new ListFactory(); +>this.listFactory = new ListFactory() : ListFactory +>this.listFactory : ListFactory +>this : List +>listFactory : ListFactory +>new ListFactory() : ListFactory +>ListFactory : typeof ListFactory +>T : T + + } + + public add(data: T): List { +>add : (data: T) => List +>data : T +>T : T +>List : List +>T : T + + var entry = this.listFactory.MakeEntry(data); +>entry : List +>this.listFactory.MakeEntry(data) : List +>this.listFactory.MakeEntry : (data: T) => List +>this.listFactory : ListFactory +>this : List +>listFactory : ListFactory +>MakeEntry : (data: T) => List +>data : T + + this.prev.next = entry; +>this.prev.next = entry : List +>this.prev.next : List +>this.prev : List +>this : List +>prev : List +>next : List +>entry : List + + entry.next = this; +>entry.next = this : List +>entry.next : List +>entry : List +>next : List +>this : List + + entry.prev = this.prev; +>entry.prev = this.prev : List +>entry.prev : List +>entry : List +>prev : List +>this.prev : List +>this : List +>prev : List + + this.prev = entry; +>this.prev = entry : List +>this.prev : List +>this : List +>prev : List +>entry : List + + return entry; +>entry : List + } + + public count(): number { +>count : () => number + + var entry: List; +>entry : List +>List : List +>T : T + + var i: number; +>i : number + + entry = this.next; +>entry = this.next : List +>entry : List +>this.next : List +>this : List +>next : List + + for (i = 0; !(entry.isHead); i++) { +>i = 0 : number +>i : number +>!(entry.isHead) : boolean +>(entry.isHead) : boolean +>entry.isHead : boolean +>entry : List +>isHead : boolean +>i++ : number +>i : number + + entry = entry.next; +>entry = entry.next : List +>entry : List +>entry.next : List +>entry : List +>next : List + } + + return (i); +>(i) : number +>i : number + } + + public isEmpty(): boolean { +>isEmpty : () => boolean + + return (this.next == this); +>(this.next == this) : boolean +>this.next == this : boolean +>this.next : List +>this : List +>next : List +>this : List + } + + public first(): T { +>first : () => T +>T : T + + if (this.isEmpty()) +>this.isEmpty() : boolean +>this.isEmpty : () => boolean +>this : List +>isEmpty : () => boolean + { + return this.next.data; +>this.next.data : T +>this.next : List +>this : List +>next : List +>data : T + } + else { + return null; + } + } + + public pushEntry(entry: List): void { +>pushEntry : (entry: List) => void +>entry : List +>List : List +>T : T + + entry.isHead = false; +>entry.isHead = false : boolean +>entry.isHead : boolean +>entry : List +>isHead : boolean + + entry.next = this.next; +>entry.next = this.next : List +>entry.next : List +>entry : List +>next : List +>this.next : List +>this : List +>next : List + + entry.prev = this; +>entry.prev = this : List +>entry.prev : List +>entry : List +>prev : List +>this : List + + this.next = entry; +>this.next = entry : List +>this.next : List +>this : List +>next : List +>entry : List + + entry.next.prev = entry; // entry.next.prev does not show intellisense, but entry.prev.prev does +>entry.next.prev = entry : List +>entry.next.prev : List +>entry.next : List +>entry : List +>next : List +>prev : List +>entry : List + } + + public push(data: T): void { +>push : (data: T) => void +>data : T +>T : T + + var entry = this.listFactory.MakeEntry(data); +>entry : List +>this.listFactory.MakeEntry(data) : List +>this.listFactory.MakeEntry : (data: T) => List +>this.listFactory : ListFactory +>this : List +>listFactory : ListFactory +>MakeEntry : (data: T) => List +>data : T + + entry.data = data; +>entry.data = data : T +>entry.data : T +>entry : List +>data : T +>data : T + + entry.isHead = false; +>entry.isHead = false : boolean +>entry.isHead : boolean +>entry : List +>isHead : boolean + + entry.next = this.next; +>entry.next = this.next : List +>entry.next : List +>entry : List +>next : List +>this.next : List +>this : List +>next : List + + entry.prev = this; +>entry.prev = this : List +>entry.prev : List +>entry : List +>prev : List +>this : List + + this.next = entry; +>this.next = entry : List +>this.next : List +>this : List +>next : List +>entry : List + + entry.next.prev = entry; // entry.next.prev does not show intellisense, but entry.prev.prev does +>entry.next.prev = entry : List +>entry.next.prev : List +>entry.next : List +>entry : List +>next : List +>prev : List +>entry : List + } + + public popEntry(head: List): List { +>popEntry : (head: List) => List +>head : List +>List : List +>T : T +>List : List +>T : T + + if (this.next.isHead) { +>this.next.isHead : boolean +>this.next : List +>this : List +>next : List +>isHead : boolean + + return null; + } + else { + return this.listFactory.RemoveEntry(this.next); +>this.listFactory.RemoveEntry(this.next) : List +>this.listFactory.RemoveEntry : (entry: List) => List +>this.listFactory : ListFactory +>this : List +>listFactory : ListFactory +>RemoveEntry : (entry: List) => List +>this.next : List +>this : List +>next : List + } + } + + public insertEntry(entry: List): List { +>insertEntry : (entry: List) => List +>entry : List +>List : List +>T : T +>List : List +>T : T + + entry.isHead = false; +>entry.isHead = false : boolean +>entry.isHead : boolean +>entry : List +>isHead : boolean + + this.prev.next = entry; +>this.prev.next = entry : List +>this.prev.next : List +>this.prev : List +>this : List +>prev : List +>next : List +>entry : List + + entry.next = this; +>entry.next = this : List +>entry.next : List +>entry : List +>next : List +>this : List + + entry.prev = this.prev; +>entry.prev = this.prev : List +>entry.prev : List +>entry : List +>prev : List +>this.prev : List +>this : List +>prev : List + + this.prev = entry; +>this.prev = entry : List +>this.prev : List +>this : List +>prev : List +>entry : List + + return entry; +>entry : List + } + + public insertAfter(data: T): List { +>insertAfter : (data: T) => List +>data : T +>T : T +>List : List +>T : T + + var entry: List = this.listFactory.MakeEntry(data); +>entry : List +>List : List +>T : T +>this.listFactory.MakeEntry(data) : List +>this.listFactory.MakeEntry : (data: T) => List +>this.listFactory : ListFactory +>this : List +>listFactory : ListFactory +>MakeEntry : (data: T) => List +>data : T + + entry.next = this.next; +>entry.next = this.next : List +>entry.next : List +>entry : List +>next : List +>this.next : List +>this : List +>next : List + + entry.prev = this; +>entry.prev = this : List +>entry.prev : List +>entry : List +>prev : List +>this : List + + this.next = entry; +>this.next = entry : List +>this.next : List +>this : List +>next : List +>entry : List + + entry.next.prev = entry;// entry.next.prev does not show intellisense, but entry.prev.prev does +>entry.next.prev = entry : List +>entry.next.prev : List +>entry.next : List +>entry : List +>next : List +>prev : List +>entry : List + + return entry; +>entry : List + } + + public insertEntryBefore(entry: List): List { +>insertEntryBefore : (entry: List) => List +>entry : List +>List : List +>T : T +>List : List +>T : T + + this.prev.next = entry; +>this.prev.next = entry : List +>this.prev.next : List +>this.prev : List +>this : List +>prev : List +>next : List +>entry : List + + entry.next = this; +>entry.next = this : List +>entry.next : List +>entry : List +>next : List +>this : List + + entry.prev = this.prev; +>entry.prev = this.prev : List +>entry.prev : List +>entry : List +>prev : List +>this.prev : List +>this : List +>prev : List + + this.prev = entry; +>this.prev = entry : List +>this.prev : List +>this : List +>prev : List +>entry : List + + return entry; +>entry : List + } + + public insertBefore(data: T): List { +>insertBefore : (data: T) => List +>data : T +>T : T +>List : List +>T : T + + var entry = this.listFactory.MakeEntry(data); +>entry : List +>this.listFactory.MakeEntry(data) : List +>this.listFactory.MakeEntry : (data: T) => List +>this.listFactory : ListFactory +>this : List +>listFactory : ListFactory +>MakeEntry : (data: T) => List +>data : T + + return this.insertEntryBefore(entry); +>this.insertEntryBefore(entry) : List +>this.insertEntryBefore : (entry: List) => List +>this : List +>insertEntryBefore : (entry: List) => List +>entry : List + } + } + + export class ListFactory { +>ListFactory : ListFactory +>T : T + + public MakeHead(): List { +>MakeHead : () => List +>T : T +>List : List +>T : T + + var entry: List = new List(true, null); +>entry : List +>List : List +>T : T +>new List(true, null) : List +>List : typeof List +>T : T + + entry.prev = entry; +>entry.prev = entry : List +>entry.prev : List +>entry : List +>prev : List +>entry : List + + entry.next = entry; +>entry.next = entry : List +>entry.next : List +>entry : List +>next : List +>entry : List + + return entry; +>entry : List + } + + public MakeEntry(data: T): List { +>MakeEntry : (data: T) => List +>T : T +>data : T +>T : T +>List : List +>T : T + + var entry: List = new List(false, data); +>entry : List +>List : List +>T : T +>new List(false, data) : List +>List : typeof List +>T : T +>data : T + + entry.prev = entry; +>entry.prev = entry : List +>entry.prev : List +>entry : List +>prev : List +>entry : List + + entry.next = entry; +>entry.next = entry : List +>entry.next : List +>entry : List +>next : List +>entry : List + + return entry; +>entry : List + } + + public RemoveEntry(entry: List): List { +>RemoveEntry : (entry: List) => List +>T : T +>entry : List +>List : List +>T : T +>List : List +>T : T + + if (entry == null) { +>entry == null : boolean +>entry : List + + return null; + } + else if (entry.isHead) { +>entry.isHead : boolean +>entry : List +>isHead : boolean + + // Can't remove the head of a list! + return null; + } + else { + entry.next.prev = entry.prev; +>entry.next.prev = entry.prev : List +>entry.next.prev : List +>entry.next : List +>entry : List +>next : List +>prev : List +>entry.prev : List +>entry : List +>prev : List + + entry.prev.next = entry.next; +>entry.prev.next = entry.next : List +>entry.prev.next : List +>entry.prev : List +>entry : List +>prev : List +>next : List +>entry.next : List +>entry : List +>next : List + + return entry; +>entry : List + } + } + } +} diff --git a/tests/baselines/reference/genericClasses0.types b/tests/baselines/reference/genericClasses0.types new file mode 100644 index 00000000000..cdf239179e3 --- /dev/null +++ b/tests/baselines/reference/genericClasses0.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/genericClasses0.ts === +class C { +>C : C +>T : T + + public x: T; +>x : T +>T : T +} + +var v1 : C; +>v1 : C +>C : C + +var y = v1.x; // should be 'string' +>y : string +>v1.x : string +>v1 : C +>x : string + diff --git a/tests/baselines/reference/genericClasses1.types b/tests/baselines/reference/genericClasses1.types new file mode 100644 index 00000000000..82ce172f5ea --- /dev/null +++ b/tests/baselines/reference/genericClasses1.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/genericClasses1.ts === +class C { +>C : C +>T : T + + public x: T; +>x : T +>T : T +} + +var v1 = new C(); +>v1 : C +>new C() : C +>C : typeof C + +var y = v1.x; // should be 'string' +>y : string +>v1.x : string +>v1 : C +>x : string + diff --git a/tests/baselines/reference/genericClasses2.types b/tests/baselines/reference/genericClasses2.types new file mode 100644 index 00000000000..d1ba890a50c --- /dev/null +++ b/tests/baselines/reference/genericClasses2.types @@ -0,0 +1,54 @@ +=== tests/cases/compiler/genericClasses2.ts === +interface Foo { +>Foo : Foo +>T : T + + a: T; +>a : T +>T : T +} + +class C { +>C : C +>T : T + + public x: T; +>x : T +>T : T + + public y: Foo; +>y : Foo +>Foo : Foo +>T : T + + public z: Foo; +>z : Foo +>Foo : Foo +} + +var v1 : C; +>v1 : C +>C : C + +var y = v1.x; // should be 'string' +>y : string +>v1.x : string +>v1 : C +>x : string + +var w = v1.y.a; // should be 'string' +>w : string +>v1.y.a : string +>v1.y : Foo +>v1 : C +>y : Foo +>a : string + +var z = v1.z.a; // should be 'number' +>z : number +>v1.z.a : number +>v1.z : Foo +>v1 : C +>z : Foo +>a : number + diff --git a/tests/baselines/reference/genericClasses3.types b/tests/baselines/reference/genericClasses3.types new file mode 100644 index 00000000000..60f9b6d0ef3 --- /dev/null +++ b/tests/baselines/reference/genericClasses3.types @@ -0,0 +1,48 @@ +=== tests/cases/compiler/genericClasses3.ts === +class B { +>B : B +>T : T + + a: T; +>a : T +>T : T + + b: T; +>b : T +>T : T +} + +class C extends B { +>C : C +>T : T +>B : B +>T : T + + public x: T; +>x : T +>T : T +} + +var v2: C ; +>v2 : C +>C : C + +var y = v2.x; // should be 'string' +>y : string +>v2.x : string +>v2 : C +>x : string + +var u = v2.a; // should be 'string' +>u : string +>v2.a : string +>v2 : C +>a : string + +var z = v2.b; +>z : string +>v2.b : string +>v2 : C +>b : string + + diff --git a/tests/baselines/reference/genericClasses4.types b/tests/baselines/reference/genericClasses4.types new file mode 100644 index 00000000000..8c09b1eed3a --- /dev/null +++ b/tests/baselines/reference/genericClasses4.types @@ -0,0 +1,98 @@ +=== tests/cases/compiler/genericClasses4.ts === +// once caused stack overflow +class Vec2_T +>Vec2_T : Vec2_T +>A : A +{ + constructor(public x: A, public y: A) { } +>x : A +>A : A +>y : A +>A : A + + fmap(f: (a: A) => B): Vec2_T { +>fmap : (f: (a: A) => B) => Vec2_T +>B : B +>f : (a: A) => B +>a : A +>A : A +>B : B +>Vec2_T : Vec2_T +>B : B + + var x:B = f(this.x); +>x : B +>B : B +>f(this.x) : B +>f : (a: A) => B +>this.x : A +>this : Vec2_T +>x : A + + var y:B = f(this.y); +>y : B +>B : B +>f(this.y) : B +>f : (a: A) => B +>this.y : A +>this : Vec2_T +>y : A + + var retval: Vec2_T = new Vec2_T(x, y); +>retval : Vec2_T +>Vec2_T : Vec2_T +>B : B +>new Vec2_T(x, y) : Vec2_T +>Vec2_T : typeof Vec2_T +>x : B +>y : B + + return retval; +>retval : Vec2_T + } + apply(f: Vec2_T<(a: A) => B>): Vec2_T { +>apply : (f: Vec2_T<(a: A) => B>) => Vec2_T +>B : B +>f : Vec2_T<(a: A) => B> +>Vec2_T : Vec2_T +>a : A +>A : A +>B : B +>Vec2_T : Vec2_T +>B : B + + var x:B = f.x(this.x); +>x : B +>B : B +>f.x(this.x) : B +>f.x : (a: A) => B +>f : Vec2_T<(a: A) => B> +>x : (a: A) => B +>this.x : A +>this : Vec2_T +>x : A + + var y:B = f.y(this.y); +>y : B +>B : B +>f.y(this.y) : B +>f.y : (a: A) => B +>f : Vec2_T<(a: A) => B> +>y : (a: A) => B +>this.y : A +>this : Vec2_T +>y : A + + var retval: Vec2_T = new Vec2_T(x, y); +>retval : Vec2_T +>Vec2_T : Vec2_T +>B : B +>new Vec2_T(x, y) : Vec2_T +>Vec2_T : typeof Vec2_T +>x : B +>y : B + + return retval; +>retval : Vec2_T + } +} diff --git a/tests/baselines/reference/genericClassesInModule.types b/tests/baselines/reference/genericClassesInModule.types new file mode 100644 index 00000000000..65262decdb6 --- /dev/null +++ b/tests/baselines/reference/genericClassesInModule.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/genericClassesInModule.ts === + +module Foo { +>Foo : typeof Foo + + export class B{ } +>B : B +>T : T + + export class A { } +>A : A +} + +var a = new Foo.B(); +>a : B +>new Foo.B() : B +>Foo.B : typeof B +>Foo : typeof Foo +>B : typeof B +>Foo : Foo +>A : A + diff --git a/tests/baselines/reference/genericClassesInModule2.types b/tests/baselines/reference/genericClassesInModule2.types new file mode 100644 index 00000000000..c8c343f9228 --- /dev/null +++ b/tests/baselines/reference/genericClassesInModule2.types @@ -0,0 +1,63 @@ +=== tests/cases/compiler/genericClassesInModule2.ts === +export class A{ +>A : A +>T1 : T1 + + constructor( public callback: (self: A) => void) { +>callback : (self: A) => void +>self : A +>A : A +>T1 : T1 + + var child = new B(this); +>child : B> +>new B(this) : B> +>B : typeof B +>this : A + } + AAA( callback: (self: A) => void) { +>AAA : (callback: (self: A) => void) => void +>callback : (self: A) => void +>self : A +>A : A +>T1 : T1 + + var child = new B(this); +>child : B> +>new B(this) : B> +>B : typeof B +>this : A + } +} + +export interface C{ +>C : C +>T1 : T1 + + child: B; +>child : B +>B : B +>T1 : T1 + + (self: C): void; +>self : C +>C : C +>T1 : T1 + + new(callback: (self: C) => void) +>callback : (self: C) => void +>self : C +>C : C +>T1 : T1 +} + +export class B { +>B : B +>T2 : T2 + + constructor(public parent: T2) { } +>parent : T2 +>T2 : T2 +} + + diff --git a/tests/baselines/reference/genericCloduleInModule.types b/tests/baselines/reference/genericCloduleInModule.types new file mode 100644 index 00000000000..9c2dcaccf08 --- /dev/null +++ b/tests/baselines/reference/genericCloduleInModule.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/genericCloduleInModule.ts === +module A { +>A : typeof A + + export class B { +>B : B +>T : T + + foo() { } +>foo : () => void + + static bar() { } +>bar : () => void + } + export module B { +>B : typeof B + + export var x = 1; +>x : number + } +} + +var b: A.B; +>b : B +>A : A +>B : B + +b.foo(); +>b.foo() : void +>b.foo : () => void +>b : B +>foo : () => void + diff --git a/tests/baselines/reference/genericConstraintDeclaration.types b/tests/baselines/reference/genericConstraintDeclaration.types new file mode 100644 index 00000000000..2d23a75c685 --- /dev/null +++ b/tests/baselines/reference/genericConstraintDeclaration.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/genericConstraintDeclaration.ts === +class List{ +>List : List +>T : T + + static empty(): List{return null;} +>empty : () => List +>T : T +>List : List +>T : T +} + + + + + diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.types b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.types new file mode 100644 index 00000000000..6f80266d8a5 --- /dev/null +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.types @@ -0,0 +1,65 @@ +=== tests/cases/compiler/genericConstraintOnExtendedBuiltinTypes.ts === +declare module EndGate { +>EndGate : typeof EndGate + + export interface ICloneable { +>ICloneable : ICloneable + + Clone(): any; +>Clone : () => any + } +} + +interface Number extends EndGate.ICloneable { } +>Number : Number +>EndGate : EndGate +>ICloneable : ICloneable + +module EndGate.Tweening { +>EndGate : typeof EndGate +>Tweening : typeof Tweening + + export class Tween{ +>Tween : Tween +>T : T +>ICloneable : ICloneable + + private _from: T; +>_from : T +>T : T + + + constructor(from: T) { +>from : T +>T : T + + this._from = from.Clone(); +>this._from = from.Clone() : any +>this._from : T +>this : Tween +>_from : T +>from.Clone() : any +>from.Clone : () => any +>from : T +>Clone : () => any + } + } +} + +module EndGate.Tweening { +>EndGate : typeof EndGate +>Tweening : typeof Tweening + + export class NumberTween extends Tween{ +>NumberTween : NumberTween +>Tween : Tween + + constructor(from: number) { +>from : number + + super(from); +>super(from) : void +>from : number + } + } +} diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.types b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.types new file mode 100644 index 00000000000..c7482c64f14 --- /dev/null +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.types @@ -0,0 +1,65 @@ +=== tests/cases/compiler/genericConstraintOnExtendedBuiltinTypes2.ts === +module EndGate { +>EndGate : typeof EndGate + + export interface ICloneable { +>ICloneable : ICloneable + + Clone(): any; +>Clone : () => any + } +} + +interface Number extends EndGate.ICloneable { } +>Number : Number +>EndGate : EndGate +>ICloneable : ICloneable + +module EndGate.Tweening { +>EndGate : typeof EndGate +>Tweening : typeof Tweening + + export class Tween{ +>Tween : Tween +>T : T +>ICloneable : ICloneable + + private _from: T; +>_from : T +>T : T + + constructor(from: T) { +>from : T +>T : T + + this._from = from.Clone(); +>this._from = from.Clone() : any +>this._from : T +>this : Tween +>_from : T +>from.Clone() : any +>from.Clone : () => any +>from : T +>Clone : () => any + } + } +} + +module EndGate.Tweening { +>EndGate : typeof EndGate +>Tweening : typeof Tweening + + export class NumberTween extends Tween{ +>NumberTween : NumberTween +>Tween : Tween +>Number : Number + + constructor(from: number) { +>from : number + + super(from); +>super(from) : void +>from : number + } + } +} diff --git a/tests/baselines/reference/genericConstructSignatureInInterface.types b/tests/baselines/reference/genericConstructSignatureInInterface.types new file mode 100644 index 00000000000..5318edb5bf1 --- /dev/null +++ b/tests/baselines/reference/genericConstructSignatureInInterface.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/genericConstructSignatureInInterface.ts === +interface C { +>C : C + + new (x: T); +>T : T +>x : T +>T : T +} + +var v: C; +>v : C +>C : C + +var r = new v(1); +>r : any +>new v(1) : any +>v : C + diff --git a/tests/baselines/reference/genericContextualTypingSpecialization.types b/tests/baselines/reference/genericContextualTypingSpecialization.types new file mode 100644 index 00000000000..890da96c260 --- /dev/null +++ b/tests/baselines/reference/genericContextualTypingSpecialization.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/genericContextualTypingSpecialization.ts === +var b: number[]; +>b : number[] + +b.reduce((c, d) => c + d, 0); // should not error on '+' +>b.reduce((c, d) => c + d, 0) : number +>b.reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue?: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; } +>b : number[] +>reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue?: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; } +>(c, d) => c + d : (c: number, d: number) => number +>c : number +>d : number +>c + d : number +>c : number +>d : number + diff --git a/tests/baselines/reference/genericFunctionHasFreshTypeArgs.types b/tests/baselines/reference/genericFunctionHasFreshTypeArgs.types new file mode 100644 index 00000000000..3a3afebb9ac --- /dev/null +++ b/tests/baselines/reference/genericFunctionHasFreshTypeArgs.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/genericFunctionHasFreshTypeArgs.ts === +function f(p: (x: T) => void) { }; +>f : (p: (x: T) => void) => void +>p : (x: T) => void +>T : T +>x : T +>T : T + +f(x => f(y => x = y)); +>f(x => f(y => x = y)) : void +>f : (p: (x: T) => void) => void +>x => f(y => x = y) : (x: any) => void +>x : any +>f(y => x = y) : void +>f : (p: (x: T) => void) => void +>y => x = y : (y: any) => any +>y : any +>x = y : any +>x : any +>y : any + diff --git a/tests/baselines/reference/genericFunctionSpecializations1.types b/tests/baselines/reference/genericFunctionSpecializations1.types new file mode 100644 index 00000000000..60819c786b8 --- /dev/null +++ b/tests/baselines/reference/genericFunctionSpecializations1.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/genericFunctionSpecializations1.ts === +function foo3(test: string); // error +>foo3 : (test: string) => any +>T : T +>test : string + +function foo3(test: T) { } +>foo3 : (test: string) => any +>T : T +>test : T +>T : T + +function foo4(test: string); // valid +>foo4 : (test: string) => any +>T : T +>test : string + +function foo4(test: T) { } +>foo4 : (test: string) => any +>T : T +>String : String +>test : T +>T : T + diff --git a/tests/baselines/reference/genericFunctions0.types b/tests/baselines/reference/genericFunctions0.types new file mode 100644 index 00000000000..045224a7aaa --- /dev/null +++ b/tests/baselines/reference/genericFunctions0.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/genericFunctions0.ts === +function foo (x: T) { return x; } +>foo : (x: T) => T +>T : T +>x : T +>T : T +>x : T + +var x = foo(5); // 'x' should be number +>x : number +>foo(5) : number +>foo : (x: T) => T + diff --git a/tests/baselines/reference/genericFunctions1.types b/tests/baselines/reference/genericFunctions1.types new file mode 100644 index 00000000000..aed264c78e1 --- /dev/null +++ b/tests/baselines/reference/genericFunctions1.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/genericFunctions1.ts === +function foo (x: T) { return x; } +>foo : (x: T) => T +>T : T +>x : T +>T : T +>x : T + +var x = foo(5); // 'x' should be number +>x : number +>foo(5) : number +>foo : (x: T) => T + diff --git a/tests/baselines/reference/genericFunctions2.types b/tests/baselines/reference/genericFunctions2.types new file mode 100644 index 00000000000..96e757d3d9e --- /dev/null +++ b/tests/baselines/reference/genericFunctions2.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/genericFunctions2.ts === +declare function map (items: T[], f: (x: T) => U): U[]; +>map : (items: T[], f: (x: T) => U) => U[] +>T : T +>U : U +>items : T[] +>T : T +>f : (x: T) => U +>x : T +>T : T +>U : U +>U : U + +var myItems: string[]; +>myItems : string[] + +var lengths = map(myItems, x => x.length); +>lengths : number[] +>map(myItems, x => x.length) : number[] +>map : (items: T[], f: (x: T) => U) => U[] +>myItems : string[] +>x => x.length : (x: string) => number +>x : string +>x.length : number +>x : string +>length : number + + diff --git a/tests/baselines/reference/genericFunctions3.types b/tests/baselines/reference/genericFunctions3.types new file mode 100644 index 00000000000..25011d1cf1d --- /dev/null +++ b/tests/baselines/reference/genericFunctions3.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/genericFunctions3.ts === +interface Query { +>Query : Query +>T : T + + foo(x: string): Query; +>foo : (x: string) => Query +>x : string +>Query : Query +>T : T +} + +function from(arg: boolean): Query; // was Error: Overload signature is not compatible with function definition. +>from : (arg: boolean) => Query +>T : T +>arg : boolean +>Query : Query +>T : T + +function from(arg: any): Query { +>from : (arg: boolean) => Query +>T : T +>arg : any +>Query : Query +>T : T + + return undefined; +>undefined : undefined +} + diff --git a/tests/baselines/reference/genericFunctionsWithOptionalParameters1.types b/tests/baselines/reference/genericFunctionsWithOptionalParameters1.types new file mode 100644 index 00000000000..f779f1ab888 --- /dev/null +++ b/tests/baselines/reference/genericFunctionsWithOptionalParameters1.types @@ -0,0 +1,50 @@ +=== tests/cases/compiler/genericFunctionsWithOptionalParameters1.ts === +interface Utils { +>Utils : Utils + + fold(c?: Array, folder?: (s: S, t: T) => T, init?: S): T; +>fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T +>T : T +>S : S +>c : T[] +>Array : Array +>T : T +>folder : (s: S, t: T) => T +>s : S +>S : S +>t : T +>T : T +>T : T +>init : S +>S : S +>T : T +} + +var utils: Utils; +>utils : Utils +>Utils : Utils + +utils.fold(); // no error +>utils.fold() : {} +>utils.fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T +>utils : Utils +>fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T + +utils.fold(null); // no error +>utils.fold(null) : {} +>utils.fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T +>utils : Utils +>fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T + +utils.fold(null, null); // no error +>utils.fold(null, null) : {} +>utils.fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T +>utils : Utils +>fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T + +utils.fold(null, null, null); // no error +>utils.fold(null, null, null) : {} +>utils.fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T +>utils : Utils +>fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T + diff --git a/tests/baselines/reference/genericFunctionsWithOptionalParameters3.types b/tests/baselines/reference/genericFunctionsWithOptionalParameters3.types new file mode 100644 index 00000000000..4de26343bbc --- /dev/null +++ b/tests/baselines/reference/genericFunctionsWithOptionalParameters3.types @@ -0,0 +1,108 @@ +=== tests/cases/compiler/genericFunctionsWithOptionalParameters3.ts === +class Collection { +>Collection : Collection +>T : T + + public add(x: T) { } +>add : (x: T) => void +>x : T +>T : T +} +interface Utils { +>Utils : Utils + + fold(c?: Collection, folder?: (s: S, t: T) => T, init?: S): T; +>fold : (c?: Collection, folder?: (s: S, t: T) => T, init?: S) => T +>T : T +>S : S +>c : Collection +>Collection : Collection +>T : T +>folder : (s: S, t: T) => T +>s : S +>S : S +>t : T +>T : T +>T : T +>init : S +>S : S +>T : T + + mapReduce(c: Collection, mapper: (x: T) => U, reducer: (y: U) => V): Collection; +>mapReduce : (c: Collection, mapper: (x: T) => U, reducer: (y: U) => V) => Collection +>T : T +>U : U +>V : V +>c : Collection +>Collection : Collection +>T : T +>mapper : (x: T) => U +>x : T +>T : T +>U : U +>reducer : (y: U) => V +>y : U +>U : U +>V : V +>Collection : Collection +>V : V +} +var utils: Utils; +>utils : Utils +>Utils : Utils + +var c = new Collection(); +>c : Collection +>new Collection() : Collection +>Collection : typeof Collection + +var r3 = utils.mapReduce(c, (x) => { return 1 }, (y) => { return new Date() }); +>r3 : Collection +>utils.mapReduce(c, (x) => { return 1 }, (y) => { return new Date() }) : Collection +>utils.mapReduce : (c: Collection, mapper: (x: T) => U, reducer: (y: U) => V) => Collection +>utils : Utils +>mapReduce : (c: Collection, mapper: (x: T) => U, reducer: (y: U) => V) => Collection +>c : Collection +>(x) => { return 1 } : (x: string) => number +>x : string +>(y) => { return new Date() } : (y: number) => Date +>y : number +>new Date() : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } + +var r4 = utils.mapReduce(c, (x: string) => { return 1 }, (y: number) => { return new Date() }); +>r4 : Collection +>utils.mapReduce(c, (x: string) => { return 1 }, (y: number) => { return new Date() }) : Collection +>utils.mapReduce : (c: Collection, mapper: (x: T) => U, reducer: (y: U) => V) => Collection +>utils : Utils +>mapReduce : (c: Collection, mapper: (x: T) => U, reducer: (y: U) => V) => Collection +>c : Collection +>(x: string) => { return 1 } : (x: string) => number +>x : string +>(y: number) => { return new Date() } : (y: number) => Date +>y : number +>new Date() : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } + +var f1 = (x: string) => { return 1 }; +>f1 : (x: string) => number +>(x: string) => { return 1 } : (x: string) => number +>x : string + +var f2 = (y: number) => { return new Date() }; +>f2 : (y: number) => Date +>(y: number) => { return new Date() } : (y: number) => Date +>y : number +>new Date() : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } + +var r5 = utils.mapReduce(c, f1, f2); +>r5 : Collection +>utils.mapReduce(c, f1, f2) : Collection +>utils.mapReduce : (c: Collection, mapper: (x: T) => U, reducer: (y: U) => V) => Collection +>utils : Utils +>mapReduce : (c: Collection, mapper: (x: T) => U, reducer: (y: U) => V) => Collection +>c : Collection +>f1 : (x: string) => number +>f2 : (y: number) => Date + diff --git a/tests/baselines/reference/genericImplements.types b/tests/baselines/reference/genericImplements.types new file mode 100644 index 00000000000..e96e46c81cb --- /dev/null +++ b/tests/baselines/reference/genericImplements.types @@ -0,0 +1,60 @@ +=== tests/cases/compiler/genericImplements.ts === +class A { a; }; +>A : A +>a : any + +class B { b; }; +>B : B +>b : any + +interface I { +>I : I + + f(): T; +>f : () => T +>T : T +>A : A +>T : T + +} // { f: () => { a; } } + +// OK +class X implements I { +>X : X +>I : I + + f(): T { return undefined; } +>f : () => T +>T : T +>B : B +>T : T +>undefined : undefined + +} // { f: () => { b; } } + +// OK +class Y implements I { +>Y : Y +>I : I + + f(): T { return undefined; } +>f : () => T +>T : T +>A : A +>T : T +>undefined : undefined + +} // { f: () => { a; } } + +// OK +class Z implements I { +>Z : Z +>I : I + + f(): T { return undefined; } +>f : () => T +>T : T +>T : T +>undefined : undefined + +} // { f: () => T } diff --git a/tests/baselines/reference/genericInference1.types b/tests/baselines/reference/genericInference1.types new file mode 100644 index 00000000000..f83a1dcd361 --- /dev/null +++ b/tests/baselines/reference/genericInference1.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/genericInference1.ts === +['a', 'b', 'c'].map(x => x.length); +>['a', 'b', 'c'].map(x => x.length) : number[] +>['a', 'b', 'c'].map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>['a', 'b', 'c'] : string[] +>map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>x => x.length : (x: string) => number +>x : string +>x.length : number +>x : string +>length : number + diff --git a/tests/baselines/reference/genericInference2.types b/tests/baselines/reference/genericInference2.types new file mode 100644 index 00000000000..fb84602a076 --- /dev/null +++ b/tests/baselines/reference/genericInference2.types @@ -0,0 +1,102 @@ +=== tests/cases/compiler/genericInference2.ts === + declare module ko { +>ko : typeof ko + + export interface Observable { +>Observable : Observable +>T : T + + (): T; +>T : T + + (value: T): any; +>value : T +>T : T + + N: number; +>N : number + + g: boolean; +>g : boolean + + r: T; +>r : T +>T : T + } + export function observable(value: T): Observable; +>observable : (value: T) => Observable +>T : T +>value : T +>T : T +>Observable : Observable +>T : T + } + var o = { +>o : { name: Observable; age: Observable; } +>{ + name: ko.observable("Bob"), + age: ko.observable(37) + } : { name: Observable; age: Observable; } + + name: ko.observable("Bob"), +>name : Observable +>ko.observable("Bob") : Observable +>ko.observable : (value: T) => Observable +>ko : typeof ko +>observable : (value: T) => Observable + + age: ko.observable(37) +>age : Observable +>ko.observable(37) : Observable +>ko.observable : (value: T) => Observable +>ko : typeof ko +>observable : (value: T) => Observable + + }; + var x_v = o.name().length; // should be 'number' +>x_v : number +>o.name().length : number +>o.name() : string +>o.name : Observable +>o : { name: Observable; age: Observable; } +>name : Observable +>length : number + + var age_v = o.age(); // should be 'number' +>age_v : number +>o.age() : number +>o.age : Observable +>o : { name: Observable; age: Observable; } +>age : Observable + + var name_v = o.name("Robert"); // should be 'any' +>name_v : any +>o.name("Robert") : any +>o.name : Observable +>o : { name: Observable; age: Observable; } +>name : Observable + + var zz_v = o.name.N; // should be 'number' +>zz_v : number +>o.name.N : number +>o.name : Observable +>o : { name: Observable; age: Observable; } +>name : Observable +>N : number + + var yy_v = o.name.g; // should be 'boolean' +>yy_v : boolean +>o.name.g : boolean +>o.name : Observable +>o : { name: Observable; age: Observable; } +>name : Observable +>g : boolean + + var rr_v = o.name.r; // should be 'string' +>rr_v : string +>o.name.r : string +>o.name : Observable +>o : { name: Observable; age: Observable; } +>name : Observable +>r : string + diff --git a/tests/baselines/reference/genericInstanceOf.types b/tests/baselines/reference/genericInstanceOf.types new file mode 100644 index 00000000000..726fa38fbf8 --- /dev/null +++ b/tests/baselines/reference/genericInstanceOf.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/genericInstanceOf.ts === +interface F { +>F : F + + (): number; +} + +class C { +>C : C +>T : T + + constructor(public a: T, public b: F) {} +>a : T +>T : T +>b : F +>F : F + + foo() { +>foo : () => void + + if (this.a instanceof this.b) { +>this.a instanceof this.b : boolean +>this.a : T +>this : C +>a : T +>this.b : F +>this : C +>b : F + } + } +} diff --git a/tests/baselines/reference/genericInstantiationEquivalentToObjectLiteral.types b/tests/baselines/reference/genericInstantiationEquivalentToObjectLiteral.types new file mode 100644 index 00000000000..69597826589 --- /dev/null +++ b/tests/baselines/reference/genericInstantiationEquivalentToObjectLiteral.types @@ -0,0 +1,68 @@ +=== tests/cases/conformance/types/namedTypes/genericInstantiationEquivalentToObjectLiteral.ts === +interface Pair { first: T1; second: T2; } +>Pair : Pair +>T1 : T1 +>T2 : T2 +>first : T1 +>T1 : T1 +>second : T2 +>T2 : T2 + +var x: Pair +>x : Pair +>Pair : Pair + +var y: { first: string; second: number; } +>y : { first: string; second: number; } +>first : string +>second : number + +x = y; +>x = y : { first: string; second: number; } +>x : Pair +>y : { first: string; second: number; } + +y = x; +>y = x : Pair +>y : { first: string; second: number; } +>x : Pair + +declare function f(x: Pair); +>f : (x: Pair) => any +>T : T +>U : U +>x : Pair +>Pair : Pair +>T : T +>U : U + +declare function f2(x: { first: T; second: U; }); +>f2 : (x: { first: T; second: U; }) => any +>T : T +>U : U +>x : { first: T; second: U; } +>first : T +>T : T +>second : U +>U : U + +f(x); +>f(x) : any +>f : (x: Pair) => any +>x : Pair + +f(y); +>f(y) : any +>f : (x: Pair) => any +>y : { first: string; second: number; } + +f2(x); +>f2(x) : any +>f2 : (x: { first: T; second: U; }) => any +>x : Pair + +f2(y); +>f2(y) : any +>f2 : (x: { first: T; second: U; }) => any +>y : { first: string; second: number; } + diff --git a/tests/baselines/reference/genericInterfaceFunctionTypeParameter.types b/tests/baselines/reference/genericInterfaceFunctionTypeParameter.types new file mode 100644 index 00000000000..7d1861ea40d --- /dev/null +++ b/tests/baselines/reference/genericInterfaceFunctionTypeParameter.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/genericInterfaceFunctionTypeParameter.ts === +export interface IFoo { } +>IFoo : IFoo +>A : A + +export function foo(fn: (ifoo: IFoo) => void) { +>foo : (fn: (ifoo: IFoo) => void) => void +>A : A +>fn : (ifoo: IFoo) => void +>ifoo : IFoo +>IFoo : IFoo +>A : A + + foo(fn); // Invocation is necessary to repro (!) +>foo(fn) : void +>foo : (fn: (ifoo: IFoo) => void) => void +>fn : (ifoo: IFoo) => void +} + + + diff --git a/tests/baselines/reference/genericInterfaceImplementation.types b/tests/baselines/reference/genericInterfaceImplementation.types new file mode 100644 index 00000000000..bb0e1250f24 --- /dev/null +++ b/tests/baselines/reference/genericInterfaceImplementation.types @@ -0,0 +1,42 @@ +=== tests/cases/compiler/genericInterfaceImplementation.ts === +interface IOption { +>IOption : IOption +>A : A + + get(): A; +>get : () => A +>A : A + + flatten(): IOption; +>flatten : () => IOption +>B : B +>IOption : IOption +>B : B +} + +class None implements IOption{ +>None : None +>T : T +>IOption : IOption +>T : T + + get(): T { +>get : () => T +>T : T + + throw null; + } + + flatten() : IOption { +>flatten : () => IOption +>U : U +>IOption : IOption +>U : U + + return new None(); +>new None() : None +>None : typeof None +>U : U + } +} + diff --git a/tests/baselines/reference/genericInterfaceTypeCall.types b/tests/baselines/reference/genericInterfaceTypeCall.types new file mode 100644 index 00000000000..4f74c3137fb --- /dev/null +++ b/tests/baselines/reference/genericInterfaceTypeCall.types @@ -0,0 +1,60 @@ +=== tests/cases/compiler/genericInterfaceTypeCall.ts === +interface Foo { +>Foo : Foo +>T : T + + reject(arg: T): void; +>reject : (arg: T) => void +>arg : T +>T : T +} +var foo: Foo +>foo : Foo +>Foo : Foo + +interface bar { +>bar : bar +>T : T + + fail(func: (arg: T) => void ): void; +>fail : (func: (arg: T) => void) => void +>func : (arg: T) => void +>arg : T +>T : T + + fail2(func2: { (arg: T): void; }): void; +>fail2 : (func2: (arg: T) => void) => void +>func2 : (arg: T) => void +>arg : T +>T : T +} +var test: bar; +>test : bar +>bar : bar + +test.fail(arg => foo.reject(arg)); +>test.fail(arg => foo.reject(arg)) : void +>test.fail : (func: (arg: string) => void) => void +>test : bar +>fail : (func: (arg: string) => void) => void +>arg => foo.reject(arg) : (arg: string) => void +>arg : string +>foo.reject(arg) : void +>foo.reject : (arg: string) => void +>foo : Foo +>reject : (arg: string) => void +>arg : string + +test.fail2(arg => foo.reject(arg)); // Error: Supplied parameters do not match any signature of call target +>test.fail2(arg => foo.reject(arg)) : void +>test.fail2 : (func2: (arg: string) => void) => void +>test : bar +>fail2 : (func2: (arg: string) => void) => void +>arg => foo.reject(arg) : (arg: string) => void +>arg : string +>foo.reject(arg) : void +>foo.reject : (arg: string) => void +>foo : Foo +>reject : (arg: string) => void +>arg : string + diff --git a/tests/baselines/reference/genericMethodOverspecialization.types b/tests/baselines/reference/genericMethodOverspecialization.types new file mode 100644 index 00000000000..c3f8a86d7eb --- /dev/null +++ b/tests/baselines/reference/genericMethodOverspecialization.types @@ -0,0 +1,93 @@ +=== tests/cases/compiler/genericMethodOverspecialization.ts === +var names = ["list", "table1", "table2", "table3", "summary"]; +>names : string[] +>["list", "table1", "table2", "table3", "summary"] : string[] + +interface HTMLElement { +>HTMLElement : HTMLElement + + clientWidth: number; +>clientWidth : number + + isDisabled: boolean; +>isDisabled : boolean +} + +declare var document: Document; +>document : Document +>Document : Document + +interface Document { +>Document : Document + + getElementById(elementId: string): HTMLElement; +>getElementById : (elementId: string) => HTMLElement +>elementId : string +>HTMLElement : HTMLElement +} + +var elements = names.map(function (name) { +>elements : HTMLElement[] +>names.map(function (name) { + return document.getElementById(name); +}) : HTMLElement[] +>names.map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>names : string[] +>map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>function (name) { + return document.getElementById(name); +} : (name: string) => HTMLElement +>name : string + + return document.getElementById(name); +>document.getElementById(name) : HTMLElement +>document.getElementById : (elementId: string) => HTMLElement +>document : Document +>getElementById : (elementId: string) => HTMLElement +>name : string + +}); + + +var xxx = elements.filter(function (e) { +>xxx : HTMLElement[] +>elements.filter(function (e) { + return !e.isDisabled; +}) : HTMLElement[] +>elements.filter : (callbackfn: (value: HTMLElement, index: number, array: HTMLElement[]) => boolean, thisArg?: any) => HTMLElement[] +>elements : HTMLElement[] +>filter : (callbackfn: (value: HTMLElement, index: number, array: HTMLElement[]) => boolean, thisArg?: any) => HTMLElement[] +>function (e) { + return !e.isDisabled; +} : (e: HTMLElement) => boolean +>e : HTMLElement + + return !e.isDisabled; +>!e.isDisabled : boolean +>e.isDisabled : boolean +>e : HTMLElement +>isDisabled : boolean + +}); + +var widths:number[] = elements.map(function (e) { // should not error +>widths : number[] +>elements.map(function (e) { // should not error + return e.clientWidth; +}) : number[] +>elements.map : (callbackfn: (value: HTMLElement, index: number, array: HTMLElement[]) => U, thisArg?: any) => U[] +>elements : HTMLElement[] +>map : (callbackfn: (value: HTMLElement, index: number, array: HTMLElement[]) => U, thisArg?: any) => U[] +>function (e) { // should not error + return e.clientWidth; +} : (e: HTMLElement) => number +>e : HTMLElement + + return e.clientWidth; +>e.clientWidth : number +>e : HTMLElement +>clientWidth : number + +}); + + diff --git a/tests/baselines/reference/genericObjectLitReturnType.types b/tests/baselines/reference/genericObjectLitReturnType.types new file mode 100644 index 00000000000..b597931209c --- /dev/null +++ b/tests/baselines/reference/genericObjectLitReturnType.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/genericObjectLitReturnType.ts === +class X +>X : X +>T : T +{ + f(t: T) { return { a: t }; } +>f : (t: T) => { a: T; } +>t : T +>T : T +>{ a: t } : { a: T; } +>a : T +>t : t +} + + +var x: X; +>x : X +>X : X + +var t1 = x.f(5); +>t1 : { a: number; } +>x.f(5) : { a: number; } +>x.f : (t: number) => { a: number; } +>x : X +>f : (t: number) => { a: number; } + +t1.a = 5; // Should not error: t1 should have type {a: number}, instead has type {a: T} +>t1.a = 5 : number +>t1.a : number +>t1 : { a: number; } +>a : number + + diff --git a/tests/baselines/reference/genericOfACloduleType1.types b/tests/baselines/reference/genericOfACloduleType1.types new file mode 100644 index 00000000000..b530859140e --- /dev/null +++ b/tests/baselines/reference/genericOfACloduleType1.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/genericOfACloduleType1.ts === +class G{ bar(x: T) { return x; } } +>G : G +>T : T +>bar : (x: T) => T +>x : T +>T : T +>x : T + +module M { +>M : typeof M + + export class C { foo() { } } +>C : C +>foo : () => void + + export module C { +>C : typeof C + + export class X { +>X : X + } + } + + var g1 = new G(); +>g1 : G +>new G() : G +>G : typeof G +>C : C + + g1.bar(null).foo(); +>g1.bar(null).foo() : void +>g1.bar(null).foo : () => void +>g1.bar(null) : C +>g1.bar : (x: C) => C +>g1 : G +>bar : (x: C) => C +>foo : () => void +} +var g2 = new G() // was: error Type reference cannot refer to container 'M.C'. +>g2 : G +>new G() : G +>G : typeof G +>M : M +>C : C + diff --git a/tests/baselines/reference/genericOfACloduleType2.types b/tests/baselines/reference/genericOfACloduleType2.types new file mode 100644 index 00000000000..4c224aed12d --- /dev/null +++ b/tests/baselines/reference/genericOfACloduleType2.types @@ -0,0 +1,50 @@ +=== tests/cases/compiler/genericOfACloduleType2.ts === +class G{ bar(x: T) { return x; } } +>G : G +>T : T +>bar : (x: T) => T +>x : T +>T : T +>x : T + +module M { +>M : typeof M + + export class C { foo() { } } +>C : C +>foo : () => void + + export module C { +>C : typeof C + + export class X { +>X : X + } + } + + var g1 = new G(); +>g1 : G +>new G() : G +>G : typeof G +>C : C + + g1.bar(null).foo(); // no error +>g1.bar(null).foo() : void +>g1.bar(null).foo : () => void +>g1.bar(null) : C +>g1.bar : (x: C) => C +>g1 : G +>bar : (x: C) => C +>foo : () => void +} + +module N { +>N : typeof N + + var g2 = new G() +>g2 : G +>new G() : G +>G : typeof G +>M : M +>C : C +} diff --git a/tests/baselines/reference/genericOverloadSignatures.types b/tests/baselines/reference/genericOverloadSignatures.types new file mode 100644 index 00000000000..134daff9ba3 --- /dev/null +++ b/tests/baselines/reference/genericOverloadSignatures.types @@ -0,0 +1,101 @@ +=== tests/cases/compiler/genericOverloadSignatures.ts === +interface A { +>A : A + + (x: T): void; +>T : T +>x : T +>T : T + + (x: T): void; +>T : T +>x : T +>T : T +} + +function f(a: T); +>f : { (a: T): any; (a: T): any; } +>T : T +>a : T +>T : T + +function f(a: T); +>f : { (a: T): any; (a: T): any; } +>T : T +>a : T +>T : T + +function f(a) { } +>f : { (a: T): any; (a: T): any; } +>a : any + +interface I2 { +>I2 : I2 + + f(x: T): number; +>f : { (x: T): number; (x: T): string; } +>T : T +>x : T +>T : T + + f(x: T): string; +>f : { (x: T): number; (x: T): string; } +>T : T +>x : T +>T : T +} + +interface I3 { +>I3 : I3 +>T : T + + f(x: T): number; +>f : { (x: T): number; (x: T): string; } +>x : T +>T : T + + f(x: T): string; +>f : { (x: T): number; (x: T): string; } +>x : T +>T : T +} + +class C2 { +>C2 : C2 +>T : T +} +var b: { +>b : { new (x: T, y: string): C2; new (x: T, y: string): C2; } + + new (x: T, y: string): C2; +>T : T +>x : T +>T : T +>y : string +>C2 : C2 +>T : T + + new (x: T, y: string): C2; +>T : T +>x : T +>T : T +>y : string +>C2 : C2 +>T : T +} + +interface D { +>D : D + + (x: T): T; +>T : T +>x : T +>T : T +>T : T + + (x: T): T; +>T : T +>x : T +>T : T +>T : T +} diff --git a/tests/baselines/reference/genericParameterAssignability1.types b/tests/baselines/reference/genericParameterAssignability1.types new file mode 100644 index 00000000000..b7888014dea --- /dev/null +++ b/tests/baselines/reference/genericParameterAssignability1.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/genericParameterAssignability1.ts === +function f(x: T): T { return null; } +>f : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +var r = (x: T) => x; +>r : (x: T) => T +>(x: T) => x : (x: T) => T +>T : T +>x : T +>T : T +>x : T + +r = f; // should be allowed +>r = f : (x: T) => T +>r : (x: T) => T +>f : (x: T) => T + diff --git a/tests/baselines/reference/genericPrototypeProperty.types b/tests/baselines/reference/genericPrototypeProperty.types new file mode 100644 index 00000000000..a25914229b0 --- /dev/null +++ b/tests/baselines/reference/genericPrototypeProperty.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/genericPrototypeProperty.ts === +class C { +>C : C +>T : T + + x: T; +>x : T +>T : T + + foo(x: T): T { return null; } +>foo : (x: T) => T +>x : T +>T : T +>T : T +} + +var r = C.prototype; +>r : C +>C.prototype : C +>C : typeof C +>prototype : C + +// should be any +var r2 = r.x +>r2 : any +>r.x : any +>r : C +>x : any + +var r3 = r.foo(null); +>r3 : any +>r.foo(null) : any +>r.foo : (x: any) => any +>r : C +>foo : (x: any) => any + diff --git a/tests/baselines/reference/genericPrototypeProperty2.types b/tests/baselines/reference/genericPrototypeProperty2.types new file mode 100644 index 00000000000..ca45d87ef52 --- /dev/null +++ b/tests/baselines/reference/genericPrototypeProperty2.types @@ -0,0 +1,39 @@ +=== tests/cases/compiler/genericPrototypeProperty2.ts === +interface EventTarget { x } +>EventTarget : EventTarget +>x : any + +class BaseEvent { +>BaseEvent : BaseEvent + + target: EventTarget; +>target : EventTarget +>EventTarget : EventTarget +} + +class MyEvent extends BaseEvent { +>MyEvent : MyEvent +>T : T +>EventTarget : EventTarget +>BaseEvent : BaseEvent + + target: T; +>target : T +>T : T +} +class BaseEventWrapper { +>BaseEventWrapper : BaseEventWrapper + + t: BaseEvent; +>t : BaseEvent +>BaseEvent : BaseEvent +} + +class MyEventWrapper extends BaseEventWrapper { +>MyEventWrapper : MyEventWrapper +>BaseEventWrapper : BaseEventWrapper + + t: MyEvent; // any satisfies constraint and passes assignability check between 'target' properties +>t : MyEvent +>MyEvent : MyEvent +} diff --git a/tests/baselines/reference/genericPrototypeProperty3.types b/tests/baselines/reference/genericPrototypeProperty3.types new file mode 100644 index 00000000000..381a5b88773 --- /dev/null +++ b/tests/baselines/reference/genericPrototypeProperty3.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/genericPrototypeProperty3.ts === +class BaseEvent { +>BaseEvent : BaseEvent + + target: {}; +>target : {} +} + +class MyEvent extends BaseEvent { // T is instantiated to any in the prototype, which is assignable to {} +>MyEvent : MyEvent +>T : T +>BaseEvent : BaseEvent + + target: T; +>target : T +>T : T +} +class BaseEventWrapper { +>BaseEventWrapper : BaseEventWrapper + + t: BaseEvent; +>t : BaseEvent +>BaseEvent : BaseEvent +} + +class MyEventWrapper extends BaseEventWrapper { +>MyEventWrapper : MyEventWrapper +>BaseEventWrapper : BaseEventWrapper + + t: MyEvent; +>t : MyEvent +>MyEvent : MyEvent +} diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.types b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.types new file mode 100644 index 00000000000..f327016f41d --- /dev/null +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.types @@ -0,0 +1,68 @@ +=== tests/cases/compiler/genericRecursiveImplicitConstructorErrors2.ts === +module TypeScript2 { +>TypeScript2 : typeof TypeScript2 + + export interface DeclKind { }; +>DeclKind : DeclKind + + export interface PullTypesymbol { }; +>PullTypesymbol : PullTypesymbol + + export interface SymbolLinkKind { }; +>SymbolLinkKind : SymbolLinkKind + + export enum PullSymbolVisibility { +>PullSymbolVisibility : PullSymbolVisibility + + Private, +>Private : PullSymbolVisibility + + Public +>Public : PullSymbolVisibility + } +  + export class PullSymbol { +>PullSymbol : PullSymbol + + constructor (name: string, declKind: DeclKind) { +>name : string +>declKind : DeclKind +>DeclKind : DeclKind + + } + // link methods + public addOutgoingLink(linkTo: PullSymbol, kind: SymbolLinkKind) { +>addOutgoingLink : (linkTo: PullSymbol, kind: SymbolLinkKind) => void +>A : A +>B : B +>C : C +>linkTo : PullSymbol +>PullSymbol : PullSymbol +>kind : SymbolLinkKind +>SymbolLinkKind : SymbolLinkKind + + } + + public getType(): PullTypeSymbol { +>getType : () => PullTypeSymbol +>A : A +>B : B +>C : C +>PullTypeSymbol : PullTypeSymbol +>A : A +>B : B +>C : C + + return undefined; +>undefined : undefined + } + } + export class PullTypeSymbol extends PullSymbol { +>PullTypeSymbol : PullTypeSymbol +>A : A +>B : B +>C : C +>PullSymbol : PullSymbol + } +} + diff --git a/tests/baselines/reference/genericReversingTypeParameters.types b/tests/baselines/reference/genericReversingTypeParameters.types new file mode 100644 index 00000000000..b133c07d80f --- /dev/null +++ b/tests/baselines/reference/genericReversingTypeParameters.types @@ -0,0 +1,51 @@ +=== tests/cases/compiler/genericReversingTypeParameters.ts === +class BiMap { +>BiMap : BiMap +>K : K +>V : V + + private inverseBiMap: BiMap; +>inverseBiMap : BiMap +>BiMap : BiMap +>V : V +>K : K + + public get(key: K): V { return null; } +>get : (key: K) => V +>key : K +>K : K +>V : V + + public inverse(): BiMap { return null; } +>inverse : () => BiMap +>BiMap : BiMap +>V : V +>K : K +} + +var b = new BiMap(); +>b : BiMap +>new BiMap() : BiMap +>BiMap : typeof BiMap + +var r1 = b.get(''); +>r1 : number +>b.get('') : number +>b.get : (key: string) => number +>b : BiMap +>get : (key: string) => number + +var i = b.inverse(); // used to get the type wrong here. +>i : BiMap +>b.inverse() : BiMap +>b.inverse : () => BiMap +>b : BiMap +>inverse : () => BiMap + +var r2b = i.get(1); +>r2b : string +>i.get(1) : string +>i.get : (key: number) => string +>i : BiMap +>get : (key: number) => string + diff --git a/tests/baselines/reference/genericReversingTypeParameters2.types b/tests/baselines/reference/genericReversingTypeParameters2.types new file mode 100644 index 00000000000..1a71cf138e2 --- /dev/null +++ b/tests/baselines/reference/genericReversingTypeParameters2.types @@ -0,0 +1,44 @@ +=== tests/cases/compiler/genericReversingTypeParameters2.ts === +class BiMap { +>BiMap : BiMap +>K : K +>V : V + + private inverseBiMap: BiMap; +>inverseBiMap : BiMap +>BiMap : BiMap +>V : V +>K : K + + public get(key: K): V { return null; } +>get : (key: K) => V +>key : K +>K : K +>V : V + + public inverse(): BiMap { return null; } +>inverse : () => BiMap +>BiMap : BiMap +>V : V +>K : K +} + +var b = new BiMap(); +>b : BiMap +>new BiMap() : BiMap +>BiMap : typeof BiMap + +var i = b.inverse(); // used to get the type wrong here. +>i : BiMap +>b.inverse() : BiMap +>b.inverse : () => BiMap +>b : BiMap +>inverse : () => BiMap + +var r2b = i.get(1); +>r2b : string +>i.get(1) : string +>i.get : (key: number) => string +>i : BiMap +>get : (key: number) => string + diff --git a/tests/baselines/reference/genericSignatureInheritance.types b/tests/baselines/reference/genericSignatureInheritance.types new file mode 100644 index 00000000000..0ae6be52ba1 --- /dev/null +++ b/tests/baselines/reference/genericSignatureInheritance.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/genericSignatureInheritance.ts === +interface I { +>I : I + + (x: T): string; +>T : T +>x : T +>T : T +} + +interface I2 extends I { } +>I2 : I2 +>I : I + diff --git a/tests/baselines/reference/genericSignatureInheritance2.types b/tests/baselines/reference/genericSignatureInheritance2.types new file mode 100644 index 00000000000..0b31483cdc5 --- /dev/null +++ b/tests/baselines/reference/genericSignatureInheritance2.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/genericSignatureInheritance2.ts === +interface I { +>I : I + + (x: T): string; +>T : T +>x : T +>T : T +} + +interface I2 extends I { +>I2 : I2 +>I : I + + (x: T): void; +>T : T +>x : T +>T : T +} + diff --git a/tests/baselines/reference/genericSpecializationToTypeLiteral1.types b/tests/baselines/reference/genericSpecializationToTypeLiteral1.types new file mode 100644 index 00000000000..536e1b7d4c0 --- /dev/null +++ b/tests/baselines/reference/genericSpecializationToTypeLiteral1.types @@ -0,0 +1,178 @@ +=== tests/cases/compiler/genericSpecializationToTypeLiteral1.ts === +interface IEnumerable { +>IEnumerable : IEnumerable +>T : T + + zip(second: IEnumerable, resultSelector: (first: T, second: T, index: number) => TResult): IEnumerable; +>zip : { (second: IEnumerable, resultSelector: (first: T, second: T, index: number) => TResult): IEnumerable; (second: T[], resultSelector: (first: T, second: T, index: number) => TResult): IEnumerable; (...params: any[]): IEnumerable; } +>TResult : TResult +>second : IEnumerable +>IEnumerable : IEnumerable +>T : T +>resultSelector : (first: T, second: T, index: number) => TResult +>first : T +>T : T +>second : T +>T : T +>index : number +>TResult : TResult +>IEnumerable : IEnumerable +>TResult : TResult + + zip(second: T[], resultSelector: (first: T, second: T, index: number) => TResult): IEnumerable; +>zip : { (second: IEnumerable, resultSelector: (first: T, second: T, index: number) => TResult): IEnumerable; (second: T[], resultSelector: (first: T, second: T, index: number) => TResult): IEnumerable; (...params: any[]): IEnumerable; } +>TResult : TResult +>second : T[] +>T : T +>resultSelector : (first: T, second: T, index: number) => TResult +>first : T +>T : T +>second : T +>T : T +>index : number +>TResult : TResult +>IEnumerable : IEnumerable +>TResult : TResult + + zip(...params: any[]): IEnumerable; // last one is selector +>zip : { (second: IEnumerable, resultSelector: (first: T, second: T, index: number) => TResult): IEnumerable; (second: T[], resultSelector: (first: T, second: T, index: number) => TResult): IEnumerable; (...params: any[]): IEnumerable; } +>TResult : TResult +>params : any[] +>IEnumerable : IEnumerable +>TResult : TResult + + merge(...params: IEnumerable[]): IEnumerable; +>merge : { (...params: IEnumerable[]): IEnumerable; (...params: T[][]): IEnumerable; } +>TResult : TResult +>params : IEnumerable[] +>IEnumerable : IEnumerable +>T : T +>IEnumerable : IEnumerable +>T : T + + merge(...params: T[][]): IEnumerable; +>merge : { (...params: IEnumerable[]): IEnumerable; (...params: T[][]): IEnumerable; } +>TResult : TResult +>params : T[][] +>T : T +>IEnumerable : IEnumerable +>T : T + + + concat(...sequences: IEnumerable[]): IEnumerable; +>concat : { (...sequences: IEnumerable[]): IEnumerable; (...sequences: T[]): IEnumerable; } +>sequences : IEnumerable[] +>IEnumerable : IEnumerable +>T : T +>IEnumerable : IEnumerable +>T : T + + concat(...sequences: T[]): IEnumerable; +>concat : { (...sequences: IEnumerable[]): IEnumerable; (...sequences: T[]): IEnumerable; } +>sequences : T[] +>T : T +>IEnumerable : IEnumerable +>T : T + + insert(index: number, second: IEnumerable): IEnumerable; +>insert : (index: number, second: IEnumerable) => IEnumerable +>index : number +>second : IEnumerable +>IEnumerable : IEnumerable +>T : T +>IEnumerable : IEnumerable +>T : T + + sequenceEqual(second: IEnumerable): boolean; +>sequenceEqual : { (second: IEnumerable): boolean; (second: IEnumerable, compareSelector: (element: T) => TCompare): boolean; (second: T[]): boolean; (second: T[], compareSelector: (element: T) => TCompare): boolean; } +>second : IEnumerable +>IEnumerable : IEnumerable +>T : T + + sequenceEqual(second: IEnumerable, compareSelector: (element: T) => TCompare): boolean; +>sequenceEqual : { (second: IEnumerable): boolean; (second: IEnumerable, compareSelector: (element: T) => TCompare): boolean; (second: T[]): boolean; (second: T[], compareSelector: (element: T) => TCompare): boolean; } +>TCompare : TCompare +>second : IEnumerable +>IEnumerable : IEnumerable +>T : T +>compareSelector : (element: T) => TCompare +>element : T +>T : T +>TCompare : TCompare + + sequenceEqual(second: T[]): boolean; +>sequenceEqual : { (second: IEnumerable): boolean; (second: IEnumerable, compareSelector: (element: T) => TCompare): boolean; (second: T[]): boolean; (second: T[], compareSelector: (element: T) => TCompare): boolean; } +>second : T[] +>T : T + + sequenceEqual(second: T[], compareSelector: (element: T) => TCompare): boolean; +>sequenceEqual : { (second: IEnumerable): boolean; (second: IEnumerable, compareSelector: (element: T) => TCompare): boolean; (second: T[]): boolean; (second: T[], compareSelector: (element: T) => TCompare): boolean; } +>TCompare : TCompare +>second : T[] +>T : T +>compareSelector : (element: T) => TCompare +>element : T +>T : T +>TCompare : TCompare + + toDictionary(keySelector: (element: T) => TKey): IDictionary; +>toDictionary : { (keySelector: (element: T) => TKey): IDictionary; (keySelector: (element: T) => TKey, elementSelector: (element: T) => TValue): IDictionary; (keySelector: (element: T) => TKey, elementSelector: (element: T) => TValue, compareSelector: (key: TKey) => TCompare): IDictionary; } +>TKey : TKey +>keySelector : (element: T) => TKey +>element : T +>T : T +>TKey : TKey +>IDictionary : IDictionary +>TKey : TKey + + toDictionary(keySelector: (element: T) => TKey, elementSelector: (element: T) => TValue): IDictionary; +>toDictionary : { (keySelector: (element: T) => TKey): IDictionary; (keySelector: (element: T) => TKey, elementSelector: (element: T) => TValue): IDictionary; (keySelector: (element: T) => TKey, elementSelector: (element: T) => TValue, compareSelector: (key: TKey) => TCompare): IDictionary; } +>TKey : TKey +>TValue : TValue +>keySelector : (element: T) => TKey +>element : T +>T : T +>TKey : TKey +>elementSelector : (element: T) => TValue +>element : T +>T : T +>TValue : TValue +>IDictionary : IDictionary +>TKey : TKey +>TValue : TValue + + toDictionary(keySelector: (element: T) => TKey, elementSelector: (element: T) => TValue, compareSelector: (key: TKey) => TCompare): IDictionary; +>toDictionary : { (keySelector: (element: T) => TKey): IDictionary; (keySelector: (element: T) => TKey, elementSelector: (element: T) => TValue): IDictionary; (keySelector: (element: T) => TKey, elementSelector: (element: T) => TValue, compareSelector: (key: TKey) => TCompare): IDictionary; } +>TKey : TKey +>TValue : TValue +>TCompare : TCompare +>keySelector : (element: T) => TKey +>element : T +>T : T +>TKey : TKey +>elementSelector : (element: T) => TValue +>element : T +>T : T +>TValue : TValue +>compareSelector : (key: TKey) => TCompare +>key : TKey +>TKey : TKey +>TCompare : TCompare +>IDictionary : IDictionary +>TKey : TKey +>TValue : TValue +} + +interface IDictionary { +>IDictionary : IDictionary +>TKey : TKey +>TValue : TValue + + toEnumerable(): IEnumerable<{ key: TKey; value: TValue }>; +>toEnumerable : () => IEnumerable<{ key: TKey; value: TValue; }> +>IEnumerable : IEnumerable +>key : TKey +>TKey : TKey +>value : TValue +>TValue : TValue +} diff --git a/tests/baselines/reference/genericSpecializations1.types b/tests/baselines/reference/genericSpecializations1.types new file mode 100644 index 00000000000..35ab3472854 --- /dev/null +++ b/tests/baselines/reference/genericSpecializations1.types @@ -0,0 +1,42 @@ +=== tests/cases/compiler/genericSpecializations1.ts === +interface IFoo { +>IFoo : IFoo +>T : T + + foo(x: T): T; // no error on implementors because IFoo's T is different from foo's T +>foo : (x: T) => T +>T : T +>x : T +>T : T +>T : T +} + +class IntFooBad implements IFoo { +>IntFooBad : IntFooBad +>IFoo : IFoo + + foo(x: string): string { return null; } +>foo : (x: string) => string +>x : string +} + +class StringFoo2 implements IFoo { +>StringFoo2 : StringFoo2 +>IFoo : IFoo + + foo(x: string): string { return null; } +>foo : (x: string) => string +>x : string +} + +class StringFoo3 implements IFoo { +>StringFoo3 : StringFoo3 +>IFoo : IFoo + + foo(x: T): T { return null; } +>foo : (x: T) => T +>T : T +>x : T +>T : T +>T : T +} diff --git a/tests/baselines/reference/genericStaticAnyTypeFunction.types b/tests/baselines/reference/genericStaticAnyTypeFunction.types new file mode 100644 index 00000000000..9cf511ca0d9 --- /dev/null +++ b/tests/baselines/reference/genericStaticAnyTypeFunction.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/genericStaticAnyTypeFunction.ts === +class A { +>A : A + + static one(source: T, value: number): T { +>one : (source: T, value: number) => T +>T : T +>source : T +>T : T +>value : number +>T : T + + return source; +>source : T + + } + static goo() { return 0; } +>goo : () => number + + static two(source: T): T { +>two : (source: T) => T +>T : T +>source : T +>T : T +>T : T + + return this.one(source, 42); // should not error +>this.one(source, 42) : T +>this.one : (source: T, value: number) => T +>this : typeof A +>one : (source: T, value: number) => T +>T : T +>source : T + + } + +} + + + diff --git a/tests/baselines/reference/genericTypeArgumentInference1.types b/tests/baselines/reference/genericTypeArgumentInference1.types new file mode 100644 index 00000000000..6cc4f22bd9e --- /dev/null +++ b/tests/baselines/reference/genericTypeArgumentInference1.types @@ -0,0 +1,88 @@ +=== tests/cases/compiler/genericTypeArgumentInference1.ts === +module Underscore { +>Underscore : Underscore + + export interface Iterator { +>Iterator : Iterator +>T : T +>U : U + + (value: T, index: any, list: any): U; +>value : T +>T : T +>index : any +>list : any +>U : U + } + export interface Static { +>Static : Static + + all(list: T[], iterator?: Iterator, context?: any): T; +>all : (list: T[], iterator?: Iterator, context?: any) => T +>T : T +>list : T[] +>T : T +>iterator : Iterator +>Iterator : Iterator +>T : T +>context : any +>T : T + + identity(value: T): T; +>identity : (value: T) => T +>T : T +>value : T +>T : T +>T : T + } +} +declare var _: Underscore.Static; +>_ : Static +>Underscore : Underscore +>Static : Static + +var r = _.all([true, 1, null, 'yes'], _.identity); +>r : {} +>_.all([true, 1, null, 'yes'], _.identity) : {} +>_.all : (list: T[], iterator?: Iterator, context?: any) => T +>_ : Static +>all : (list: T[], iterator?: Iterator, context?: any) => T +>[true, 1, null, 'yes'] : {}[] +>_.identity : (value: T) => T +>_ : Static +>identity : (value: T) => T + +var r2 = _.all([true], _.identity); +>r2 : boolean +>_.all([true], _.identity) : boolean +>_.all : (list: T[], iterator?: Iterator, context?: any) => T +>_ : Static +>all : (list: T[], iterator?: Iterator, context?: any) => T +>[true] : boolean[] +>_.identity : (value: T) => T +>_ : Static +>identity : (value: T) => T + +var r3 = _.all([], _.identity); +>r3 : any +>_.all([], _.identity) : any +>_.all : (list: T[], iterator?: Iterator, context?: any) => T +>_ : Static +>all : (list: T[], iterator?: Iterator, context?: any) => T +>[] : any[] +>_.identity : (value: T) => T +>_ : Static +>identity : (value: T) => T + +var r4 = _.all([true], _.identity); +>r4 : any +>_.all([true], _.identity) : any +>_.all : (list: T[], iterator?: Iterator, context?: any) => T +>_ : Static +>all : (list: T[], iterator?: Iterator, context?: any) => T +>[true] : any[] +>true : any +>_.identity : (value: T) => T +>_ : Static +>identity : (value: T) => T + diff --git a/tests/baselines/reference/genericTypeAssertions3.types b/tests/baselines/reference/genericTypeAssertions3.types new file mode 100644 index 00000000000..53435145939 --- /dev/null +++ b/tests/baselines/reference/genericTypeAssertions3.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/genericTypeAssertions3.ts === +var r = < (x: T) => T > ((x) => { return null; }); // bug was 'could not find dotted symbol T' on x's annotation in the type assertion instead of no error +>r : (x: T) => T +>< (x: T) => T > ((x) => { return null; }) : (x: T) => T +>T : T +>x : T +>T : T +>T : T +>((x) => { return null; }) : (x: any) => any +>(x) => { return null; } : (x: any) => any +>x : any + +var s = < (x: T) => T > ((x: any) => { return null; }); // no error +>s : (x: T) => T +>< (x: T) => T > ((x: any) => { return null; }) : (x: T) => T +>T : T +>x : T +>T : T +>T : T +>((x: any) => { return null; }) : (x: any) => any +>(x: any) => { return null; } : (x: any) => any +>x : any + diff --git a/tests/baselines/reference/genericTypeParameterEquivalence2.types b/tests/baselines/reference/genericTypeParameterEquivalence2.types new file mode 100644 index 00000000000..9c9c4e071bc --- /dev/null +++ b/tests/baselines/reference/genericTypeParameterEquivalence2.types @@ -0,0 +1,228 @@ +=== tests/cases/compiler/genericTypeParameterEquivalence2.ts === +// compose :: (b->c) -> (a->b) -> (a->c) +function compose(f: (b: B) => C, g: (a:A) => B): (a:A) => C { +>compose : (f: (b: B) => C, g: (a: A) => B) => (a: A) => C +>A : A +>B : B +>C : C +>f : (b: B) => C +>b : B +>B : B +>C : C +>g : (a: A) => B +>a : A +>A : A +>B : B +>a : A +>A : A +>C : C + + return function (a:A) : C { +>function (a:A) : C { + return f(g.apply(null, a)); + } : (a: A) => C +>a : A +>A : A +>C : C + + return f(g.apply(null, a)); +>f(g.apply(null, a)) : C +>f : (b: B) => C +>g.apply(null, a) : any +>g.apply : (thisArg: any, argArray?: any) => any +>g : (a: A) => B +>apply : (thisArg: any, argArray?: any) => any +>a : A + + }; +} + +// forEach :: [a] -> (a -> ()) -> () +function forEach(list: A[], f: (a: A, n?: number) => void ): void { +>forEach : (list: A[], f: (a: A, n?: number) => void) => void +>A : A +>list : A[] +>A : A +>f : (a: A, n?: number) => void +>a : A +>A : A +>n : number + + for (var i = 0; i < list.length; ++i) { +>i : number +>i < list.length : boolean +>i : number +>list.length : number +>list : A[] +>length : number +>++i : number +>i : number + + f(list[i], i); +>f(list[i], i) : void +>f : (a: A, n?: number) => void +>list[i] : A +>list : A[] +>i : number +>i : number + } +} + +// filter :: (a->bool) -> [a] -> [a] +function filter(f: (a: A) => boolean, ar: A[]): A[] { +>filter : (f: (a: A) => boolean, ar: A[]) => A[] +>A : A +>f : (a: A) => boolean +>a : A +>A : A +>ar : A[] +>A : A +>A : A + + var ret = []; +>ret : any[] +>[] : undefined[] + + forEach(ar, (el) => { +>forEach(ar, (el) => { + if (f(el)) { + ret.push(el); + } + } ) : void +>forEach : (list: A[], f: (a: A, n?: number) => void) => void +>ar : A[] +>(el) => { + if (f(el)) { + ret.push(el); + } + } : (el: A) => void +>el : A + + if (f(el)) { +>f(el) : boolean +>f : (a: A) => boolean +>el : A + + ret.push(el); +>ret.push(el) : number +>ret.push : (...items: any[]) => number +>ret : any[] +>push : (...items: any[]) => number +>el : A + } + } ); + + return ret; +>ret : any[] +} + +// length :: [a] -> Num +function length2(ar: A[]): number { +>length2 : (ar: A[]) => number +>A : A +>ar : A[] +>A : A + + return ar.length; +>ar.length : number +>ar : A[] +>length : number +} + +// curry1 :: ((a,b)->c) -> (a->(b->c)) +function curry1(f: (a: A, b: B) => C): (ax: A) => (bx: B) => C { +>curry1 : (f: (a: A, b: B) => C) => (ax: A) => (bx: B) => C +>A : A +>B : B +>C : C +>f : (a: A, b: B) => C +>a : A +>A : A +>b : B +>B : B +>C : C +>ax : A +>A : A +>bx : B +>B : B +>C : C + + return function (ay: A) { +>function (ay: A) { + return function (by: B) { + return f(ay, by); + }; + } : (ay: A) => (by: B) => C +>ay : A +>A : A + + return function (by: B) { +>function (by: B) { + return f(ay, by); + } : (by: B) => C +>by : B +>B : B + + return f(ay, by); +>f(ay, by) : C +>f : (a: A, b: B) => C +>ay : A +>by : B + + }; + }; +} + +var cfilter = curry1(filter); +>cfilter : (ax: {}) => (bx: {}) => {}[] +>curry1(filter) : (ax: {}) => (bx: {}) => {}[] +>curry1 : (f: (a: A, b: B) => C) => (ax: A) => (bx: B) => C +>filter : (f: (a: A) => boolean, ar: A[]) => A[] + +// compose :: (b->c) -> (a->b) -> (a->c) +// length :: [a] -> Num +// cfilter :: {} -> {} -> [{}] +// pred :: a -> Bool +// cfilter(pred) :: {} -> [{}] +// length2 :: [a] -> Num +// countWhere :: (a -> Bool) -> [a] -> Num + +function countWhere_1(pred: (a: A) => boolean): (a: A[]) => number { +>countWhere_1 : (pred: (a: A) => boolean) => (a: A[]) => number +>A : A +>pred : (a: A) => boolean +>a : A +>A : A +>a : A[] +>A : A + + return compose(length2, cfilter(pred)); +>compose(length2, cfilter(pred)) : (a: {}) => number +>compose : (f: (b: B) => C, g: (a: A) => B) => (a: A) => C +>length2 : (ar: A[]) => number +>cfilter(pred) : (bx: {}) => {}[] +>cfilter : (ax: {}) => (bx: {}) => {}[] +>pred : (a: A) => boolean +} + +function countWhere_2(pred: (a: A) => boolean): (a: A[]) => number { +>countWhere_2 : (pred: (a: A) => boolean) => (a: A[]) => number +>A : A +>pred : (a: A) => boolean +>a : A +>A : A +>a : A[] +>A : A + + var where = cfilter(pred); +>where : (bx: {}) => {}[] +>cfilter(pred) : (bx: {}) => {}[] +>cfilter : (ax: {}) => (bx: {}) => {}[] +>pred : (a: A) => boolean + + return compose(length2, where); +>compose(length2, where) : (a: {}) => number +>compose : (f: (b: B) => C, g: (a: A) => B) => (a: A) => C +>length2 : (ar: A[]) => number +>where : (bx: {}) => {}[] +} diff --git a/tests/baselines/reference/genericTypeWithCallableMembers.types b/tests/baselines/reference/genericTypeWithCallableMembers.types new file mode 100644 index 00000000000..e0068d5ff2b --- /dev/null +++ b/tests/baselines/reference/genericTypeWithCallableMembers.types @@ -0,0 +1,38 @@ +=== tests/cases/compiler/genericTypeWithCallableMembers.ts === +interface Constructable { +>Constructable : Constructable + + new (): Constructable; +>Constructable : Constructable +} + +class C { +>C : C +>T : T +>Constructable : Constructable + + constructor(public data: T, public data2: Constructable) { } +>data : T +>T : T +>data2 : Constructable +>Constructable : Constructable + + create() { +>create : () => void + + var x = new this.data(); // no error +>x : Constructable +>new this.data() : Constructable +>this.data : T +>this : C +>data : T + + var x2 = new this.data2(); // was error, shouldn't be +>x2 : Constructable +>new this.data2() : Constructable +>this.data2 : Constructable +>this : C +>data2 : Constructable + } +} + diff --git a/tests/baselines/reference/genericTypeWithCallableMembers2.types b/tests/baselines/reference/genericTypeWithCallableMembers2.types new file mode 100644 index 00000000000..5c265e30a85 --- /dev/null +++ b/tests/baselines/reference/genericTypeWithCallableMembers2.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/genericTypeWithCallableMembers2.ts === +function foo1(f: T) { +>foo1 : string>(f: T) => string +>T : T +>f : T +>T : T + + return f(); // should return 'string', once returned 'any' +>f() : string +>f : T +} + +function foo2(f: T) { +>foo2 : string>(f: T) => string +>T : T +>f : T +>T : T + + return new f(); // should be legal, once was an error +>new f() : string +>f : T +} diff --git a/tests/baselines/reference/genericTypeWithMultipleBases1.types b/tests/baselines/reference/genericTypeWithMultipleBases1.types new file mode 100644 index 00000000000..44e8ad8a295 --- /dev/null +++ b/tests/baselines/reference/genericTypeWithMultipleBases1.types @@ -0,0 +1,49 @@ +=== tests/cases/compiler/genericTypeWithMultipleBases1.ts === +export interface I1 { +>I1 : I1 + + m1: () => void; +>m1 : () => void +} + +export interface I2 { +>I2 : I2 + + m2: () => void; +>m2 : () => void +} + +export interface I3 extends I1, I2 { +>I3 : I3 +>T : T +>I1 : I1 +>I2 : I2 + +//export interface I3 extends I2, I1 { + p1: T; +>p1 : T +>T : T +} + +var x: I3; +>x : I3 +>I3 : I3 + +x.p1; +>x.p1 : number +>x : I3 +>p1 : number + +x.m1(); +>x.m1() : void +>x.m1 : () => void +>x : I3 +>m1 : () => void + +x.m2(); +>x.m2() : void +>x.m2 : () => void +>x : I3 +>m2 : () => void + + diff --git a/tests/baselines/reference/genericTypeWithMultipleBases2.types b/tests/baselines/reference/genericTypeWithMultipleBases2.types new file mode 100644 index 00000000000..292dcc55d99 --- /dev/null +++ b/tests/baselines/reference/genericTypeWithMultipleBases2.types @@ -0,0 +1,48 @@ +=== tests/cases/compiler/genericTypeWithMultipleBases2.ts === +export interface I1 { +>I1 : I1 + + m1: () => void; +>m1 : () => void +} + +export interface I2 { +>I2 : I2 + + m2: () => void; +>m2 : () => void +} + +export interface I3 extends I2, I1 { +>I3 : I3 +>T : T +>I2 : I2 +>I1 : I1 + + p1: T; +>p1 : T +>T : T +} + +var x: I3; +>x : I3 +>I3 : I3 + +x.p1; +>x.p1 : number +>x : I3 +>p1 : number + +x.m1(); +>x.m1() : void +>x.m1 : () => void +>x : I3 +>m1 : () => void + +x.m2(); +>x.m2() : void +>x.m2 : () => void +>x : I3 +>m2 : () => void + + diff --git a/tests/baselines/reference/genericTypeWithMultipleBases3.types b/tests/baselines/reference/genericTypeWithMultipleBases3.types new file mode 100644 index 00000000000..6ece5a87be0 --- /dev/null +++ b/tests/baselines/reference/genericTypeWithMultipleBases3.types @@ -0,0 +1,49 @@ +=== tests/cases/compiler/genericTypeWithMultipleBases3.ts === +interface IA { +>IA : IA +>T : T + +foo(x: T): T; +>foo : (x: T) => T +>x : T +>T : T +>T : T + +} + +interface IB { +>IB : IB +>T : T + +bar(x: T): T; +>bar : (x: T) => T +>x : T +>T : T +>T : T + +} + +interface IC extends IA, IB { } +>IC : IC +>T : T +>IA : IA +>T : T +>IB : IB +>T : T + +var c: IC; +>c : IC +>IC : IC + +var x = c.foo; +>x : (x: number) => number +>c.foo : (x: number) => number +>c : IC +>foo : (x: number) => number + +var y = c.bar; +>y : (x: number) => number +>c.bar : (x: number) => number +>c : IC +>bar : (x: number) => number + diff --git a/tests/baselines/reference/genericWithCallSignatureReturningSpecialization.types b/tests/baselines/reference/genericWithCallSignatureReturningSpecialization.types new file mode 100644 index 00000000000..3b16eda23e7 --- /dev/null +++ b/tests/baselines/reference/genericWithCallSignatureReturningSpecialization.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/genericWithCallSignatureReturningSpecialization.ts === +interface B { +>B : B +>T : T + + f(): B; +>f : () => B +>B : B + + (value: T): void; +>value : T +>T : T +} +var x: B; +>x : B +>B : B + +x(true); // was error +>x(true) : void +>x : B + diff --git a/tests/baselines/reference/genericWithCallSignatures1.types b/tests/baselines/reference/genericWithCallSignatures1.types new file mode 100644 index 00000000000..c88b2f1c1b1 --- /dev/null +++ b/tests/baselines/reference/genericWithCallSignatures1.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/genericWithCallSignatures_1.ts === +/// +class MyClass { +>MyClass : MyClass + + public callableThing: CallableExtention; +>callableThing : CallableExtention +>CallableExtention : CallableExtention + + public myMethod() { +>myMethod : () => void + + var x = this.callableThing(); +>x : string +> this.callableThing() : string +>this.callableThing() : string +>this.callableThing : CallableExtention +>this : MyClass +>callableThing : CallableExtention + } +} +=== tests/cases/compiler/genericWithCallSignatures_0.ts === +interface Callable { +>Callable : Callable +>T : T + + (): T; +>T : T + + (value: T): void; +>value : T +>T : T +} + +interface CallableExtention extends Callable { } +>CallableExtention : CallableExtention +>T : T +>Callable : Callable +>T : T + diff --git a/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types b/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types new file mode 100644 index 00000000000..05697f1e1f9 --- /dev/null +++ b/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/genericWithIndexerOfTypeParameterType1.ts === +class LazyArray { +>LazyArray : LazyArray +>T : T + + private objects = <{ [objectId: string]: T; }>{}; +>objects : { [x: string]: T; } +><{ [objectId: string]: T; }>{} : { [x: string]: T; } +>objectId : string +>T : T +>{} : { [x: string]: T; } + + array() { +>array : () => { [x: string]: T; } + + return this.objects; +>this.objects : { [x: string]: T; } +>this : LazyArray +>objects : { [x: string]: T; } + } +} +var lazyArray = new LazyArray(); +>lazyArray : LazyArray +>new LazyArray() : LazyArray +>LazyArray : typeof LazyArray + +var value: string = lazyArray.array()["test"]; // used to be an error +>value : string +>lazyArray.array()["test"] : string +>lazyArray.array() : { [x: string]: string; } +>lazyArray.array : () => { [x: string]: string; } +>lazyArray : LazyArray +>array : () => { [x: string]: string; } + diff --git a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.types b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.types new file mode 100644 index 00000000000..1c4616211e7 --- /dev/null +++ b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/genericWithIndexerOfTypeParameterType2.ts === +export class Collection { +>Collection : Collection +>TItem : TItem +>CollectionItem : CollectionItem + + _itemsByKey: { [key: string]: TItem; }; +>_itemsByKey : { [x: string]: TItem; } +>key : string +>TItem : TItem +} + +export class List extends Collection{ +>List : List +>Collection : Collection +>ListItem : ListItem + + Bar() {} +>Bar : () => void +} + +export class CollectionItem {} +>CollectionItem : CollectionItem + +export class ListItem extends CollectionItem { +>ListItem : ListItem +>CollectionItem : CollectionItem + + __isNew: boolean; +>__isNew : boolean +} + diff --git a/tests/baselines/reference/generics0.types b/tests/baselines/reference/generics0.types new file mode 100644 index 00000000000..1c7aa3d54b4 --- /dev/null +++ b/tests/baselines/reference/generics0.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/generics0.ts === +interface G { +>G : G +>T : T + + x: T; +>x : T +>T : T +} + +var v2: G; +>v2 : G +>G : G + +var z = v2.x; // 'y' should be of type 'string' +>z : string +>v2.x : string +>v2 : G +>x : string + diff --git a/tests/baselines/reference/generics1NoError.types b/tests/baselines/reference/generics1NoError.types new file mode 100644 index 00000000000..54a38bed8a5 --- /dev/null +++ b/tests/baselines/reference/generics1NoError.types @@ -0,0 +1,49 @@ +=== tests/cases/compiler/generics1NoError.ts === +interface A { a: string; } +>A : A +>a : string + +interface B extends A { b: string; } +>B : B +>A : A +>b : string + +interface C extends B { c: string; } +>C : C +>B : B +>c : string + +interface G { +>G : G +>T : T +>U : U +>B : B + + x: T; +>x : T +>T : T + + y: U; +>y : U +>U : U +} +var v1: G; // Ok +>v1 : G +>G : G +>A : A +>C : C + +var v2: G<{ a: string }, C>; // Ok, equivalent to G +>v2 : G<{ a: string; }, C> +>G : G +>a : string +>C : C + +var v4: G, C>; // Ok +>v4 : G, C> +>G : G +>G : G +>A : A +>B : B +>C : C + diff --git a/tests/baselines/reference/generics2NoError.types b/tests/baselines/reference/generics2NoError.types new file mode 100644 index 00000000000..059419629f5 --- /dev/null +++ b/tests/baselines/reference/generics2NoError.types @@ -0,0 +1,61 @@ +=== tests/cases/compiler/generics2NoError.ts === +interface A { a: string; } +>A : A +>a : string + +interface B extends A { b: string; } +>B : B +>A : A +>b : string + +interface C extends B { c: string; } +>C : C +>B : B +>c : string + +interface G { +>G : G +>T : T +>U : U +>B : B + + x: T; +>x : T +>T : T + + y: U; +>y : U +>U : U +} + + +var v1: { +>v1 : { x: { a: string; }; y: { a: string; b: string; c: string; }; } + + x: { a: string; } +>x : { a: string; } +>a : string + + y: { a: string; b: string; c: string }; +>y : { a: string; b: string; c: string; } +>a : string +>b : string +>c : string + +}; // Ok + + +var v2: G<{ a: string }, C>; // Ok, equivalent to G +>v2 : G<{ a: string; }, C> +>G : G +>a : string +>C : C + +var v4: G, C>; // Ok +>v4 : G, C> +>G : G +>G : G +>A : A +>B : B +>C : C + diff --git a/tests/baselines/reference/generics3.types b/tests/baselines/reference/generics3.types new file mode 100644 index 00000000000..11477fedd85 --- /dev/null +++ b/tests/baselines/reference/generics3.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/generics3.ts === +class C { private x: T; } +>C : C +>T : T +>x : T +>T : T + +interface X { f(): string; } +>X : X +>f : () => string + +interface Y { f(): string; } +>Y : Y +>f : () => string + +var a: C; +>a : C +>C : C +>X : X + +var b: C; +>b : C +>C : C +>Y : Y + +a = b; // Ok - should be identical +>a = b : C +>a : C +>b : C + diff --git a/tests/baselines/reference/generics4NoError.types b/tests/baselines/reference/generics4NoError.types new file mode 100644 index 00000000000..2dd37a5d447 --- /dev/null +++ b/tests/baselines/reference/generics4NoError.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/generics4NoError.ts === +class C { private x: T; } +>C : C +>T : T +>x : T +>T : T + +interface X { f(): string; } +>X : X +>f : () => string + +interface Y { f(): boolean; } +>Y : Y +>f : () => boolean + +var a: C; +>a : C +>C : C +>X : X + +var b: C; +>b : C +>C : C +>Y : Y + diff --git a/tests/baselines/reference/genericsAndHigherOrderFunctions.types b/tests/baselines/reference/genericsAndHigherOrderFunctions.types new file mode 100644 index 00000000000..6f9ffe4217e --- /dev/null +++ b/tests/baselines/reference/genericsAndHigherOrderFunctions.types @@ -0,0 +1,131 @@ +=== tests/cases/compiler/genericsAndHigherOrderFunctions.ts === +// no errors expected + +var combine: (f: (_: T) => S) => +>combine : (f: (_: T) => S) => (g: (_: U) => T) => (x: U) => S +>T : T +>S : S +>f : (_: T) => S +>_ : T +>T : T +>S : S + + (g: (_: U) => T) => +>U : U +>g : (_: U) => T +>_ : U +>U : U +>T : T + + (x: U) => S +>x : U +>U : U +>S : S + + = (f: (_: T) => S) => +>(f: (_: T) => S) => + (g: (_: U) => T) => + (x: U) => f(g(x)) : (f: (_: T) => S) => (g: (_: U) => T) => (x: U) => S +>T : T +>S : S +>f : (_: T) => S +>_ : T +>T : T +>S : S + + (g: (_: U) => T) => +>(g: (_: U) => T) => + (x: U) => f(g(x)) : (g: (_: U) => T) => (x: U) => S +>U : U +>g : (_: U) => T +>_ : U +>U : U +>T : T + + (x: U) => f(g(x)) +>(x: U) => f(g(x)) : (x: U) => S +>x : U +>U : U +>f(g(x)) : S +>f : (_: T) => S +>g(x) : T +>g : (_: U) => T +>x : U + +var foo: (g: (x: K) => N) => +>foo : (g: (x: K) => N) => (h: (_: (_: K) => (_: M) => M) => (_: M) => M) => (f: (_: N) => (_: R) => R) => (_: R) => R +>K : K +>N : N +>g : (x: K) => N +>x : K +>K : K +>N : N + + (h: (_: (_: K) => (_: M) => M) => (_: M) => M) => +>h : (_: (_: K) => (_: M) => M) => (_: M) => M +>M : M +>_ : (_: K) => (_: M) => M +>_ : K +>K : K +>_ : M +>M : M +>M : M +>_ : M +>M : M +>M : M + + (f: (_: N) => (_: R) => R) => (_: R) => R +>R : R +>f : (_: N) => (_: R) => R +>_ : N +>N : N +>_ : R +>R : R +>R : R +>_ : R +>R : R +>R : R + + = (g: (x: K) => N) => +>(g: (x: K) => N) => + (h: (_: (_: K) => (_: M) => M) => (_: M) => M) => + (f: (_: N) => (_: R) => R) => h(combine(f)(g)) : (g: (x: K) => N) => (h: (_: (_: K) => (_: M) => M) => (_: M) => M) => (f: (_: N) => (_: R) => R) => (_: R) => R +>K : K +>N : N +>g : (x: K) => N +>x : K +>K : K +>N : N + + (h: (_: (_: K) => (_: M) => M) => (_: M) => M) => +>(h: (_: (_: K) => (_: M) => M) => (_: M) => M) => + (f: (_: N) => (_: R) => R) => h(combine(f)(g)) : (h: (_: (_: K) => (_: M) => M) => (_: M) => M) => (f: (_: N) => (_: R) => R) => (_: R) => R +>h : (_: (_: K) => (_: M) => M) => (_: M) => M +>M : M +>_ : (_: K) => (_: M) => M +>_ : K +>K : K +>_ : M +>M : M +>M : M +>_ : M +>M : M +>M : M + + (f: (_: N) => (_: R) => R) => h(combine(f)(g)) +>(f: (_: N) => (_: R) => R) => h(combine(f)(g)) : (f: (_: N) => (_: R) => R) => (_: R) => R +>R : R +>f : (_: N) => (_: R) => R +>_ : N +>N : N +>_ : R +>R : R +>R : R +>h(combine(f)(g)) : (_: R) => R +>h : (_: (_: K) => (_: M) => M) => (_: M) => M +>combine(f)(g) : (x: K) => (_: R) => R +>combine(f) : (g: (_: U) => N) => (x: U) => (_: R) => R +>combine : (f: (_: T) => S) => (g: (_: U) => T) => (x: U) => S +>f : (_: N) => (_: R) => R +>g : (x: K) => N + diff --git a/tests/baselines/reference/genericsManyTypeParameters.types b/tests/baselines/reference/genericsManyTypeParameters.types new file mode 100644 index 00000000000..0094f320051 --- /dev/null +++ b/tests/baselines/reference/genericsManyTypeParameters.types @@ -0,0 +1,565 @@ +=== tests/cases/compiler/genericsManyTypeParameters.ts === +function Foo< +>Foo : (x1: a1, y1: a21, z1: a31, a1: a41, b1: a51, c1: a61, x2: a119, y2: a22, z2: a32, a2: a42, b2: a52, c2: a62, x3: a219, y3: a23, z3: a33, a3: a43, b3: a53, c3: a63, x4: a319, y4: a24, z4: a34, a4: a44, b4: a54, c4: a64, x5: a419, y5: a25, z5: a35, a5: a45, b5: a55, c5: a65, x6: a519, y6: a26, z6: a36, a6: a46, b6: a56, c6: a66, x7: a619, y7: a27, z7: a37, a7: a47, b7: a57, c7: a67, x8: a71, y8: a28, z8: a38, a8: a48, b8: a58, c8: a68, x9: a81, y9: a29, z9: a39, a9: a49, b9: a59, c9: a69, x10: a91, y12: a210, z10: a310, a10: a410, b10: a510, c10: a610, x11: a111, y13: a211, z11: a311, a11: a411, b11: a511, c11: a611, x12: a112, y14: a212, z12: a312, a12: a412, b12: a512, c12: a612, x13: a113, y15: a213, z13: a313, a13: a413, b13: a513, c13: a613, x14: a114, y16: a214, z14: a314, a14: a414, b14: a514, c14: a614, x15: a115, y17: a215, z15: a315, a15: a415, b15: a515, c15: a615, x16: a116, y18: a216, z16: a316, a16: a416, b16: a516, c16: a616, x17: a117, y19: a217, z17: a317, a17: a417, b17: a517, c17: a617, x18: a118, y10: a218, z18: a318, a18: a418, b18: a518, c18: a618) => {}[] + + a1, a21, a31, a41, a51, a61, +>a1 : a1 +>a21 : a21 +>a31 : a31 +>a41 : a41 +>a51 : a51 +>a61 : a61 + + a119, a22, a32, a42, a52, a62, +>a119 : a119 +>a22 : a22 +>a32 : a32 +>a42 : a42 +>a52 : a52 +>a62 : a62 + + a219, a23, a33, a43, a53, a63, +>a219 : a219 +>a23 : a23 +>a33 : a33 +>a43 : a43 +>a53 : a53 +>a63 : a63 + + a319, a24, a34, a44, a54, a64, +>a319 : a319 +>a24 : a24 +>a34 : a34 +>a44 : a44 +>a54 : a54 +>a64 : a64 + + a419, a25, a35, a45, a55, a65, +>a419 : a419 +>a25 : a25 +>a35 : a35 +>a45 : a45 +>a55 : a55 +>a65 : a65 + + a519, a26, a36, a46, a56, a66, +>a519 : a519 +>a26 : a26 +>a36 : a36 +>a46 : a46 +>a56 : a56 +>a66 : a66 + + a619, a27, a37, a47, a57, a67, +>a619 : a619 +>a27 : a27 +>a37 : a37 +>a47 : a47 +>a57 : a57 +>a67 : a67 + + a71, a28, a38, a48, a58, a68, +>a71 : a71 +>a28 : a28 +>a38 : a38 +>a48 : a48 +>a58 : a58 +>a68 : a68 + + a81, a29, a39, a49, a59, a69, +>a81 : a81 +>a29 : a29 +>a39 : a39 +>a49 : a49 +>a59 : a59 +>a69 : a69 + + a91, a210, a310, a410, a510, a610, +>a91 : a91 +>a210 : a210 +>a310 : a310 +>a410 : a410 +>a510 : a510 +>a610 : a610 + + a111, a211, a311, a411, a511, a611, +>a111 : a111 +>a211 : a211 +>a311 : a311 +>a411 : a411 +>a511 : a511 +>a611 : a611 + + a112, a212, a312, a412, a512, a612, +>a112 : a112 +>a212 : a212 +>a312 : a312 +>a412 : a412 +>a512 : a512 +>a612 : a612 + + a113, a213, a313, a413, a513, a613, +>a113 : a113 +>a213 : a213 +>a313 : a313 +>a413 : a413 +>a513 : a513 +>a613 : a613 + + a114, a214, a314, a414, a514, a614, +>a114 : a114 +>a214 : a214 +>a314 : a314 +>a414 : a414 +>a514 : a514 +>a614 : a614 + + a115, a215, a315, a415, a515, a615, +>a115 : a115 +>a215 : a215 +>a315 : a315 +>a415 : a415 +>a515 : a515 +>a615 : a615 + + a116, a216, a316, a416, a516, a616, +>a116 : a116 +>a216 : a216 +>a316 : a316 +>a416 : a416 +>a516 : a516 +>a616 : a616 + + a117, a217, a317, a417, a517, a617, +>a117 : a117 +>a217 : a217 +>a317 : a317 +>a417 : a417 +>a517 : a517 +>a617 : a617 + + a118, a218, a318, a418, a518, a618> +>a118 : a118 +>a218 : a218 +>a318 : a318 +>a418 : a418 +>a518 : a518 +>a618 : a618 + + ( + x1: a1, y1: a21, z1: a31, a1: a41, b1: a51, c1: a61, +>x1 : a1 +>a1 : a1 +>y1 : a21 +>a21 : a21 +>z1 : a31 +>a31 : a31 +>a1 : a41 +>a41 : a41 +>b1 : a51 +>a51 : a51 +>c1 : a61 +>a61 : a61 + + x2: a119, y2: a22, z2: a32, a2: a42, b2: a52, c2: a62, +>x2 : a119 +>a119 : a119 +>y2 : a22 +>a22 : a22 +>z2 : a32 +>a32 : a32 +>a2 : a42 +>a42 : a42 +>b2 : a52 +>a52 : a52 +>c2 : a62 +>a62 : a62 + + x3: a219, y3: a23, z3: a33, a3: a43, b3: a53, c3: a63, +>x3 : a219 +>a219 : a219 +>y3 : a23 +>a23 : a23 +>z3 : a33 +>a33 : a33 +>a3 : a43 +>a43 : a43 +>b3 : a53 +>a53 : a53 +>c3 : a63 +>a63 : a63 + + x4: a319, y4: a24, z4: a34, a4: a44, b4: a54, c4: a64, +>x4 : a319 +>a319 : a319 +>y4 : a24 +>a24 : a24 +>z4 : a34 +>a34 : a34 +>a4 : a44 +>a44 : a44 +>b4 : a54 +>a54 : a54 +>c4 : a64 +>a64 : a64 + + x5: a419, y5: a25, z5: a35, a5: a45, b5: a55, c5: a65, +>x5 : a419 +>a419 : a419 +>y5 : a25 +>a25 : a25 +>z5 : a35 +>a35 : a35 +>a5 : a45 +>a45 : a45 +>b5 : a55 +>a55 : a55 +>c5 : a65 +>a65 : a65 + + x6: a519, y6: a26, z6: a36, a6: a46, b6: a56, c6: a66, +>x6 : a519 +>a519 : a519 +>y6 : a26 +>a26 : a26 +>z6 : a36 +>a36 : a36 +>a6 : a46 +>a46 : a46 +>b6 : a56 +>a56 : a56 +>c6 : a66 +>a66 : a66 + + x7: a619, y7: a27, z7: a37, a7: a47, b7: a57, c7: a67, +>x7 : a619 +>a619 : a619 +>y7 : a27 +>a27 : a27 +>z7 : a37 +>a37 : a37 +>a7 : a47 +>a47 : a47 +>b7 : a57 +>a57 : a57 +>c7 : a67 +>a67 : a67 + + x8: a71, y8: a28, z8: a38, a8: a48, b8: a58, c8: a68, +>x8 : a71 +>a71 : a71 +>y8 : a28 +>a28 : a28 +>z8 : a38 +>a38 : a38 +>a8 : a48 +>a48 : a48 +>b8 : a58 +>a58 : a58 +>c8 : a68 +>a68 : a68 + + x9: a81, y9: a29, z9: a39, a9: a49, b9: a59, c9: a69, +>x9 : a81 +>a81 : a81 +>y9 : a29 +>a29 : a29 +>z9 : a39 +>a39 : a39 +>a9 : a49 +>a49 : a49 +>b9 : a59 +>a59 : a59 +>c9 : a69 +>a69 : a69 + + x10: a91, y12: a210, z10: a310, a10: a410, b10: a510, c10: a610, +>x10 : a91 +>a91 : a91 +>y12 : a210 +>a210 : a210 +>z10 : a310 +>a310 : a310 +>a10 : a410 +>a410 : a410 +>b10 : a510 +>a510 : a510 +>c10 : a610 +>a610 : a610 + + x11: a111, y13: a211, z11: a311, a11: a411, b11: a511, c11: a611, +>x11 : a111 +>a111 : a111 +>y13 : a211 +>a211 : a211 +>z11 : a311 +>a311 : a311 +>a11 : a411 +>a411 : a411 +>b11 : a511 +>a511 : a511 +>c11 : a611 +>a611 : a611 + + x12: a112, y14: a212, z12: a312, a12: a412, b12: a512, c12: a612, +>x12 : a112 +>a112 : a112 +>y14 : a212 +>a212 : a212 +>z12 : a312 +>a312 : a312 +>a12 : a412 +>a412 : a412 +>b12 : a512 +>a512 : a512 +>c12 : a612 +>a612 : a612 + + x13: a113, y15: a213, z13: a313, a13: a413, b13: a513, c13: a613, +>x13 : a113 +>a113 : a113 +>y15 : a213 +>a213 : a213 +>z13 : a313 +>a313 : a313 +>a13 : a413 +>a413 : a413 +>b13 : a513 +>a513 : a513 +>c13 : a613 +>a613 : a613 + + x14: a114, y16: a214, z14: a314, a14: a414, b14: a514, c14: a614, +>x14 : a114 +>a114 : a114 +>y16 : a214 +>a214 : a214 +>z14 : a314 +>a314 : a314 +>a14 : a414 +>a414 : a414 +>b14 : a514 +>a514 : a514 +>c14 : a614 +>a614 : a614 + + x15: a115, y17: a215, z15: a315, a15: a415, b15: a515, c15: a615, +>x15 : a115 +>a115 : a115 +>y17 : a215 +>a215 : a215 +>z15 : a315 +>a315 : a315 +>a15 : a415 +>a415 : a415 +>b15 : a515 +>a515 : a515 +>c15 : a615 +>a615 : a615 + + x16: a116, y18: a216, z16: a316, a16: a416, b16: a516, c16: a616, +>x16 : a116 +>a116 : a116 +>y18 : a216 +>a216 : a216 +>z16 : a316 +>a316 : a316 +>a16 : a416 +>a416 : a416 +>b16 : a516 +>a516 : a516 +>c16 : a616 +>a616 : a616 + + x17: a117, y19: a217, z17: a317, a17: a417, b17: a517, c17: a617, +>x17 : a117 +>a117 : a117 +>y19 : a217 +>a217 : a217 +>z17 : a317 +>a317 : a317 +>a17 : a417 +>a417 : a417 +>b17 : a517 +>a517 : a517 +>c17 : a617 +>a617 : a617 + + x18: a118, y10: a218, z18: a318, a18: a418, b18: a518, c18: a618 +>x18 : a118 +>a118 : a118 +>y10 : a218 +>a218 : a218 +>z18 : a318 +>a318 : a318 +>a18 : a418 +>a418 : a418 +>b18 : a518 +>a518 : a518 +>c18 : a618 +>a618 : a618 + + ) + { + return [x1 , y1 , z1 , a1 , b1 , c1, +>[x1 , y1 , z1 , a1 , b1 , c1, + x2 , y2 , z2 , a2 , b2 , c2, + x3 , y3 , z3 , a3 , b3 , c3, + x4 , y4 , z4 , a4 , b4 , c4, + x5 , y5 , z5 , a5 , b5 , c5, + x6 , y6 , z6 , a6 , b6 , c6, + x7 , y7 , z7 , a7 , b7 , c7, + x8 , y8 , z8 , a8 , b8 , c8, + x9 , y9 , z9 , a9 , b9 , c9, + x10 , y12 , z10 , a10 , b10 , c10, + x11 , y13 , z11 , a11 , b11 , c11, + x12 , y14 , z12 , a12 , b12 , c12, + x13 , y15 , z13 , a13 , b13 , c13, + x14 , y16 , z14 , a14 , b14 , c14, + x15 , y17 , z15 , a15 , b15 , c15, + x16 , y18 , z16 , a16 , b16 , c16, + x17 , y19 , z17 , a17 , b17 , c17, + x18 , y10 , z18 , a18 , b18 , c18] : {}[] +>x1 : a1 +>y1 : a21 +>z1 : a31 +>a1 : a41 +>b1 : a51 +>c1 : a61 + + x2 , y2 , z2 , a2 , b2 , c2, +>x2 : a119 +>y2 : a22 +>z2 : a32 +>a2 : a42 +>b2 : a52 +>c2 : a62 + + x3 , y3 , z3 , a3 , b3 , c3, +>x3 : a219 +>y3 : a23 +>z3 : a33 +>a3 : a43 +>b3 : a53 +>c3 : a63 + + x4 , y4 , z4 , a4 , b4 , c4, +>x4 : a319 +>y4 : a24 +>z4 : a34 +>a4 : a44 +>b4 : a54 +>c4 : a64 + + x5 , y5 , z5 , a5 , b5 , c5, +>x5 : a419 +>y5 : a25 +>z5 : a35 +>a5 : a45 +>b5 : a55 +>c5 : a65 + + x6 , y6 , z6 , a6 , b6 , c6, +>x6 : a519 +>y6 : a26 +>z6 : a36 +>a6 : a46 +>b6 : a56 +>c6 : a66 + + x7 , y7 , z7 , a7 , b7 , c7, +>x7 : a619 +>y7 : a27 +>z7 : a37 +>a7 : a47 +>b7 : a57 +>c7 : a67 + + x8 , y8 , z8 , a8 , b8 , c8, +>x8 : a71 +>y8 : a28 +>z8 : a38 +>a8 : a48 +>b8 : a58 +>c8 : a68 + + x9 , y9 , z9 , a9 , b9 , c9, +>x9 : a81 +>y9 : a29 +>z9 : a39 +>a9 : a49 +>b9 : a59 +>c9 : a69 + + x10 , y12 , z10 , a10 , b10 , c10, +>x10 : a91 +>y12 : a210 +>z10 : a310 +>a10 : a410 +>b10 : a510 +>c10 : a610 + + x11 , y13 , z11 , a11 , b11 , c11, +>x11 : a111 +>y13 : a211 +>z11 : a311 +>a11 : a411 +>b11 : a511 +>c11 : a611 + + x12 , y14 , z12 , a12 , b12 , c12, +>x12 : a112 +>y14 : a212 +>z12 : a312 +>a12 : a412 +>b12 : a512 +>c12 : a612 + + x13 , y15 , z13 , a13 , b13 , c13, +>x13 : a113 +>y15 : a213 +>z13 : a313 +>a13 : a413 +>b13 : a513 +>c13 : a613 + + x14 , y16 , z14 , a14 , b14 , c14, +>x14 : a114 +>y16 : a214 +>z14 : a314 +>a14 : a414 +>b14 : a514 +>c14 : a614 + + x15 , y17 , z15 , a15 , b15 , c15, +>x15 : a115 +>y17 : a215 +>z15 : a315 +>a15 : a415 +>b15 : a515 +>c15 : a615 + + x16 , y18 , z16 , a16 , b16 , c16, +>x16 : a116 +>y18 : a216 +>z16 : a316 +>a16 : a416 +>b16 : a516 +>c16 : a616 + + x17 , y19 , z17 , a17 , b17 , c17, +>x17 : a117 +>y19 : a217 +>z17 : a317 +>a17 : a417 +>b17 : a517 +>c17 : a617 + + x18 , y10 , z18 , a18 , b18 , c18]; +>x18 : a118 +>y10 : a218 +>z18 : a318 +>a18 : a418 +>b18 : a518 +>c18 : a618 + } diff --git a/tests/baselines/reference/getterSetterNonAccessor.types b/tests/baselines/reference/getterSetterNonAccessor.types new file mode 100644 index 00000000000..9bbf3298ffe --- /dev/null +++ b/tests/baselines/reference/getterSetterNonAccessor.types @@ -0,0 +1,48 @@ +=== tests/cases/compiler/getterSetterNonAccessor.ts === +function getFunc():any{return 0;} +>getFunc : () => any + +function setFunc(v){} +>setFunc : (v: any) => void +>v : any + +Object.defineProperty({}, "0", ({ +>Object.defineProperty({}, "0", ({ + get: getFunc, + set: setFunc, + configurable: true + })) : any +>Object.defineProperty : (o: any, p: string, attributes: PropertyDescriptor) => any +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } +>defineProperty : (o: any, p: string, attributes: PropertyDescriptor) => any +>{} : {} +>({ + get: getFunc, + set: setFunc, + configurable: true + }) : PropertyDescriptor +>PropertyDescriptor : PropertyDescriptor +>({ + get: getFunc, + set: setFunc, + configurable: true + }) : { get: () => any; set: (v: any) => void; configurable: boolean; } +>{ + get: getFunc, + set: setFunc, + configurable: true + } : { get: () => any; set: (v: any) => void; configurable: boolean; } + + get: getFunc, +>get : () => any +>getFunc : getFunc + + set: setFunc, +>set : (v: any) => void +>setFunc : setFunc + + configurable: true +>configurable : boolean + + })); + diff --git a/tests/baselines/reference/global.types b/tests/baselines/reference/global.types new file mode 100644 index 00000000000..86d5dd3c986 --- /dev/null +++ b/tests/baselines/reference/global.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/global.ts === +module M { +>M : typeof M + + export function f(y:number) { +>f : (y: number) => number +>y : number + + return x+y; +>x+y : number +>x : number +>y : number + } +} + +var x=10; +>x : number + +M.f(3); +>M.f(3) : number +>M.f : (y: number) => number +>M : typeof M +>f : (y: number) => number + + diff --git a/tests/baselines/reference/globalThis.types b/tests/baselines/reference/globalThis.types new file mode 100644 index 00000000000..479b8ae276a --- /dev/null +++ b/tests/baselines/reference/globalThis.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/globalThis.ts === +var __e = Math.E; // should not generate 'this.Math.E' +>__e : number +>Math.E : number +>Math : Math +>E : number + diff --git a/tests/baselines/reference/globalThisCapture.types b/tests/baselines/reference/globalThisCapture.types new file mode 100644 index 00000000000..71bb4e99853 --- /dev/null +++ b/tests/baselines/reference/globalThisCapture.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/globalThisCapture.ts === +// Add a lambda to ensure global 'this' capture is triggered +(()=>this.window); +>(()=>this.window) : () => any +>()=>this.window : () => any +>this.window : any +>this : any +>window : any + +var parts = []; +>parts : any[] +>[] : undefined[] + +// Ensure that the generated code is correct +parts[0]; +>parts[0] : any +>parts : any[] + diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.types b/tests/baselines/reference/heterogeneousArrayLiterals.types new file mode 100644 index 00000000000..f81f1b2d249 --- /dev/null +++ b/tests/baselines/reference/heterogeneousArrayLiterals.types @@ -0,0 +1,548 @@ +=== tests/cases/conformance/types/typeRelationships/bestCommonType/heterogeneousArrayLiterals.ts === +// type of an array is the best common type of its elements (plus its contextual type if it exists) + +var a = [1, '']; // {}[] +>a : {}[] +>[1, ''] : {}[] + +var b = [1, null]; // number[] +>b : number[] +>[1, null] : number[] + +var c = [1, '', null]; // {}[] +>c : {}[] +>[1, '', null] : {}[] + +var d = [{}, 1]; // {}[] +>d : {}[] +>[{}, 1] : {}[] +>{} : {} + +var e = [{}, Object]; // {}[] +>e : {}[] +>[{}, Object] : {}[] +>{} : {} +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } + +var f = [[], [1]]; // number[][] +>f : number[][] +>[[], [1]] : number[][] +>[] : undefined[] +>[1] : number[] + +var g = [[1], ['']]; // {}[] +>g : {}[] +>[[1], ['']] : {}[] +>[1] : number[] +>[''] : string[] + +var h = [{ foo: 1, bar: '' }, { foo: 2 }]; // {foo: number}[] +>h : { foo: number; }[] +>[{ foo: 1, bar: '' }, { foo: 2 }] : { foo: number; }[] +>{ foo: 1, bar: '' } : { foo: number; bar: string; } +>foo : number +>bar : string +>{ foo: 2 } : { foo: number; } +>foo : number + +var i = [{ foo: 1, bar: '' }, { foo: '' }]; // {}[] +>i : {}[] +>[{ foo: 1, bar: '' }, { foo: '' }] : {}[] +>{ foo: 1, bar: '' } : { foo: number; bar: string; } +>foo : number +>bar : string +>{ foo: '' } : { foo: string; } +>foo : string + +var j = [() => 1, () => '']; // {}[] +>j : {}[] +>[() => 1, () => ''] : {}[] +>() => 1 : () => number +>() => '' : () => string + +var k = [() => 1, () => 1]; // { (): number }[] +>k : { (): number; }[] +>[() => 1, () => 1] : { (): number; }[] +>() => 1 : () => number +>() => 1 : () => number + +var l = [() => 1, () => null]; // { (): any }[] +>l : { (): any; }[] +>[() => 1, () => null] : { (): any; }[] +>() => 1 : () => number +>() => null : () => any + +var m = [() => 1, () => '', () => null]; // { (): any }[] +>m : { (): any; }[] +>[() => 1, () => '', () => null] : { (): any; }[] +>() => 1 : () => number +>() => '' : () => string +>() => null : () => any + +var n = [[() => 1], [() => '']]; // {}[] +>n : {}[] +>[[() => 1], [() => '']] : {}[] +>[() => 1] : { (): number; }[] +>() => 1 : () => number +>[() => ''] : { (): string; }[] +>() => '' : () => string + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Base { baz: string; } +>Derived2 : Derived2 +>Base : Base +>baz : string + +var base: Base; +>base : Base +>Base : Base + +var derived: Derived; +>derived : Derived +>Derived : Derived + +var derived2: Derived2; +>derived2 : Derived2 +>Derived2 : Derived2 + +module Derived { +>Derived : typeof Derived + + var h = [{ foo: base, basear: derived }, { foo: base }]; // {foo: Base}[] +>h : { foo: Base; }[] +>[{ foo: base, basear: derived }, { foo: base }] : { foo: Base; }[] +>{ foo: base, basear: derived } : { foo: Base; basear: Derived; } +>foo : Base +>base : base +>basear : Derived +>derived : derived +>{ foo: base } : { foo: Base; } +>foo : Base +>base : base + + var i = [{ foo: base, basear: derived }, { foo: derived }]; // {foo: Derived}[] +>i : {}[] +>[{ foo: base, basear: derived }, { foo: derived }] : {}[] +>{ foo: base, basear: derived } : { foo: Base; basear: Derived; } +>foo : Base +>base : base +>basear : Derived +>derived : derived +>{ foo: derived } : { foo: Derived; } +>foo : Derived +>derived : derived + + var j = [() => base, () => derived]; // { {}: Base } +>j : { (): Base; }[] +>[() => base, () => derived] : { (): Base; }[] +>() => base : () => Base +>base : Base +>() => derived : () => Derived +>derived : Derived + + var k = [() => base, () => 1]; // {}[]~ +>k : {}[] +>[() => base, () => 1] : {}[] +>() => base : () => Base +>base : Base +>() => 1 : () => number + + var l = [() => base, () => null]; // { (): any }[] +>l : { (): any; }[] +>[() => base, () => null] : { (): any; }[] +>() => base : () => Base +>base : Base +>() => null : () => any + + var m = [() => base, () => derived, () => null]; // { (): any }[] +>m : { (): any; }[] +>[() => base, () => derived, () => null] : { (): any; }[] +>() => base : () => Base +>base : Base +>() => derived : () => Derived +>derived : Derived +>() => null : () => any + + var n = [[() => base], [() => derived]]; // { (): Base }[] +>n : { (): Base; }[][] +>[[() => base], [() => derived]] : { (): Base; }[][] +>[() => base] : { (): Base; }[] +>() => base : () => Base +>base : Base +>[() => derived] : { (): Derived; }[] +>() => derived : () => Derived +>derived : Derived + + var o = [derived, derived2]; // {}[] +>o : {}[] +>[derived, derived2] : {}[] +>derived : Derived +>derived2 : Derived2 + + var p = [derived, derived2, base]; // Base[] +>p : Base[] +>[derived, derived2, base] : Base[] +>derived : Derived +>derived2 : Derived2 +>base : Base + + var q = [[() => derived2], [() => derived]]; // {}[] +>q : {}[] +>[[() => derived2], [() => derived]] : {}[] +>[() => derived2] : { (): Derived2; }[] +>() => derived2 : () => Derived2 +>derived2 : Derived2 +>[() => derived] : { (): Derived; }[] +>() => derived : () => Derived +>derived : Derived +} + +module WithContextualType { +>WithContextualType : typeof WithContextualType + + // no errors + var a: Base[] = [derived, derived2]; +>a : Base[] +>Base : Base +>[derived, derived2] : Base[] +>derived : Derived +>derived2 : Derived2 + + var b: Derived[] = [null]; +>b : Derived[] +>Derived : Derived +>[null] : Derived[] + + var c: Derived[] = []; +>c : Derived[] +>Derived : Derived +>[] : Derived[] + + var d: { (): Base }[] = [() => derived, () => derived2]; +>d : { (): Base; }[] +>Base : Base +>[() => derived, () => derived2] : { (): Base; }[] +>() => derived : () => Derived +>derived : Derived +>() => derived2 : () => Derived2 +>derived2 : Derived2 +} + +function foo(t: T, u: U) { +>foo : (t: T, u: U) => void +>T : T +>U : U +>t : T +>T : T +>u : U +>U : U + + var a = [t, t]; // T[] +>a : T[] +>[t, t] : T[] +>t : T +>t : T + + var b = [t, null]; // T[] +>b : T[] +>[t, null] : T[] +>t : T + + var c = [t, u]; // {}[] +>c : {}[] +>[t, u] : {}[] +>t : T +>u : U + + var d = [t, 1]; // {}[] +>d : {}[] +>[t, 1] : {}[] +>t : T + + var e = [() => t, () => u]; // {}[] +>e : {}[] +>[() => t, () => u] : {}[] +>() => t : () => T +>t : T +>() => u : () => U +>u : U + + var f = [() => t, () => u, () => null]; // { (): any }[] +>f : { (): any; }[] +>[() => t, () => u, () => null] : { (): any; }[] +>() => t : () => T +>t : T +>() => u : () => U +>u : U +>() => null : () => any +} + +function foo2(t: T, u: U) { +>foo2 : (t: T, u: U) => void +>T : T +>Base : Base +>U : U +>Derived : Derived +>t : T +>T : T +>u : U +>U : U + + var a = [t, t]; // T[] +>a : T[] +>[t, t] : T[] +>t : T +>t : T + + var b = [t, null]; // T[] +>b : T[] +>[t, null] : T[] +>t : T + + var c = [t, u]; // {}[] +>c : {}[] +>[t, u] : {}[] +>t : T +>u : U + + var d = [t, 1]; // {}[] +>d : {}[] +>[t, 1] : {}[] +>t : T + + var e = [() => t, () => u]; // {}[] +>e : {}[] +>[() => t, () => u] : {}[] +>() => t : () => T +>t : T +>() => u : () => U +>u : U + + var f = [() => t, () => u, () => null]; // { (): any }[] +>f : { (): any; }[] +>[() => t, () => u, () => null] : { (): any; }[] +>() => t : () => T +>t : T +>() => u : () => U +>u : U +>() => null : () => any + + var g = [t, base]; // Base[] +>g : Base[] +>[t, base] : Base[] +>t : T +>base : Base + + var h = [t, derived]; // Derived[] +>h : {}[] +>[t, derived] : {}[] +>t : T +>derived : Derived + + var i = [u, base]; // Base[] +>i : Base[] +>[u, base] : Base[] +>u : U +>base : Base + + var j = [u, derived]; // Derived[] +>j : Derived[] +>[u, derived] : Derived[] +>u : U +>derived : Derived +} + +function foo3(t: T, u: U) { +>foo3 : (t: T, u: U) => void +>T : T +>Derived : Derived +>U : U +>Derived : Derived +>t : T +>T : T +>u : U +>U : U + + var a = [t, t]; // T[] +>a : T[] +>[t, t] : T[] +>t : T +>t : T + + var b = [t, null]; // T[] +>b : T[] +>[t, null] : T[] +>t : T + + var c = [t, u]; // {}[] +>c : {}[] +>[t, u] : {}[] +>t : T +>u : U + + var d = [t, 1]; // {}[] +>d : {}[] +>[t, 1] : {}[] +>t : T + + var e = [() => t, () => u]; // {}[] +>e : {}[] +>[() => t, () => u] : {}[] +>() => t : () => T +>t : T +>() => u : () => U +>u : U + + var f = [() => t, () => u, () => null]; // { (): any }[] +>f : { (): any; }[] +>[() => t, () => u, () => null] : { (): any; }[] +>() => t : () => T +>t : T +>() => u : () => U +>u : U +>() => null : () => any + + var g = [t, base]; // Base[] +>g : Base[] +>[t, base] : Base[] +>t : T +>base : Base + + var h = [t, derived]; // Derived[] +>h : Derived[] +>[t, derived] : Derived[] +>t : T +>derived : Derived + + var i = [u, base]; // Base[] +>i : Base[] +>[u, base] : Base[] +>u : U +>base : Base + + var j = [u, derived]; // Derived[] +>j : Derived[] +>[u, derived] : Derived[] +>u : U +>derived : Derived +} + +function foo4(t: T, u: U) { +>foo4 : (t: T, u: U) => void +>T : T +>Base : Base +>U : U +>Base : Base +>t : T +>T : T +>u : U +>U : U + + var a = [t, t]; // T[] +>a : T[] +>[t, t] : T[] +>t : T +>t : T + + var b = [t, null]; // T[] +>b : T[] +>[t, null] : T[] +>t : T + + var c = [t, u]; // BUG 821629 +>c : {}[] +>[t, u] : {}[] +>t : T +>u : U + + var d = [t, 1]; // {}[] +>d : {}[] +>[t, 1] : {}[] +>t : T + + var e = [() => t, () => u]; // {}[] +>e : {}[] +>[() => t, () => u] : {}[] +>() => t : () => T +>t : T +>() => u : () => U +>u : U + + var f = [() => t, () => u, () => null]; // { (): any }[] +>f : { (): any; }[] +>[() => t, () => u, () => null] : { (): any; }[] +>() => t : () => T +>t : T +>() => u : () => U +>u : U +>() => null : () => any + + var g = [t, base]; // Base[] +>g : Base[] +>[t, base] : Base[] +>t : T +>base : Base + + var h = [t, derived]; // Derived[] +>h : {}[] +>[t, derived] : {}[] +>t : T +>derived : Derived + + var i = [u, base]; // Base[] +>i : Base[] +>[u, base] : Base[] +>u : U +>base : Base + + var j = [u, derived]; // Derived[] +>j : {}[] +>[u, derived] : {}[] +>u : U +>derived : Derived + + var k: Base[] = [t, u]; +>k : Base[] +>Base : Base +>[t, u] : Base[] +>t : T +>u : U +} + +//function foo3(t: T, u: U) { +// var a = [t, t]; // T[] +// var b = [t, null]; // T[] +// var c = [t, u]; // {}[] +// var d = [t, 1]; // {}[] +// var e = [() => t, () => u]; // {}[] +// var f = [() => t, () => u, () => null]; // { (): any }[] + +// var g = [t, base]; // Base[] +// var h = [t, derived]; // Derived[] +// var i = [u, base]; // Base[] +// var j = [u, derived]; // Derived[] +//} + +//function foo4(t: T, u: U) { +// var a = [t, t]; // T[] +// var b = [t, null]; // T[] +// var c = [t, u]; // BUG 821629 +// var d = [t, 1]; // {}[] +// var e = [() => t, () => u]; // {}[] +// var f = [() => t, () => u, () => null]; // { (): any }[] + +// var g = [t, base]; // Base[] +// var h = [t, derived]; // Derived[] +// var i = [u, base]; // Base[] +// var j = [u, derived]; // Derived[] + +// var k: Base[] = [t, u]; +//} diff --git a/tests/baselines/reference/hidingCallSignatures.types b/tests/baselines/reference/hidingCallSignatures.types new file mode 100644 index 00000000000..90428b8db76 --- /dev/null +++ b/tests/baselines/reference/hidingCallSignatures.types @@ -0,0 +1,59 @@ +=== tests/cases/compiler/hidingCallSignatures.ts === +interface C { +>C : C + + new (a: string): string; +>a : string +} + +interface D extends C { +>D : D +>C : C + + (a: string): number; // Should be ok +>a : string +} + +interface E { +>E : E + + (a: string): {}; +>a : string +} + +interface F extends E { +>F : F +>E : E + + (a: string): string; +>a : string +} + +var d: D; +>d : D +>D : D + +d(""); // number +>d("") : number +>d : D + +new d(""); // should be string +>new d("") : string +>d : D + +var f: F; +>f : F +>F : F + +f(""); // string +>f("") : string +>f : F + +var e: E; +>e : E +>E : E + +e(""); // {} +>e("") : {} +>e : E + diff --git a/tests/baselines/reference/hidingConstructSignatures.types b/tests/baselines/reference/hidingConstructSignatures.types new file mode 100644 index 00000000000..99781535b5d --- /dev/null +++ b/tests/baselines/reference/hidingConstructSignatures.types @@ -0,0 +1,59 @@ +=== tests/cases/compiler/hidingConstructSignatures.ts === +interface C { +>C : C + + (a: string): string; +>a : string +} + +interface D extends C { +>D : D +>C : C + + new (a: string): number; // Should be ok +>a : string +} + +interface E { +>E : E + + new (a: string): {}; +>a : string +} + +interface F extends E { +>F : F +>E : E + + new (a: string): string; +>a : string +} + +var d: D; +>d : D +>D : D + +d(""); // string +>d("") : string +>d : D + +new d(""); // should be number +>new d("") : number +>d : D + +var f: F; +>f : F +>F : F + +new f(""); // string +>new f("") : string +>f : F + +var e: E; +>e : E +>E : E + +new e(""); // {} +>new e("") : {} +>e : E + diff --git a/tests/baselines/reference/hidingIndexSignatures.types b/tests/baselines/reference/hidingIndexSignatures.types new file mode 100644 index 00000000000..fe1363d1598 --- /dev/null +++ b/tests/baselines/reference/hidingIndexSignatures.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/hidingIndexSignatures.ts === +interface A { +>A : A + + [a: string]: {}; +>a : string +} + +interface B extends A { +>B : B +>A : A + + [a: string]: number; // Number is not a subtype of string. Should error. +>a : string +} + +var b: B; +>b : B +>B : B + +b[""]; // Should be number +>b[""] : number +>b : B + +var a: A; +>a : A +>A : A + +a[""]; // Should be {} +>a[""] : {} +>a : A + diff --git a/tests/baselines/reference/icomparable.types b/tests/baselines/reference/icomparable.types new file mode 100644 index 00000000000..b88c11caf85 --- /dev/null +++ b/tests/baselines/reference/icomparable.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/icomparable.ts === + interface IComparable { +>IComparable : IComparable +>T : T + + compareTo(other: T); +>compareTo : (other: T) => any +>other : T +>T : T + } + + declare function sort>(items: U[]): U[]; +>sort : >(items: U[]) => U[] +>U : U +>IComparable : IComparable +>items : U[] +>U : U +>U : U + + interface StringComparable extends IComparable { +>StringComparable : StringComparable +>IComparable : IComparable + } + + var sc: StringComparable[]; +>sc : StringComparable[] +>StringComparable : StringComparable + + var x = sort(sc); +>x : StringComparable[] +>sort(sc) : StringComparable[] +>sort : >(items: U[]) => U[] +>sc : StringComparable[] + diff --git a/tests/baselines/reference/idInProp.types b/tests/baselines/reference/idInProp.types new file mode 100644 index 00000000000..f300be6ebf2 --- /dev/null +++ b/tests/baselines/reference/idInProp.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/idInProp.ts === +function f() { +>f : () => void + +var t: { (f: any) : any; }; +>t : (f: any) => any +>f : any + +} + diff --git a/tests/baselines/reference/identicalCallSignatures.types b/tests/baselines/reference/identicalCallSignatures.types new file mode 100644 index 00000000000..82616b44a60 --- /dev/null +++ b/tests/baselines/reference/identicalCallSignatures.types @@ -0,0 +1,61 @@ +=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/identicalCallSignatures.ts === +// Each pair of call signatures in these types have a duplicate signature error. +// Identical call signatures should generate an error. +interface I { +>I : I + + (x): number; +>x : any + + (x: any): number; +>x : any + + (x: T): T; +>T : T +>x : T +>T : T +>T : T + + (x: U): U; // error +>U : U +>x : U +>U : U +>U : U +} + +interface I2 { +>I2 : I2 +>T : T + + (x: T): T; +>x : T +>T : T +>T : T + + (x: T): T; // error +>x : T +>T : T +>T : T +} + +var a: { +>a : { (x: any): number; (x: any): number; (x: T): T; (x: T): T; } + + (x): number; +>x : any + + (x: any): number; +>x : any + + (x: T): T; +>T : T +>x : T +>T : T +>T : T + + (x: T): T; // error +>T : T +>x : T +>T : T +>T : T +} diff --git a/tests/baselines/reference/identicalCallSignatures2.types b/tests/baselines/reference/identicalCallSignatures2.types new file mode 100644 index 00000000000..a8a48f52445 --- /dev/null +++ b/tests/baselines/reference/identicalCallSignatures2.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/identicalCallSignatures2.ts === +// Normally it is an error to have multiple overloads with identical signatures in a single type declaration. +// Here the multiple overloads come from multiple bases. + +interface Base { +>Base : Base +>T : T + + (x: number): string; +>x : number +} + +interface I extends Base, Base { } +>I : I +>Base : Base +>Base : Base + +interface I2 extends Base, Base { } +>I2 : I2 +>T : T +>Base : Base +>Base : Base + diff --git a/tests/baselines/reference/identicalCallSignatures3.types b/tests/baselines/reference/identicalCallSignatures3.types new file mode 100644 index 00000000000..d7334d9e5bb --- /dev/null +++ b/tests/baselines/reference/identicalCallSignatures3.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/identicalCallSignatures3.ts === +// Normally it is an error to have multiple overloads with identical signatures in a single type declaration. +// Here the multiple overloads come from multiple merged declarations, so we do not report errors. + +interface I { +>I : I + + (x: number): string; +>x : number +} + +interface I { +>I : I + + (x: number): string; +>x : number +} + +interface I2 { +>I2 : I2 +>T : T + + (x: number): string; +>x : number +} + +interface I2 { +>I2 : I2 +>T : T + + (x: number): string; +>x : number +} diff --git a/tests/baselines/reference/identityForSignaturesWithTypeParametersSwitched.types b/tests/baselines/reference/identityForSignaturesWithTypeParametersSwitched.types new file mode 100644 index 00000000000..59e50179946 --- /dev/null +++ b/tests/baselines/reference/identityForSignaturesWithTypeParametersSwitched.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/identityForSignaturesWithTypeParametersSwitched.ts === +var f: (x: T, y: U) => T; +>f : (x: T, y: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T + +var f: (x: U, y: T) => U; +>f : (x: T, y: U) => T +>T : T +>U : U +>x : U +>U : U +>y : T +>T : T +>U : U + diff --git a/tests/baselines/reference/ifDoWhileStatements.types b/tests/baselines/reference/ifDoWhileStatements.types new file mode 100644 index 00000000000..a03d9d60270 --- /dev/null +++ b/tests/baselines/reference/ifDoWhileStatements.types @@ -0,0 +1,381 @@ +=== tests/cases/conformance/statements/ifDoWhileStatements/ifDoWhileStatements.ts === +interface I { +>I : I + + id: number; +>id : number +} + +class C implements I { +>C : C +>I : I + + id: number; +>id : number + + name: string; +>name : string +} + +class C2 extends C { +>C2 : C2 +>C : C + + valid: boolean; +>valid : boolean +} + +class D{ +>D : D +>T : T + + source: T; +>source : T +>T : T + + recurse: D; +>recurse : D +>D : D +>T : T + + wrapped: D> +>wrapped : D> +>D : D +>D : D +>T : T +} + +function F(x: string): number { return 42; } +>F : (x: string) => number +>x : string + +function F2(x: number): boolean { return x < 42; } +>F2 : (x: number) => boolean +>x : number +>x < 42 : boolean +>x : number + +module M { +>M : typeof M + + export class A { +>A : A + + name: string; +>name : string + } + + export function F2(x: number): string { return x.toString(); } +>F2 : (x: number) => string +>x : number +>x.toString() : string +>x.toString : (radix?: number) => string +>x : number +>toString : (radix?: number) => string +} + +module N { +>N : typeof N + + export class A { +>A : A + + id: number; +>id : number + } + + export function F2(x: number): string { return x.toString(); } +>F2 : (x: number) => string +>x : number +>x.toString() : string +>x.toString : (radix?: number) => string +>x : number +>toString : (radix?: number) => string +} + +// literals +if (true) { } +while (true) { } +do { }while(true) + +if (null) { } +while (null) { } +do { }while(null) + +if (undefined) { } +>undefined : undefined + +while (undefined) { } +>undefined : undefined + +do { }while(undefined) +>undefined : undefined + +if (0.0) { } +while (0.0) { } +do { }while(0.0) + +if ('a string') { } +while ('a string') { } +do { }while('a string') + +if ('') { } +while ('') { } +do { }while('') + +if (/[a-z]/) { } +>/[a-z]/ : RegExp + +while (/[a-z]/) { } +>/[a-z]/ : RegExp + +do { }while(/[a-z]/) +>/[a-z]/ : RegExp + +if ([]) { } +>[] : undefined[] + +while ([]) { } +>[] : undefined[] + +do { }while([]) +>[] : undefined[] + +if ([1, 2]) { } +>[1, 2] : number[] + +while ([1, 2]) { } +>[1, 2] : number[] + +do { }while([1, 2]) +>[1, 2] : number[] + +if ({}) { } +>{} : {} + +while ({}) { } +>{} : {} + +do { }while({}) +>{} : {} + +if ({ x: 1, y: 'a' }) { } +>{ x: 1, y: 'a' } : { x: number; y: string; } +>x : number +>y : string + +while ({ x: 1, y: 'a' }) { } +>{ x: 1, y: 'a' } : { x: number; y: string; } +>x : number +>y : string + +do { }while({ x: 1, y: 'a' }) +>{ x: 1, y: 'a' } : { x: number; y: string; } +>x : number +>y : string + +if (() => 43) { } +>() => 43 : () => number + +while (() => 43) { } +>() => 43 : () => number + +do { }while(() => 43) +>() => 43 : () => number + +if (new C()) { } +>new C() : C +>C : typeof C + +while (new C()) { } +>new C() : C +>C : typeof C + +do { }while(new C()) +>new C() : C +>C : typeof C + +if (new D()) { } +>new D() : D +>D : typeof D +>C : C + +while (new D()) { } +>new D() : D +>D : typeof D +>C : C + +do { }while(new D()) +>new D() : D +>D : typeof D +>C : C + +// references +var a = true; +>a : boolean + +if (a) { } +>a : boolean + +while (a) { } +>a : boolean + +do { }while(a) +>a : boolean + +var b = null; +>b : any + +if (b) { } +>b : any + +while (b) { } +>b : any + +do { }while(b) +>b : any + +var c = undefined; +>c : any +>undefined : undefined + +if (c) { } +>c : any + +while (c) { } +>c : any + +do { }while(c) +>c : any + +var d = 0.0; +>d : number + +if (d) { } +>d : number + +while (d) { } +>d : number + +do { }while(d) +>d : number + +var e = 'a string'; +>e : string + +if (e) { } +>e : string + +while (e) { } +>e : string + +do { }while(e) +>e : string + +var f = ''; +>f : string + +if (f) { } +>f : string + +while (f) { } +>f : string + +do { }while(f) +>f : string + +var g = /[a-z]/ +>g : RegExp +>/[a-z]/ : RegExp + +if (g) { } +>g : RegExp + +while (g) { } +>g : RegExp + +do { }while(g) +>g : RegExp + +var h = []; +>h : any[] +>[] : undefined[] + +if (h) { } +>h : any[] + +while (h) { } +>h : any[] + +do { }while(h) +>h : any[] + +var i = [1, 2]; +>i : number[] +>[1, 2] : number[] + +if (i) { } +>i : number[] + +while (i) { } +>i : number[] + +do { }while(i) +>i : number[] + +var j = {}; +>j : {} +>{} : {} + +if (j) { } +>j : {} + +while (j) { } +>j : {} + +do { }while(j) +>j : {} + +var k = { x: 1, y: 'a' }; +>k : { x: number; y: string; } +>{ x: 1, y: 'a' } : { x: number; y: string; } +>x : number +>y : string + +if (k) { } +>k : { x: number; y: string; } + +while (k) { } +>k : { x: number; y: string; } + +do { }while(k) +>k : { x: number; y: string; } + +function fn(x?: string): I { return null; } +>fn : (x?: string) => I +>x : string +>I : I + +if (fn()) { } +>fn() : I +>fn : (x?: string) => I + +while (fn()) { } +>fn() : I +>fn : (x?: string) => I + +do { }while(fn()) +>fn() : I +>fn : (x?: string) => I + +if (fn) { } +>fn : (x?: string) => I + +while (fn) { } +>fn : (x?: string) => I + +do { }while(fn) +>fn : (x?: string) => I + + + diff --git a/tests/baselines/reference/illegalGenericWrapping1.types b/tests/baselines/reference/illegalGenericWrapping1.types new file mode 100644 index 00000000000..27c34ec5a55 --- /dev/null +++ b/tests/baselines/reference/illegalGenericWrapping1.types @@ -0,0 +1,44 @@ +=== tests/cases/compiler/illegalGenericWrapping1.ts === +interface Sequence { +>Sequence : Sequence +>T : T + + each(iterator: (value: T) => void ): void; +>each : (iterator: (value: T) => void) => void +>iterator : (value: T) => void +>value : T +>T : T + + map(iterator: (value: T) => U): Sequence; +>map : (iterator: (value: T) => U) => Sequence +>U : U +>iterator : (value: T) => U +>value : T +>T : T +>U : U +>Sequence : Sequence +>U : U + + filter(iterator: (value: T) => boolean): Sequence; +>filter : (iterator: (value: T) => boolean) => Sequence +>iterator : (value: T) => boolean +>value : T +>T : T +>Sequence : Sequence +>T : T + + groupBy(keySelector: (value: T) => K): Sequence<{ key: K; items: Sequence; }>; +>groupBy : (keySelector: (value: T) => K) => Sequence<{ key: K; items: Sequence; }> +>K : K +>keySelector : (value: T) => K +>value : T +>T : T +>K : K +>Sequence : Sequence +>key : K +>K : K +>items : Sequence +>Sequence : Sequence +>T : T +} + diff --git a/tests/baselines/reference/implementArrayInterface.types b/tests/baselines/reference/implementArrayInterface.types new file mode 100644 index 00000000000..bf872eb2761 --- /dev/null +++ b/tests/baselines/reference/implementArrayInterface.types @@ -0,0 +1,217 @@ +=== tests/cases/compiler/implementArrayInterface.ts === +declare class ArrayConstructor implements Array { +>ArrayConstructor : ArrayConstructor +>T : T +>Array : Array +>T : T + + toString(): string; +>toString : () => string + + toLocaleString(): string; +>toLocaleString : () => string + + concat(...items: U[]): T[]; +>concat : { (...items: U[]): T[]; (...items: T[]): T[]; } +>U : U +>T : T +>items : U[] +>U : U +>T : T + + concat(...items: T[]): T[]; +>concat : { (...items: U[]): T[]; (...items: T[]): T[]; } +>items : T[] +>T : T +>T : T + + join(separator?: string): string; +>join : (separator?: string) => string +>separator : string + + pop(): T; +>pop : () => T +>T : T + + push(...items: T[]): number; +>push : (...items: T[]) => number +>items : T[] +>T : T + + reverse(): T[]; +>reverse : () => T[] +>T : T + + shift(): T; +>shift : () => T +>T : T + + slice(start?: number, end?: number): T[]; +>slice : (start?: number, end?: number) => T[] +>start : number +>end : number +>T : T + + sort(compareFn?: (a: T, b: T) => number): T[]; +>sort : (compareFn?: (a: T, b: T) => number) => T[] +>compareFn : (a: T, b: T) => number +>a : T +>T : T +>b : T +>T : T +>T : T + + splice(start: number): T[]; +>splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>start : number +>T : T + + splice(start: number, deleteCount: number, ...items: T[]): T[]; +>splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>start : number +>deleteCount : number +>items : T[] +>T : T +>T : T + + unshift(...items: T[]): number; +>unshift : (...items: T[]) => number +>items : T[] +>T : T + + indexOf(searchElement: T, fromIndex?: number): number; +>indexOf : (searchElement: T, fromIndex?: number) => number +>searchElement : T +>T : T +>fromIndex : number + + lastIndexOf(searchElement: T, fromIndex?: number): number; +>lastIndexOf : (searchElement: T, fromIndex?: number) => number +>searchElement : T +>T : T +>fromIndex : number + + every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; +>every : (callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any) => boolean +>callbackfn : (value: T, index: number, array: T[]) => boolean +>value : T +>T : T +>index : number +>array : T[] +>T : T +>thisArg : any + + some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; +>some : (callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any) => boolean +>callbackfn : (value: T, index: number, array: T[]) => boolean +>value : T +>T : T +>index : number +>array : T[] +>T : T +>thisArg : any + + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; +>forEach : (callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any) => void +>callbackfn : (value: T, index: number, array: T[]) => void +>value : T +>T : T +>index : number +>array : T[] +>T : T +>thisArg : any + + map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; +>map : (callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any) => U[] +>U : U +>callbackfn : (value: T, index: number, array: T[]) => U +>value : T +>T : T +>index : number +>array : T[] +>T : T +>U : U +>thisArg : any +>U : U + + filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; +>filter : (callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any) => T[] +>callbackfn : (value: T, index: number, array: T[]) => boolean +>value : T +>T : T +>index : number +>array : T[] +>T : T +>thisArg : any +>T : T + + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; +>reduce : { (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; (callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } +>callbackfn : (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T +>previousValue : T +>T : T +>currentValue : T +>T : T +>currentIndex : number +>array : T[] +>T : T +>T : T +>initialValue : T +>T : T +>T : T + + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; +>reduce : { (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; (callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } +>U : U +>callbackfn : (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U +>previousValue : U +>U : U +>currentValue : T +>T : T +>currentIndex : number +>array : T[] +>T : T +>U : U +>initialValue : U +>U : U +>U : U + + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; +>reduceRight : { (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; (callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } +>callbackfn : (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T +>previousValue : T +>T : T +>currentValue : T +>T : T +>currentIndex : number +>array : T[] +>T : T +>T : T +>initialValue : T +>T : T +>T : T + + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; +>reduceRight : { (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; (callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } +>U : U +>callbackfn : (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U +>previousValue : U +>U : U +>currentValue : T +>T : T +>currentIndex : number +>array : T[] +>T : T +>U : U +>initialValue : U +>U : U +>U : U + + length: number; +>length : number + + [n: number]: T; +>n : number +>T : T +} + diff --git a/tests/baselines/reference/implementInterfaceAnyMemberWithVoid.types b/tests/baselines/reference/implementInterfaceAnyMemberWithVoid.types new file mode 100644 index 00000000000..0b7fe6c69d0 --- /dev/null +++ b/tests/baselines/reference/implementInterfaceAnyMemberWithVoid.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/implementInterfaceAnyMemberWithVoid.ts === +interface I { +>I : I + + foo(value: number); +>foo : (value: number) => any +>value : number +} + +class Bug implements I { +>Bug : Bug +>I : I + + public foo(value: number) { +>foo : (value: number) => void +>value : number + } +} + diff --git a/tests/baselines/reference/implicitAnyAnyReturningFunction.types b/tests/baselines/reference/implicitAnyAnyReturningFunction.types new file mode 100644 index 00000000000..1f0b81c724f --- /dev/null +++ b/tests/baselines/reference/implicitAnyAnyReturningFunction.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/implicitAnyAnyReturningFunction.ts === +function A() { +>A : () => any + + return ""; +>"" : any +} + +function B() { +>B : () => any + + var someLocal: any = {}; +>someLocal : any +>{} : {} + + return someLocal; +>someLocal : any +} + +class C { +>C : C + + public A() { +>A : () => any + + return ""; +>"" : any + } + + public B() { +>B : () => any + + var someLocal: any = {}; +>someLocal : any +>{} : {} + + return someLocal; +>someLocal : any + } +} + diff --git a/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType2.types b/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType2.types new file mode 100644 index 00000000000..9fd971ab862 --- /dev/null +++ b/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType2.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/implicitAnyDeclareFunctionWithoutFormalType2.ts === +// generates function fn1(): number; +function fn1() { +>fn1 : () => number + + var x: number; +>x : number + + return x; +>x : number +} +// generates function fn2(): any; +function fn2(): any { +>fn2 : () => any + + var x: any; +>x : any + + return x; +>x : any +} +// generates function fn3(); +function fn3() { +>fn3 : () => any + + var x: any; +>x : any + + return x; +>x : any +} + diff --git a/tests/baselines/reference/implicitAnyGenerics.types b/tests/baselines/reference/implicitAnyGenerics.types new file mode 100644 index 00000000000..bab4219a90a --- /dev/null +++ b/tests/baselines/reference/implicitAnyGenerics.types @@ -0,0 +1,83 @@ +=== tests/cases/compiler/implicitAnyGenerics.ts === + +class C { +>C : C +>T : T + + x: T; +>x : T +>T : T +} + +var c = new C(); +>c : C<{}> +>new C() : C<{}> +>C : typeof C + +var c2 = new C(); +>c2 : C +>new C() : C +>C : typeof C + +var c3 = new C(); +>c3 : C +>new C() : C +>C : typeof C + +var c4: C = new C(); +>c4 : C +>C : C +>new C() : C<{}> +>C : typeof C + +class D { +>D : D +>T : T + + constructor(x: T) { } +>x : T +>T : T +} + +var d = new D(null); +>d : D +>new D(null) : D +>D : typeof D + +var d2 = new D(1); +>d2 : D +>new D(1) : D +>D : typeof D + +var d3 = new D(1); +>d3 : D +>new D(1) : D +>D : typeof D + +var d4 = new D(1); +>d4 : D +>new D(1) : D +>D : typeof D +>1 : any + +var d5: D = new D(null); +>d5 : D +>D : D +>new D(null) : D +>D : typeof D + +function foo(): T { return null; }; +>foo : () => T +>T : T +>T : T + +foo() +>foo() : {} +>foo : () => T + +foo(); +>foo() : any +>foo : () => T + + + diff --git a/tests/baselines/reference/implicitAnyInCatch.types b/tests/baselines/reference/implicitAnyInCatch.types new file mode 100644 index 00000000000..b5a5821eacc --- /dev/null +++ b/tests/baselines/reference/implicitAnyInCatch.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/implicitAnyInCatch.ts === +// this should not be an error +try { } catch (error) { +>error : any + + if (error.number === -2147024809) { } +>error.number === -2147024809 : boolean +>error.number : any +>error : any +>number : any +>-2147024809 : number +} +for (var key in this) { } +>key : any +>this : any + +class C { +>C : C + + public temp() { +>temp : () => void + + for (var x in this) { +>x : any +>this : C + } + } +} + + diff --git a/tests/baselines/reference/importAliasIdentifiers.types b/tests/baselines/reference/importAliasIdentifiers.types new file mode 100644 index 00000000000..0ccb60427e6 --- /dev/null +++ b/tests/baselines/reference/importAliasIdentifiers.types @@ -0,0 +1,123 @@ +=== tests/cases/conformance/internalModules/importDeclarations/importAliasIdentifiers.ts === +module moduleA { +>moduleA : typeof moduleA + + export class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + } +} + +import alias = moduleA; +>alias : typeof moduleA +>moduleA : typeof moduleA + +var p: alias.Point; +>p : Point +>alias : alias +>Point : Point + +var p: moduleA.Point; +>p : Point +>moduleA : moduleA +>Point : Point + +var p: { x: number; y: number; }; +>p : Point +>x : number +>y : number + +class clodule { +>clodule : clodule + + name: string; +>name : string +} + +module clodule { +>clodule : typeof clodule + + export interface Point { +>Point : Point + + x: number; y: number; +>x : number +>y : number + } + var Point: Point = { x: 0, y: 0 }; +>Point : Point +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number +} + +import clolias = clodule; +>clolias : typeof clodule +>clodule : clodule + +var p: clolias.Point; +>p : Point +>clolias : clolias +>Point : Point + +var p: clodule.Point; +>p : Point +>clodule : clodule +>Point : Point + +var p: { x: number; y: number; }; +>p : Point +>x : number +>y : number + + +function fundule() { +>fundule : typeof fundule + + return { x: 0, y: 0 }; +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number +} + +module fundule { +>fundule : typeof fundule + + export interface Point { +>Point : Point + + x: number; y: number; +>x : number +>y : number + } + var Point: Point = { x: 0, y: 0 }; +>Point : Point +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number +} + +import funlias = fundule; +>funlias : typeof fundule +>fundule : typeof fundule + +var p: funlias.Point; +>p : Point +>funlias : funlias +>Point : Point + +var p: fundule.Point; +>p : Point +>fundule : fundule +>Point : Point + +var p: { x: number; y: number; }; +>p : Point +>x : number +>y : number + diff --git a/tests/baselines/reference/importAliasWithDottedName.types b/tests/baselines/reference/importAliasWithDottedName.types new file mode 100644 index 00000000000..29ef8a54baa --- /dev/null +++ b/tests/baselines/reference/importAliasWithDottedName.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/importAliasWithDottedName.ts === +module M { +>M : typeof M + + export var x = 1; +>x : number + + export module N { +>N : typeof N + + export var y = 2; +>y : number + } +} + +module A { +>A : typeof A + + import N = M.N; +>N : typeof N +>M : typeof N +>N : typeof N + + var r = N.y; +>r : number +>N.y : number +>N : typeof N +>y : number + + var r2 = M.N.y; +>r2 : number +>M.N.y : number +>M.N : typeof N +>M : typeof M +>N : typeof N +>y : number +} diff --git a/tests/baselines/reference/importAndVariableDeclarationConflict2.types b/tests/baselines/reference/importAndVariableDeclarationConflict2.types new file mode 100644 index 00000000000..f3d76d7ac01 --- /dev/null +++ b/tests/baselines/reference/importAndVariableDeclarationConflict2.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/importAndVariableDeclarationConflict2.ts === +module m { +>m : typeof m + + export var m = ''; +>m : string +} + +import x = m.m; +>x : string +>m : string +>m : string + +class C { +>C : C + + public foo() { +>foo : () => void + + var x = ''; +>x : string + } +} diff --git a/tests/baselines/reference/importDeclWithExportModifierInAmbientContext.types b/tests/baselines/reference/importDeclWithExportModifierInAmbientContext.types new file mode 100644 index 00000000000..2adeb194f47 --- /dev/null +++ b/tests/baselines/reference/importDeclWithExportModifierInAmbientContext.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/importDeclWithExportModifierInAmbientContext.ts === +declare module "m" { + module x { +>x : x + + interface c { +>c : c + } + } + export import a = x.c; +>a : a +>x : c +>c : c + + var b: a; +>b : c +>a : a +} + diff --git a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.types b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.types new file mode 100644 index 00000000000..6fc80e99913 --- /dev/null +++ b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/importDeclarationUsedAsTypeQuery_1.ts === +/// +import a = require('importDeclarationUsedAsTypeQuery_require'); +>a : typeof "tests/cases/compiler/importDeclarationUsedAsTypeQuery_require" + +export var x: typeof a; +>x : typeof "tests/cases/compiler/importDeclarationUsedAsTypeQuery_require" +>a : typeof "tests/cases/compiler/importDeclarationUsedAsTypeQuery_require" + +=== tests/cases/compiler/importDeclarationUsedAsTypeQuery_require.ts === +export class B { +>B : B + + id: number; +>id : number +} + diff --git a/tests/baselines/reference/importImportOnlyModule.types b/tests/baselines/reference/importImportOnlyModule.types new file mode 100644 index 00000000000..cbf9fa29a52 --- /dev/null +++ b/tests/baselines/reference/importImportOnlyModule.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/externalModules/foo_2.ts === +import foo = require("./foo_1"); +>foo : typeof "tests/cases/conformance/externalModules/foo_1" + +var x = foo; // Cause a runtime dependency +>x : typeof "tests/cases/conformance/externalModules/foo_1" +>foo : typeof "tests/cases/conformance/externalModules/foo_1" + +=== tests/cases/conformance/externalModules/foo_0.ts === +export class C1 { +>C1 : C1 + + m1 = 42; +>m1 : number + + static s1 = true; +>s1 : boolean +} + +=== tests/cases/conformance/externalModules/foo_1.ts === +import c1 = require('./foo_0'); // Makes this an external module +>c1 : typeof "tests/cases/conformance/externalModules/foo_0" + +var answer = 42; // No exports +>answer : number + diff --git a/tests/baselines/reference/importInTypePosition.types b/tests/baselines/reference/importInTypePosition.types new file mode 100644 index 00000000000..8117b9290b7 --- /dev/null +++ b/tests/baselines/reference/importInTypePosition.types @@ -0,0 +1,49 @@ +=== tests/cases/compiler/importInTypePosition.ts === +module A { +>A : typeof A + + export class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + } + export var Origin = new Point(0, 0); +>Origin : Point +>new Point(0, 0) : Point +>Point : typeof Point +} + +// no code gen expected +module B { +>B : B + + import a = A; //Error generates 'var = ;' +>a : typeof A +>A : typeof A +} +// no code gen expected +module C { +>C : typeof C + + import a = A; //Error generates 'var = ;' +>a : typeof A +>A : typeof A + + var m: typeof a; +>m : typeof A +>a : typeof A + + var p: a.Point; +>p : Point +>a : a +>Point : Point + + var p = { x: 0, y: 0 }; +>p : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number +} + diff --git a/tests/baselines/reference/importOnAliasedIdentifiers.types b/tests/baselines/reference/importOnAliasedIdentifiers.types new file mode 100644 index 00000000000..d91180705c3 --- /dev/null +++ b/tests/baselines/reference/importOnAliasedIdentifiers.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/importOnAliasedIdentifiers.ts === +module A { +>A : typeof A + + export interface X { s: string } +>X : X +>s : string + + export var X: X; +>X : X +>X : X +} +module B { +>B : typeof B + + interface A { n: number } +>A : A +>n : number + + import Y = A; // Alias only for module A +>Y : typeof A +>A : typeof A + + import Z = A.X; // Alias for both type and member A.X +>Z : X +>A : X +>X : X + + var v: Z = Z; +>v : X +>Z : Z +>Z : X +} diff --git a/tests/baselines/reference/importShadowsGlobalName.types b/tests/baselines/reference/importShadowsGlobalName.types new file mode 100644 index 00000000000..35bbf6aa068 --- /dev/null +++ b/tests/baselines/reference/importShadowsGlobalName.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/Bar.ts === +import Error = require('Foo'); +>Error : typeof Foo + +class Bar extends Error {} +>Bar : Bar +>Error : Error + +export = Bar; +>Bar : Bar + +=== tests/cases/compiler/Foo.ts === + +class Foo {} +>Foo : Foo + +export = Foo; +>Foo : Foo + diff --git a/tests/baselines/reference/importStatements.types b/tests/baselines/reference/importStatements.types new file mode 100644 index 00000000000..c7fe4382d30 --- /dev/null +++ b/tests/baselines/reference/importStatements.types @@ -0,0 +1,93 @@ +=== tests/cases/conformance/internalModules/codeGeneration/importStatements.ts === +module A { +>A : typeof A + + export class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + } + + export var Origin = new Point(0, 0); +>Origin : Point +>new Point(0, 0) : Point +>Point : typeof Point +} + +// no code gen expected +module B { +>B : B + + import a = A; //Error generates 'var = ;' +>a : typeof A +>A : typeof A +} + +// no code gen expected +module C { +>C : typeof C + + import a = A; //Error generates 'var = ;' +>a : typeof A +>A : typeof A + + var m: typeof a; +>m : typeof A +>a : typeof A + + var p: a.Point; +>p : Point +>a : a +>Point : Point + + var p = {x:0, y:0 }; +>p : Point +>{x:0, y:0 } : { x: number; y: number; } +>x : number +>y : number +} + +// code gen expected +module D { +>D : typeof D + + import a = A; +>a : typeof A +>A : typeof A + + var p = new a.Point(1, 1); +>p : Point +>new a.Point(1, 1) : Point +>a.Point : typeof Point +>a : typeof A +>Point : typeof Point +} + +module E { +>E : typeof E + + import a = A; +>a : typeof A +>A : typeof A + + export function xDist(x: a.Point) { +>xDist : (x: Point) => number +>x : Point +>a : a +>Point : Point + + return (a.Origin.x - x.x); +>(a.Origin.x - x.x) : number +>a.Origin.x - x.x : number +>a.Origin.x : number +>a.Origin : Point +>a : typeof A +>Origin : Point +>x : number +>x.x : number +>x : Point +>x : number + } +} diff --git a/tests/baselines/reference/importUsedInExtendsList1.types b/tests/baselines/reference/importUsedInExtendsList1.types new file mode 100644 index 00000000000..a6937acb734 --- /dev/null +++ b/tests/baselines/reference/importUsedInExtendsList1.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/importUsedInExtendsList1_1.ts === +/// +import foo = require('importUsedInExtendsList1_require'); +>foo : typeof "tests/cases/compiler/importUsedInExtendsList1_require" + +class Sub extends foo.Super { } +>Sub : Sub +>foo : foo +>Super : Super + +var s: Sub; +>s : Sub +>Sub : Sub + +var r: string = s.foo; +>r : string +>s.foo : string +>s : Sub +>foo : string + +=== tests/cases/compiler/importUsedInExtendsList1_require.ts === +export class Super { foo: string; } +>Super : Super +>foo : string + diff --git a/tests/baselines/reference/import_reference-exported-alias.types b/tests/baselines/reference/import_reference-exported-alias.types new file mode 100644 index 00000000000..275872c2970 --- /dev/null +++ b/tests/baselines/reference/import_reference-exported-alias.types @@ -0,0 +1,48 @@ +=== tests/cases/compiler/file2.ts === +import appJs = require("file1"); +>appJs : typeof App + +import Services = appJs.Services; +>Services : typeof Services +>appJs : typeof Services +>Services : typeof Services + +import UserServices = Services.UserServices; +>UserServices : typeof UserServices +>Services : UserServices +>UserServices : UserServices + +var x = new UserServices().getUserName(); +>x : string +>new UserServices().getUserName() : string +>new UserServices().getUserName : () => string +>new UserServices() : UserServices +>UserServices : typeof UserServices +>getUserName : () => string + +=== tests/cases/compiler/file1.ts === +module App { +>App : typeof App + + export module Services { +>Services : typeof Services + + export class UserServices { +>UserServices : UserServices + + public getUserName(): string { +>getUserName : () => string + + return "Bill Gates"; + } + } + } +} + +import Mod = App; +>Mod : typeof App +>App : typeof App + +export = Mod; +>Mod : typeof App + diff --git a/tests/baselines/reference/import_reference-to-type-alias.types b/tests/baselines/reference/import_reference-to-type-alias.types new file mode 100644 index 00000000000..5dad3fbedb9 --- /dev/null +++ b/tests/baselines/reference/import_reference-to-type-alias.types @@ -0,0 +1,39 @@ +=== tests/cases/compiler/file2.ts === +import appJs = require("file1"); +>appJs : typeof "tests/cases/compiler/file1" + +import Services = appJs.App.Services; +>Services : typeof Services +>appJs : typeof Services +>App : typeof Services +>Services : typeof Services + +var x = new Services.UserServices().getUserName(); +>x : string +>new Services.UserServices().getUserName() : string +>new Services.UserServices().getUserName : () => string +>new Services.UserServices() : UserServices +>Services.UserServices : typeof UserServices +>Services : typeof Services +>UserServices : typeof UserServices +>getUserName : () => string + +=== tests/cases/compiler/file1.ts === +export module App { +>App : typeof App + + export module Services { +>Services : typeof Services + + export class UserServices { +>UserServices : UserServices + + public getUserName(): string { +>getUserName : () => string + + return "Bill Gates"; + } + } + } +} + diff --git a/tests/baselines/reference/import_unneeded-require-when-referenecing-aliased-type-throug-array.types b/tests/baselines/reference/import_unneeded-require-when-referenecing-aliased-type-throug-array.types new file mode 100644 index 00000000000..707df8da5b6 --- /dev/null +++ b/tests/baselines/reference/import_unneeded-require-when-referenecing-aliased-type-throug-array.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/a.ts === +/// +import ITest = require('ITest'); +>ITest : ITest + +var testData: ITest[]; +>testData : Name[] +>ITest : ITest + +var p = testData[0].name; +>p : string +>testData[0].name : string +>testData[0] : Name +>testData : Name[] +>name : string + +=== tests/cases/compiler/b.ts === +declare module "ITest" { + interface Name { +>Name : Name + + name: string; +>name : string + } + export = Name; +>Name : Name +} + diff --git a/tests/baselines/reference/import_var-referencing-an-imported-module-alias.types b/tests/baselines/reference/import_var-referencing-an-imported-module-alias.types new file mode 100644 index 00000000000..3a51c2216ce --- /dev/null +++ b/tests/baselines/reference/import_var-referencing-an-imported-module-alias.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/consumer.ts === + +import host = require("host"); +>host : typeof "tests/cases/compiler/host" + +var hostVar = host; +>hostVar : typeof "tests/cases/compiler/host" +>host : typeof "tests/cases/compiler/host" + +var v = new hostVar.Host(); +>v : Host +>new hostVar.Host() : Host +>hostVar.Host : typeof Host +>hostVar : typeof "tests/cases/compiler/host" +>Host : typeof Host + +=== tests/cases/compiler/host.ts === +export class Host { } +>Host : Host + diff --git a/tests/baselines/reference/importedModuleClassNameClash.types b/tests/baselines/reference/importedModuleClassNameClash.types new file mode 100644 index 00000000000..4aa37429c9e --- /dev/null +++ b/tests/baselines/reference/importedModuleClassNameClash.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/importedModuleClassNameClash.ts === +import foo = m1; +>foo : typeof foo +>m1 : foo + +export module m1 { } +>m1 : m1 + +class foo { } +>foo : foo + diff --git a/tests/baselines/reference/inOperatorWithFunction.types b/tests/baselines/reference/inOperatorWithFunction.types new file mode 100644 index 00000000000..9de7663011d --- /dev/null +++ b/tests/baselines/reference/inOperatorWithFunction.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/inOperatorWithFunction.ts === +var fn = function (val: boolean) { return val; } +>fn : (val: boolean) => boolean +>function (val: boolean) { return val; } : (val: boolean) => boolean +>val : boolean +>val : boolean + +fn("a" in { "a": true }); +>fn("a" in { "a": true }) : boolean +>fn : (val: boolean) => boolean +>"a" in { "a": true } : boolean +>{ "a": true } : { "a": boolean; } + diff --git a/tests/baselines/reference/inOperatorWithGeneric.types b/tests/baselines/reference/inOperatorWithGeneric.types new file mode 100644 index 00000000000..2048e11082a --- /dev/null +++ b/tests/baselines/reference/inOperatorWithGeneric.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/inOperatorWithGeneric.ts === +class C { +>C : C +>T : T + + foo(x:T) { +>foo : (x: T) => void +>x : T +>T : T + + for (var p in x) { +>p : any +>x : T + } + } +} diff --git a/tests/baselines/reference/inOperatorWithValidOperands.types b/tests/baselines/reference/inOperatorWithValidOperands.types new file mode 100644 index 00000000000..f621c3bf55d --- /dev/null +++ b/tests/baselines/reference/inOperatorWithValidOperands.types @@ -0,0 +1,69 @@ +=== tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithValidOperands.ts === +var x: any; +>x : any + +// valid left operands +// the left operand is required to be of type Any, the String primitive type, or the Number primitive type +var a1: string; +>a1 : string + +var a2: number; +>a2 : number + +var ra1 = x in x; +>ra1 : boolean +>x in x : boolean +>x : any +>x : any + +var ra2 = a1 in x; +>ra2 : boolean +>a1 in x : boolean +>a1 : string +>x : any + +var ra3 = a2 in x; +>ra3 : boolean +>a2 in x : boolean +>a2 : number +>x : any + +var ra4 = '' in x; +>ra4 : boolean +>'' in x : boolean +>x : any + +var ra5 = 0 in x; +>ra5 : boolean +>0 in x : boolean +>x : any + +// valid right operands +// the right operand is required to be of type Any, an object type, or a type parameter type +var b1: {}; +>b1 : {} + +var rb1 = x in b1; +>rb1 : boolean +>x in b1 : boolean +>x : any +>b1 : {} + +var rb2 = x in {}; +>rb2 : boolean +>x in {} : boolean +>x : any +>{} : {} + +function foo(t: T) { +>foo : (t: T) => void +>T : T +>t : T +>T : T + + var rb3 = x in t; +>rb3 : boolean +>x in t : boolean +>x : any +>t : T +} diff --git a/tests/baselines/reference/incrementOperatorWithAnyOtherType.types b/tests/baselines/reference/incrementOperatorWithAnyOtherType.types new file mode 100644 index 00000000000..3d43764943a --- /dev/null +++ b/tests/baselines/reference/incrementOperatorWithAnyOtherType.types @@ -0,0 +1,191 @@ +=== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherType.ts === +// ++ operator on any type + +var ANY: any; +>ANY : any + +var ANY1; +>ANY1 : any + +var ANY2: any[] = ["", ""]; +>ANY2 : any[] +>["", ""] : any[] + +var obj = {x:1,y:null}; +>obj : { x: number; y: any; } +>{x:1,y:null} : { x: number; y: null; } +>x : number +>y : any + +class A { +>A : A + + public a: any; +>a : any +} +module M { +>M : typeof M + + export var n: any; +>n : any +} +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// any type var +var ResultIsNumber1 = ++ANY; +>ResultIsNumber1 : number +>++ANY : number +>ANY : any + +var ResultIsNumber2 = ++ANY1; +>ResultIsNumber2 : number +>++ANY1 : number +>ANY1 : any + +var ResultIsNumber3 = ANY1++; +>ResultIsNumber3 : number +>ANY1++ : number +>ANY1 : any + +var ResultIsNumber4 = ANY1++; +>ResultIsNumber4 : number +>ANY1++ : number +>ANY1 : any + +// expressions +var ResultIsNumber5 = ++ANY2[0]; +>ResultIsNumber5 : number +>++ANY2[0] : number +>ANY2[0] : any +>ANY2 : any[] + +var ResultIsNumber6 = ++obj.x; +>ResultIsNumber6 : number +>++obj.x : number +>obj.x : number +>obj : { x: number; y: any; } +>x : number + +var ResultIsNumber7 = ++obj.y; +>ResultIsNumber7 : number +>++obj.y : number +>obj.y : any +>obj : { x: number; y: any; } +>y : any + +var ResultIsNumber8 = ++objA.a; +>ResultIsNumber8 : number +>++objA.a : number +>objA.a : any +>objA : A +>a : any + +var ResultIsNumber = ++M.n; +>ResultIsNumber : number +>++M.n : number +>M.n : any +>M : typeof M +>n : any + +var ResultIsNumber9 = ANY2[0]++; +>ResultIsNumber9 : number +>ANY2[0]++ : number +>ANY2[0] : any +>ANY2 : any[] + +var ResultIsNumber10 = obj.x++; +>ResultIsNumber10 : number +>obj.x++ : number +>obj.x : number +>obj : { x: number; y: any; } +>x : number + +var ResultIsNumber11 = obj.y++; +>ResultIsNumber11 : number +>obj.y++ : number +>obj.y : any +>obj : { x: number; y: any; } +>y : any + +var ResultIsNumber12 = objA.a++; +>ResultIsNumber12 : number +>objA.a++ : number +>objA.a : any +>objA : A +>a : any + +var ResultIsNumber13 = M.n++; +>ResultIsNumber13 : number +>M.n++ : number +>M.n : any +>M : typeof M +>n : any + +// miss assignment opertors +++ANY; +>++ANY : number +>ANY : any + +++ANY1; +>++ANY1 : number +>ANY1 : any + +++ANY2[0]; +>++ANY2[0] : number +>ANY2[0] : any +>ANY2 : any[] + +++ANY, ++ANY1; +>++ANY, ++ANY1 : number +>++ANY : number +>ANY : any +>++ANY1 : number +>ANY1 : any + +++objA.a; +>++objA.a : number +>objA.a : any +>objA : A +>a : any + +++M.n; +>++M.n : number +>M.n : any +>M : typeof M +>n : any + +ANY++; +>ANY++ : number +>ANY : any + +ANY1++; +>ANY1++ : number +>ANY1 : any + +ANY2[0]++; +>ANY2[0]++ : number +>ANY2[0] : any +>ANY2 : any[] + +ANY++, ANY1++; +>ANY++, ANY1++ : number +>ANY++ : number +>ANY : any +>ANY1++ : number +>ANY1 : any + +objA.a++; +>objA.a++ : number +>objA.a : any +>objA : A +>a : any + +M.n++; +>M.n++ : number +>M.n : any +>M : typeof M +>n : any + diff --git a/tests/baselines/reference/incrementOperatorWithEnumType.types b/tests/baselines/reference/incrementOperatorWithEnumType.types new file mode 100644 index 00000000000..3b13c01d5df --- /dev/null +++ b/tests/baselines/reference/incrementOperatorWithEnumType.types @@ -0,0 +1,30 @@ +=== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts === +// ++ operator on enum type + +enum ENUM1 { 1, 2, "" }; +>ENUM1 : ENUM1 + +// expression +var ResultIsNumber1 = ++ENUM1[1]; +>ResultIsNumber1 : number +>++ENUM1[1] : number +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 + +var ResultIsNumber2 = ENUM1[1]++; +>ResultIsNumber2 : number +>ENUM1[1]++ : number +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 + +// miss assignment operator +++ENUM1[1]; +>++ENUM1[1] : number +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 + +ENUM1[1]++; +>ENUM1[1]++ : number +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 + diff --git a/tests/baselines/reference/incrementOperatorWithNumberType.types b/tests/baselines/reference/incrementOperatorWithNumberType.types new file mode 100644 index 00000000000..ad6ea172ae3 --- /dev/null +++ b/tests/baselines/reference/incrementOperatorWithNumberType.types @@ -0,0 +1,137 @@ +=== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberType.ts === +// ++ operator on number type +var NUMBER: number; +>NUMBER : number + +var NUMBER1: number[] = [1, 2]; +>NUMBER1 : number[] +>[1, 2] : number[] + +class A { +>A : A + + public a: number; +>a : number +} +module M { +>M : typeof M + + export var n: number; +>n : number +} + +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// number type var +var ResultIsNumber1 = ++NUMBER; +>ResultIsNumber1 : number +>++NUMBER : number +>NUMBER : number + +var ResultIsNumber2 = NUMBER++; +>ResultIsNumber2 : number +>NUMBER++ : number +>NUMBER : number + +// expressions +var ResultIsNumber3 = ++objA.a; +>ResultIsNumber3 : number +>++objA.a : number +>objA.a : number +>objA : A +>a : number + +var ResultIsNumber4 = ++M.n; +>ResultIsNumber4 : number +>++M.n : number +>M.n : number +>M : typeof M +>n : number + +var ResultIsNumber5 = objA.a++; +>ResultIsNumber5 : number +>objA.a++ : number +>objA.a : number +>objA : A +>a : number + +var ResultIsNumber6 = M.n++; +>ResultIsNumber6 : number +>M.n++ : number +>M.n : number +>M : typeof M +>n : number + +var ResultIsNumber7 = NUMBER1[0]++; +>ResultIsNumber7 : number +>NUMBER1[0]++ : number +>NUMBER1[0] : number +>NUMBER1 : number[] + +// miss assignment operators +++NUMBER; +>++NUMBER : number +>NUMBER : number + +++NUMBER1[0]; +>++NUMBER1[0] : number +>NUMBER1[0] : number +>NUMBER1 : number[] + +++objA.a; +>++objA.a : number +>objA.a : number +>objA : A +>a : number + +++M.n; +>++M.n : number +>M.n : number +>M : typeof M +>n : number + +++objA.a, M.n; +>++objA.a, M.n : number +>++objA.a : number +>objA.a : number +>objA : A +>a : number +>M.n : number +>M : typeof M +>n : number + +NUMBER++; +>NUMBER++ : number +>NUMBER : number + +NUMBER1[0]++; +>NUMBER1[0]++ : number +>NUMBER1[0] : number +>NUMBER1 : number[] + +objA.a++; +>objA.a++ : number +>objA.a : number +>objA : A +>a : number + +M.n++; +>M.n++ : number +>M.n : number +>M : typeof M +>n : number + +objA.a++, M.n++; +>objA.a++, M.n++ : number +>objA.a++ : number +>objA.a : number +>objA : A +>a : number +>M.n++ : number +>M.n : number +>M : typeof M +>n : number + diff --git a/tests/baselines/reference/indexClassByNumber.types b/tests/baselines/reference/indexClassByNumber.types new file mode 100644 index 00000000000..c58771d3256 --- /dev/null +++ b/tests/baselines/reference/indexClassByNumber.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/indexClassByNumber.ts === +// Shouldn't be able to index a class instance by a number (unless it has declared a number index signature) + +class foo { } +>foo : foo + +var f = new foo(); +>f : foo +>new foo() : foo +>foo : typeof foo + +f[0] = 4; // Shouldn't be allowed +>f[0] = 4 : number +>f[0] : any +>f : foo + diff --git a/tests/baselines/reference/indexIntoEnum.types b/tests/baselines/reference/indexIntoEnum.types new file mode 100644 index 00000000000..39849566409 --- /dev/null +++ b/tests/baselines/reference/indexIntoEnum.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/indexIntoEnum.ts === +module M { +>M : typeof M + + enum E { } +>E : E + + var x = E[0]; +>x : string +>E[0] : string +>E : typeof E +} diff --git a/tests/baselines/reference/indexSignaturesInferentialTyping.types b/tests/baselines/reference/indexSignaturesInferentialTyping.types new file mode 100644 index 00000000000..3c16db3a2bf --- /dev/null +++ b/tests/baselines/reference/indexSignaturesInferentialTyping.types @@ -0,0 +1,47 @@ +=== tests/cases/compiler/indexSignaturesInferentialTyping.ts === +function foo(items: { [index: number]: T }): T { return undefined; } +>foo : (items: { [x: number]: T; }) => T +>T : T +>items : { [x: number]: T; } +>index : number +>T : T +>T : T +>undefined : undefined + +function bar(items: { [index: string]: T }): T { return undefined; } +>bar : (items: { [x: string]: T; }) => T +>T : T +>items : { [x: string]: T; } +>index : string +>T : T +>T : T +>undefined : undefined + +var x1 = foo({ 0: 0, 1: 1 }); // type should be number +>x1 : number +>foo({ 0: 0, 1: 1 }) : number +>foo : (items: { [x: number]: T; }) => T +>{ 0: 0, 1: 1 } : { [x: number]: number; 0: number; 1: number; } + +var x2 = foo({ zero: 0, one: 1 }); +>x2 : {} +>foo({ zero: 0, one: 1 }) : {} +>foo : (items: { [x: number]: T; }) => T +>{ zero: 0, one: 1 } : { [x: number]: {}; zero: number; one: number; } +>zero : number +>one : number + +var x3 = bar({ 0: 0, 1: 1 }); +>x3 : number +>bar({ 0: 0, 1: 1 }) : number +>bar : (items: { [x: string]: T; }) => T +>{ 0: 0, 1: 1 } : { [x: string]: number; 0: number; 1: number; } + +var x4 = bar({ zero: 0, one: 1 }); // type should be number +>x4 : number +>bar({ zero: 0, one: 1 }) : number +>bar : (items: { [x: string]: T; }) => T +>{ zero: 0, one: 1 } : { [x: string]: number; zero: number; one: number; } +>zero : number +>one : number + diff --git a/tests/baselines/reference/indexer.types b/tests/baselines/reference/indexer.types new file mode 100644 index 00000000000..236113cfaa8 --- /dev/null +++ b/tests/baselines/reference/indexer.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/indexer.ts === +interface JQueryElement { +>JQueryElement : JQueryElement + + id:string; +>id : string +} + +interface JQuery { +>JQuery : JQuery + + [n:number]:JQueryElement; +>n : number +>JQueryElement : JQueryElement +} + +var jq:JQuery={ 0: { id : "a" }, 1: { id : "b" } }; +>jq : JQuery +>JQuery : JQuery +>{ 0: { id : "a" }, 1: { id : "b" } } : { [x: number]: JQueryElement; 0: { id: string; }; 1: { id: string; }; } +>{ id : "a" } : { id: string; } +>id : string +>{ id : "b" } : { id: string; } +>id : string + +jq[0].id; +>jq[0].id : string +>jq[0] : JQueryElement +>jq : JQuery +>id : string + diff --git a/tests/baselines/reference/indexer2.types b/tests/baselines/reference/indexer2.types new file mode 100644 index 00000000000..498ade679a8 --- /dev/null +++ b/tests/baselines/reference/indexer2.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/indexer2.ts === +interface IHeapObjectProperty {} +>IHeapObjectProperty : IHeapObjectProperty + +interface IDirectChildrenMap { +>IDirectChildrenMap : IDirectChildrenMap + + hasOwnProperty(objectId: number) : boolean; +>hasOwnProperty : (objectId: number) => boolean +>objectId : number + + [objectId: number] : IHeapObjectProperty[]; +>objectId : number +>IHeapObjectProperty : IHeapObjectProperty +} +var directChildrenMap = {}; +>directChildrenMap : IDirectChildrenMap +>{} : IDirectChildrenMap +>IDirectChildrenMap : IDirectChildrenMap +>{} : { [x: number]: IHeapObjectProperty[]; } + diff --git a/tests/baselines/reference/indexer3.types b/tests/baselines/reference/indexer3.types new file mode 100644 index 00000000000..2b23ac85885 --- /dev/null +++ b/tests/baselines/reference/indexer3.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/indexer3.ts === +var dateMap: { [x: string]: Date; } = {} +>dateMap : { [x: string]: Date; } +>x : string +>Date : Date +>{} : { [x: string]: Date; } + +var r: Date = dateMap["hello"] // result type includes indexer using BCT +>r : Date +>Date : Date +>dateMap["hello"] : Date +>dateMap : { [x: string]: Date; } + diff --git a/tests/baselines/reference/indexerA.types b/tests/baselines/reference/indexerA.types new file mode 100644 index 00000000000..7b409ecedc0 --- /dev/null +++ b/tests/baselines/reference/indexerA.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/indexerA.ts === +class JQueryElement { +>JQueryElement : JQueryElement + + id:string; +>id : string +} + +class JQuery { +>JQuery : JQuery + + [n:number]:JQueryElement +>n : number +>JQueryElement : JQueryElement +} + +var jq:JQuery={ 0: { id : "a" }, 1: { id : "b" } }; +>jq : JQuery +>JQuery : JQuery +>{ 0: { id : "a" }, 1: { id : "b" } } : { [x: number]: JQueryElement; 0: { id: string; }; 1: { id: string; }; } +>{ id : "a" } : { id: string; } +>id : string +>{ id : "b" } : { id: string; } +>id : string + +jq[0].id; +>jq[0].id : string +>jq[0] : JQueryElement +>jq : JQuery +>id : string + diff --git a/tests/baselines/reference/indexerReturningTypeParameter1.types b/tests/baselines/reference/indexerReturningTypeParameter1.types new file mode 100644 index 00000000000..55155323c84 --- /dev/null +++ b/tests/baselines/reference/indexerReturningTypeParameter1.types @@ -0,0 +1,44 @@ +=== tests/cases/compiler/indexerReturningTypeParameter1.ts === +interface f { +>f : f + + groupBy(): { [key: string]: T[]; }; +>groupBy : () => { [x: string]: T[]; } +>T : T +>key : string +>T : T +} +var a: f; +>a : f +>f : f + +var r = a.groupBy(); +>r : { [x: string]: {}[]; } +>a.groupBy() : { [x: string]: {}[]; } +>a.groupBy : () => { [x: string]: T[]; } +>a : f +>groupBy : () => { [x: string]: T[]; } + +class c { +>c : c + + groupBy(): { [key: string]: T[]; } { +>groupBy : () => { [x: string]: T[]; } +>T : T +>key : string +>T : T + + return null; + } +} +var a2: c; +>a2 : c +>c : c + +var r2 = a2.groupBy(); +>r2 : { [x: string]: {}[]; } +>a2.groupBy() : { [x: string]: {}[]; } +>a2.groupBy : () => { [x: string]: T[]; } +>a2 : c +>groupBy : () => { [x: string]: T[]; } + diff --git a/tests/baselines/reference/indexersInClassType.types b/tests/baselines/reference/indexersInClassType.types new file mode 100644 index 00000000000..afc21b9ce8a --- /dev/null +++ b/tests/baselines/reference/indexersInClassType.types @@ -0,0 +1,49 @@ +=== tests/cases/conformance/classes/members/classTypes/indexersInClassType.ts === +class C { +>C : C + + [x: number]: Date; +>x : number +>Date : Date + + [x: string]: Object; +>x : string +>Object : Object + + 1: Date; +>Date : Date + + 'a': {} + + fn() { +>fn : () => C + + return this; +>this : C + } +} + +var c = new C(); +>c : C +>new C() : C +>C : typeof C + +var r = c.fn(); +>r : C +>c.fn() : C +>c.fn : () => C +>c : C +>fn : () => C + +var r2 = r[1]; +>r2 : Date +>r[1] : Date +>r : C + +var r3 = r.a +>r3 : {} +>r.a : {} +>r : C +>a : {} + + diff --git a/tests/baselines/reference/inferSecondaryParameter.types b/tests/baselines/reference/inferSecondaryParameter.types new file mode 100644 index 00000000000..9831fe89e5b --- /dev/null +++ b/tests/baselines/reference/inferSecondaryParameter.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/inferSecondaryParameter.ts === +// type inference on 'bug' should give 'any' + +interface Ib { m(test: string, fn: Function); } +>Ib : Ib +>m : (test: string, fn: Function) => any +>test : string +>fn : Function +>Function : Function + +var b: Ib = { m: function (test: string, fn: Function) { } }; +>b : Ib +>Ib : Ib +>{ m: function (test: string, fn: Function) { } } : { m: (test: string, fn: Function) => void; } +>m : (test: string, fn: Function) => void +>function (test: string, fn: Function) { } : (test: string, fn: Function) => void +>test : string +>fn : Function +>Function : Function + +b.m("test", function (bug) { +>b.m("test", function (bug) { + var a: number = bug; +}) : any +>b.m : (test: string, fn: Function) => any +>b : Ib +>m : (test: string, fn: Function) => any +>function (bug) { + var a: number = bug; +} : (bug: any) => void +>bug : any + + var a: number = bug; +>a : number +>bug : any + +}); diff --git a/tests/baselines/reference/inferTypeArgumentsInSignatureWithRestParameters.types b/tests/baselines/reference/inferTypeArgumentsInSignatureWithRestParameters.types new file mode 100644 index 00000000000..5bf41c64b24 --- /dev/null +++ b/tests/baselines/reference/inferTypeArgumentsInSignatureWithRestParameters.types @@ -0,0 +1,51 @@ +=== tests/cases/compiler/inferTypeArgumentsInSignatureWithRestParameters.ts === +function f(array: T[], ...args) { } +>f : (array: T[], ...args: any[]) => void +>T : T +>array : T[] +>T : T +>args : any[] + +function g(array: number[], ...args) { } +>g : (array: number[], ...args: any[]) => void +>array : number[] +>args : any[] + +function h(nonarray: T, ...args) { } +>h : (nonarray: T, ...args: any[]) => void +>T : T +>nonarray : T +>T : T +>args : any[] + +function i(array: T[], opt?: any[]) { } +>i : (array: T[], opt?: any[]) => void +>T : T +>array : T[] +>T : T +>opt : any[] + +var a = [1, 2, 3, 4, 5]; +>a : number[] +>[1, 2, 3, 4, 5] : number[] + +f(a); // OK +>f(a) : void +>f : (array: T[], ...args: any[]) => void +>a : number[] + +g(a); // OK +>g(a) : void +>g : (array: number[], ...args: any[]) => void +>a : number[] + +h(a); // OK +>h(a) : void +>h : (nonarray: T, ...args: any[]) => void +>a : number[] + +i(a); // OK +>i(a) : void +>i : (array: T[], opt?: any[]) => void +>a : number[] + diff --git a/tests/baselines/reference/inferentialTypingWithFunctionType.types b/tests/baselines/reference/inferentialTypingWithFunctionType.types new file mode 100644 index 00000000000..9f1986c49ea --- /dev/null +++ b/tests/baselines/reference/inferentialTypingWithFunctionType.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/inferentialTypingWithFunctionType.ts === +declare function map(x: T, f: (s: T) => U): U; +>map : (x: T, f: (s: T) => U) => U +>T : T +>U : U +>x : T +>T : T +>f : (s: T) => U +>s : T +>T : T +>U : U +>U : U + +declare function identity(y: V): V; +>identity : (y: V) => V +>V : V +>y : V +>V : V +>V : V + +var s = map("", identity); +>s : string +>map("", identity) : string +>map : (x: T, f: (s: T) => U) => U +>identity : (y: V) => V + diff --git a/tests/baselines/reference/inferentialTypingWithFunctionType2.types b/tests/baselines/reference/inferentialTypingWithFunctionType2.types new file mode 100644 index 00000000000..a97bf2ab36c --- /dev/null +++ b/tests/baselines/reference/inferentialTypingWithFunctionType2.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/inferentialTypingWithFunctionType2.ts === +function identity(a: A): A { +>identity : (a: A) => A +>A : A +>a : A +>A : A +>A : A + + return a; +>a : A +} +var x = [1, 2, 3].map(identity)[0]; +>x : number +>[1, 2, 3].map(identity)[0] : number +>[1, 2, 3].map(identity) : number[] +>[1, 2, 3].map : (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[] +>[1, 2, 3] : number[] +>map : (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[] +>identity : (a: A) => A + diff --git a/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.types b/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.types new file mode 100644 index 00000000000..7628e9c4a9d --- /dev/null +++ b/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/inferentialTypingWithFunctionTypeNested.ts === +declare function map(x: T, f: () => { x: (s: T) => U }): U; +>map : (x: T, f: () => { x: (s: T) => U; }) => U +>T : T +>U : U +>x : T +>T : T +>f : () => { x: (s: T) => U; } +>x : (s: T) => U +>s : T +>T : T +>U : U +>U : U + +declare function identity(y: V): V; +>identity : (y: V) => V +>V : V +>y : V +>V : V +>V : V + +var s = map("", () => { return { x: identity }; }); +>s : any +>map("", () => { return { x: identity }; }) : any +>map : (x: T, f: () => { x: (s: T) => U; }) => U +>() => { return { x: identity }; } : () => { x: (y: V) => V; } +>{ x: identity } : { x: (y: V) => V; } +>x : (y: V) => V +>identity : identity + diff --git a/tests/baselines/reference/inferentialTypingWithFunctionTypeSyntacticScenarios.types b/tests/baselines/reference/inferentialTypingWithFunctionTypeSyntacticScenarios.types new file mode 100644 index 00000000000..ac3d69b9b7d --- /dev/null +++ b/tests/baselines/reference/inferentialTypingWithFunctionTypeSyntacticScenarios.types @@ -0,0 +1,120 @@ +=== tests/cases/compiler/inferentialTypingWithFunctionTypeSyntacticScenarios.ts === +declare function map(array: T, func: (x: T) => U): U; +>map : (array: T, func: (x: T) => U) => U +>T : T +>U : U +>array : T +>T : T +>func : (x: T) => U +>x : T +>T : T +>U : U +>U : U + +declare function identity(y: V): V; +>identity : (y: V) => V +>V : V +>y : V +>V : V +>V : V + +var s: string; +>s : string + +// dotted name +var dottedIdentity = { x: identity }; +>dottedIdentity : { x: (y: V) => V; } +>{ x: identity } : { x: (y: V) => V; } +>x : (y: V) => V +>identity : identity + +s = map("", dottedIdentity.x); +>s = map("", dottedIdentity.x) : string +>s : string +>map("", dottedIdentity.x) : string +>map : (array: T, func: (x: T) => U) => U +>dottedIdentity.x : (y: V) => V +>dottedIdentity : { x: (y: V) => V; } +>x : (y: V) => V + +// index expression +s = map("", dottedIdentity['x']); +>s = map("", dottedIdentity['x']) : string +>s : string +>map("", dottedIdentity['x']) : string +>map : (array: T, func: (x: T) => U) => U +>dottedIdentity['x'] : (y: V) => V +>dottedIdentity : { x: (y: V) => V; } + +// function call +s = map("", (() => identity)()); +>s = map("", (() => identity)()) : string +>s : string +>map("", (() => identity)()) : string +>map : (array: T, func: (x: T) => U) => U +>(() => identity)() : (y: V) => V +>(() => identity) : () => (y: V) => V +>() => identity : () => (y: V) => V +>identity : (y: V) => V + +// construct +interface IdentityConstructor { +>IdentityConstructor : IdentityConstructor + + new (): typeof identity; +>identity : (y: V) => V +} +var ic: IdentityConstructor; +>ic : IdentityConstructor +>IdentityConstructor : IdentityConstructor + +s = map("", new ic()); +>s = map("", new ic()) : string +>s : string +>map("", new ic()) : string +>map : (array: T, func: (x: T) => U) => U +>new ic() : (y: V) => V +>ic : IdentityConstructor + +// assignment +var t; +>t : any + +s = map("", t = identity); +>s = map("", t = identity) : string +>s : string +>map("", t = identity) : string +>map : (array: T, func: (x: T) => U) => U +>t = identity : (y: V) => V +>t : any +>identity : (y: V) => V + +// type assertion +s = map("", identity); +>s = map("", identity) : string +>s : string +>map("", identity) : string +>map : (array: T, func: (x: T) => U) => U +>identity : (y: V) => V +>identity : (y: V) => V +>identity : (y: V) => V + +// parenthesized expression +s = map("", (identity)); +>s = map("", (identity)) : string +>s : string +>map("", (identity)) : string +>map : (array: T, func: (x: T) => U) => U +>(identity) : (y: V) => V +>identity : (y: V) => V + +// comma +s = map("", ("", identity)); +>s = map("", ("", identity)) : string +>s : string +>map("", ("", identity)) : string +>map : (array: T, func: (x: T) => U) => U +>("", identity) : (y: V) => V +>"", identity : (y: V) => V +>identity : (y: V) => V + diff --git a/tests/baselines/reference/inferentialTypingWithFunctionTypeZip.types b/tests/baselines/reference/inferentialTypingWithFunctionTypeZip.types new file mode 100644 index 00000000000..11e017d6661 --- /dev/null +++ b/tests/baselines/reference/inferentialTypingWithFunctionTypeZip.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/inferentialTypingWithFunctionTypeZip.ts === +var pair: (x: T) => (y: S) => { x: T; y: S; } +>pair : (x: T) => (y: S) => { x: T; y: S; } +>T : T +>S : S +>x : T +>T : T +>y : S +>S : S +>x : T +>T : T +>y : S +>S : S + +var zipWith: (a: T[], b: S[], f: (x: T) => (y: S) => U) => U[]; +>zipWith : (a: T[], b: S[], f: (x: T) => (y: S) => U) => U[] +>T : T +>S : S +>U : U +>a : T[] +>T : T +>b : S[] +>S : S +>f : (x: T) => (y: S) => U +>x : T +>T : T +>y : S +>S : S +>U : U +>U : U + +var result = zipWith([1, 2], ['a', 'b'], pair); +>result : { x: number; y: {}; }[] +>zipWith([1, 2], ['a', 'b'], pair) : { x: number; y: {}; }[] +>zipWith : (a: T[], b: S[], f: (x: T) => (y: S) => U) => U[] +>[1, 2] : number[] +>['a', 'b'] : {}[] +>pair : (x: T) => (y: S) => { x: T; y: S; } + +var i = result[0].x; // number +>i : number +>result[0].x : number +>result[0] : { x: number; y: {}; } +>result : { x: number; y: {}; }[] +>x : number + diff --git a/tests/baselines/reference/inferentiallyTypingAnEmptyArray.types b/tests/baselines/reference/inferentiallyTypingAnEmptyArray.types new file mode 100644 index 00000000000..c8f51c985e6 --- /dev/null +++ b/tests/baselines/reference/inferentiallyTypingAnEmptyArray.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/inferentiallyTypingAnEmptyArray.ts === +// April 2014, Section 4.6: +// In the absence of a contextual type, the type of an array literal is C[], where C is the +// Undefined type(section 3.2.6) if the array literal is empty, or the best common type of +// the element expressions if the array literal is not empty. +// When an array literal is contextually typed(section 4.19) by an object type containing a +// numeric index signature of type T, each element expression is contextually typed by T and +// the type of the array literal is the best common type of T and the types of the element +// expressions. +// +// While the spec does not say it, an inferential type causes an empty array literal to have +// the undefined[] type. In other words, the first clause from the excerpt above applies even +// though there is a "contextual type" present. This is the intention, even though the spec +// seems to imply the contrary. +// Therefore, the following access to bar should not cause an error because we infer +// the undefined[] type. +declare function foo(arr: T[]): T; +>foo : (arr: T[]) => T +>T : T +>arr : T[] +>T : T +>T : T + +foo([]).bar; +>foo([]).bar : any +>foo([]) : any +>foo : (arr: T[]) => T +>[] : any[] +>bar : any + diff --git a/tests/baselines/reference/infiniteExpandingTypeThroughInheritanceInstantiation.types b/tests/baselines/reference/infiniteExpandingTypeThroughInheritanceInstantiation.types new file mode 100644 index 00000000000..65b4e1862e0 --- /dev/null +++ b/tests/baselines/reference/infiniteExpandingTypeThroughInheritanceInstantiation.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/infiniteExpandingTypeThroughInheritanceInstantiation.ts === +interface A +>A : A +>T : T +{ + x: A> +>x : A> +>A : A +>B : B +>T : T +} + +interface B extends A // error +>B : B +>T : T +>A : A +>T : T +{ + x: B> +>x : B> +>B : B +>A : A +>T : T +} + diff --git a/tests/baselines/reference/infiniteExpansionThroughTypeInference.types b/tests/baselines/reference/infiniteExpansionThroughTypeInference.types new file mode 100644 index 00000000000..8ef6cc60d2e --- /dev/null +++ b/tests/baselines/reference/infiniteExpansionThroughTypeInference.types @@ -0,0 +1,30 @@ +=== tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansionThroughTypeInference.ts === +interface G { +>G : G +>T : T + + x: G> // infinitely expanding type reference +>x : G> +>G : G +>G : G +>T : T + + y: T +>y : T +>T : T +} + +function ff(g: G): void { +>ff : (g: G) => void +>T : T +>g : G +>G : G +>T : T + + ff(g) // when infering T here we need to make sure to not descend into the structure of G infinitely +>ff(g) : void +>ff : (g: G) => void +>g : G +} + + diff --git a/tests/baselines/reference/infinitelyExpandingBaseTypes1.types b/tests/baselines/reference/infinitelyExpandingBaseTypes1.types new file mode 100644 index 00000000000..d53afa0b5b1 --- /dev/null +++ b/tests/baselines/reference/infinitelyExpandingBaseTypes1.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/infinitelyExpandingBaseTypes1.ts === +interface A +>A : A +>T : T +{ + x : A> +>x : A> +>A : A +>A : A +>T : T +} + +interface B +>B : B +>T : T +{ + x : B +>x : B +>B : B +>T : T +} + +interface C extends A, B { } +>C : C +>T : T +>A : A +>T : T +>B : B +>T : T + + + diff --git a/tests/baselines/reference/infinitelyExpandingBaseTypes2.types b/tests/baselines/reference/infinitelyExpandingBaseTypes2.types new file mode 100644 index 00000000000..6ac75868829 --- /dev/null +++ b/tests/baselines/reference/infinitelyExpandingBaseTypes2.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/infinitelyExpandingBaseTypes2.ts === +interface A +>A : A +>T : T +{ + x : A<()=>T> +>x : A<() => T> +>A : A +>T : T +} + +interface B +>B : B +>T : T +{ + x : B<()=>T> +>x : B<() => T> +>B : B +>T : T +} + +var a: A +>a : A +>A : A + +var b: B = a +>b : B +>B : B +>a : A + diff --git a/tests/baselines/reference/infinitelyExpandingTypeAssignability.types b/tests/baselines/reference/infinitelyExpandingTypeAssignability.types new file mode 100644 index 00000000000..d3deb38aeb4 --- /dev/null +++ b/tests/baselines/reference/infinitelyExpandingTypeAssignability.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/infinitelyExpandingTypeAssignability.ts === +interface A { +>A : A +>T : T + + x : T +>x : T +>T : T +} + +interface B extends A>>> { } +>B : B +>T : T +>A : A +>B : B +>B : B +>B : B +>T : T + +interface C extends A>>> { } +>C : C +>T : T +>A : A +>C : C +>C : C +>C : C +>T : T + +var x : B +>x : B +>B : B + +var y : C = x +>y : C +>C : C +>x : B + diff --git a/tests/baselines/reference/infinitelyExpandingTypes3.types b/tests/baselines/reference/infinitelyExpandingTypes3.types new file mode 100644 index 00000000000..2836a9b5dbd --- /dev/null +++ b/tests/baselines/reference/infinitelyExpandingTypes3.types @@ -0,0 +1,55 @@ +=== tests/cases/compiler/infinitelyExpandingTypes3.ts === +interface List { +>List : List +>T : T + + data: T; +>data : T +>T : T + + next: List; // will be recursive reference when OwnerList is expanded +>next : List +>List : List +>T : T + + owner: OwnerList; +>owner : OwnerList +>OwnerList : OwnerList +>T : T +} + +interface OwnerList extends List> { +>OwnerList : OwnerList +>U : U +>List : List +>List : List +>U : U + + name: string; +>name : string +} + +interface OwnerList2 extends List> { +>OwnerList2 : OwnerList2 +>U : U +>List : List +>List : List +>U : U + + name: string; +>name : string +} + +var o1: OwnerList; +>o1 : OwnerList +>OwnerList : OwnerList + +var o2: OwnerList2; +>o2 : OwnerList2 +>OwnerList2 : OwnerList2 + +o1 = o2; // should not error +>o1 = o2 : OwnerList2 +>o1 : OwnerList +>o2 : OwnerList2 + diff --git a/tests/baselines/reference/infinitelyExpandingTypes4.types b/tests/baselines/reference/infinitelyExpandingTypes4.types new file mode 100644 index 00000000000..17aefd34f99 --- /dev/null +++ b/tests/baselines/reference/infinitelyExpandingTypes4.types @@ -0,0 +1,75 @@ +=== tests/cases/compiler/infinitelyExpandingTypes4.ts === +interface Query { +>Query : Query +>T : T + + // ... + groupBy(keySelector: (item: T) => K): Query>; +>groupBy : (keySelector: (item: T) => K) => Query> +>K : K +>keySelector : (item: T) => K +>item : T +>T : T +>K : K +>Query : Query +>Grouping : Grouping +>K : K +>T : T + + // ... +} + +interface QueryEnumerator { +>QueryEnumerator : QueryEnumerator +>T : T + + // ... + groupBy(keySelector: (item: T) => K): QueryEnumerator>; +>groupBy : (keySelector: (item: T) => K) => QueryEnumerator> +>K : K +>keySelector : (item: T) => K +>item : T +>T : T +>K : K +>QueryEnumerator : QueryEnumerator +>Grouping : Grouping +>K : K +>T : T + + // ... +} + +interface Grouping extends Query { +>Grouping : Grouping +>K : K +>T : T +>Query : Query +>T : T + + key(): K; +>key : () => K +>K : K +} + +var q1: Query; +>q1 : Query +>Query : Query + +var q2: QueryEnumerator; +>q2 : QueryEnumerator +>QueryEnumerator : QueryEnumerator + +var q3: Query; +>q3 : Query +>Query : Query + +q1 = q2; // should error +>q1 = q2 : QueryEnumerator +>q1 : Query +>q2 : QueryEnumerator + +q1 = q3; // should not error +>q1 = q3 : Query +>q1 : Query +>q3 : Query + diff --git a/tests/baselines/reference/infinitelyExpandingTypes5.types b/tests/baselines/reference/infinitelyExpandingTypes5.types new file mode 100644 index 00000000000..d0d0420ab90 --- /dev/null +++ b/tests/baselines/reference/infinitelyExpandingTypes5.types @@ -0,0 +1,49 @@ +=== tests/cases/compiler/infinitelyExpandingTypes5.ts === +interface Query { +>Query : Query +>T : T + + foo(x: T): Query; +>foo : (x: T) => Query +>x : T +>T : T +>Query : Query +>T : T +} + +interface Enumerator { +>Enumerator : Enumerator +>T : T + + (action: (item: T, index: number) => boolean): boolean; +>action : (item: T, index: number) => boolean +>item : T +>T : T +>index : number +} + +function from(array: T[]): Query; +>from : { (array: T[]): Query; (enumerator: Enumerator): Query; } +>T : T +>array : T[] +>T : T +>Query : Query +>T : T + +function from(enumerator: Enumerator): Query; +>from : { (array: T[]): Query; (enumerator: Enumerator): Query; } +>T : T +>enumerator : Enumerator +>Enumerator : Enumerator +>T : T +>Query : Query +>T : T + +function from(arg: any): any { +>from : { (array: T[]): Query; (enumerator: Enumerator): Query; } +>arg : any + + return undefined; +>undefined : undefined +} + diff --git a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.types b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.types new file mode 100644 index 00000000000..bd70c1b8a77 --- /dev/null +++ b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.types @@ -0,0 +1,56 @@ +=== tests/cases/compiler/infinitelyExpandingTypesNonGenericBase.ts === +class Functionality { +>Functionality : Functionality +>V : V + + property: Options; +>property : Options +>Options : Options +>V : V +} + +class Base { +>Base : Base +} + +class A extends Base { +>A : A +>T : T +>Base : Base + + options: Options[]>; +>options : Options[]> +>Options : Options +>Functionality : Functionality +>T : T +} + +interface OptionsBase { +>OptionsBase : OptionsBase +>T : T + + Options: Options; +>Options : Options +>Options : Options +>T : T +} + +interface Options extends OptionsBase { +>Options : Options +>T : T +>OptionsBase : OptionsBase +>T : T +} + + +function o(type: new () => Base) { +>o : (type: new () => Base) => void +>type : new () => Base +>Base : Base +} + +o(A); +>o(A) : void +>o : (type: new () => Base) => void +>A : typeof A + diff --git a/tests/baselines/reference/infinitelyGenerativeInheritance1.types b/tests/baselines/reference/infinitelyGenerativeInheritance1.types new file mode 100644 index 00000000000..024ee04baad --- /dev/null +++ b/tests/baselines/reference/infinitelyGenerativeInheritance1.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/infinitelyGenerativeInheritance1.ts === +interface Stack { +>Stack : Stack +>T : T + + pop(): T +>pop : () => T +>T : T + + zip(a: Stack): Stack<{ x: T; y: S }> +>zip : (a: Stack) => Stack<{ x: T; y: S; }> +>S : S +>a : Stack +>Stack : Stack +>S : S +>Stack : Stack +>x : T +>T : T +>y : S +>S : S +} + +interface MyStack extends Stack { +>MyStack : MyStack +>T : T +>Stack : Stack +>T : T + + zip(a: Stack): Stack<{ x: T; y: S }> +>zip : (a: Stack) => Stack<{ x: T; y: S; }> +>S : S +>a : Stack +>Stack : Stack +>S : S +>Stack : Stack +>x : T +>T : T +>y : S +>S : S +} + diff --git a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.types b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.types new file mode 100644 index 00000000000..e8f05ca474d --- /dev/null +++ b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/inheritSameNamePrivatePropertiesFromSameOrigin.ts === +class B { +>B : B + + private x: number; +>x : number +} +class C extends B { } +>C : C +>B : B + +class C2 extends B { } +>C2 : C2 +>B : B + +interface A extends C, C2 { // ok +>A : A +>C : C +>C2 : C2 + + y: string; +>y : string +} diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.types b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.types new file mode 100644 index 00000000000..e30d307e943 --- /dev/null +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/inheritanceMemberFuncOverridingMethod.ts === +class a { +>a : a + + x() { +>x : () => string + + return "10"; + } +} + +class b extends a { +>b : b +>a : a + + x() { +>x : () => string + + return "20"; + } +} diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.types b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.types new file mode 100644 index 00000000000..d5f846187f8 --- /dev/null +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/inheritanceMemberPropertyOverridingProperty.ts === +class a { +>a : a + + x: () => string; +>x : () => string +} + +class b extends a { +>b : b +>a : a + + x: () => string; +>x : () => string +} diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.types b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.types new file mode 100644 index 00000000000..7ffd61af7cb --- /dev/null +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/inheritanceOfGenericConstructorMethod1.ts === +class A { } +>A : A +>T : T + +class B extends A {} +>B : B +>T : T +>A : A +>T : T + +var a = new A(); +>a : A +>new A() : A +>A : typeof A +>Date : Date + +var b1 = new B(); // no error +>b1 : B<{}> +>new B() : B<{}> +>B : typeof B + +var b2: B = new B(); // no error +>b2 : B +>B : B +>Date : Date +>new B() : B +>B : typeof B +>Date : Date + +var b3 = new B(); // error, could not select overload for 'new' expression +>b3 : B +>new B() : B +>B : typeof B +>Date : Date + diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.types b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.types new file mode 100644 index 00000000000..85e8e068146 --- /dev/null +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.types @@ -0,0 +1,55 @@ +=== tests/cases/compiler/inheritanceOfGenericConstructorMethod2.ts === +module M { +>M : typeof M + + export class C1 { } +>C1 : C1 + + export class C2 { } +>C2 : C2 +>T : T +} +module N { +>N : typeof N + + export class D1 extends M.C1 { } +>D1 : D1 +>M : M +>C1 : C1 + + export class D2 extends M.C2 { } +>D2 : D2 +>T : T +>M : M +>C2 : C2 +>T : T +} + +var c = new M.C2(); // no error +>c : C2 +>new M.C2() : C2 +>M.C2 : typeof C2 +>M : typeof M +>C2 : typeof C2 + +var n = new N.D1(); // no error +>n : D1 +>new N.D1() : D1 +>N.D1 : typeof D1 +>N : typeof N +>D1 : typeof D1 + +var n2 = new N.D2(); // error +>n2 : D2 +>new N.D2() : D2 +>N.D2 : typeof D2 +>N : typeof N +>D2 : typeof D2 + +var n3 = new N.D2(); // no error, D2 +>n3 : D2<{}> +>new N.D2() : D2<{}> +>N.D2 : typeof D2 +>N : typeof N +>D2 : typeof D2 + diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.types b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.types new file mode 100644 index 00000000000..ec7b3f5bbf9 --- /dev/null +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/inheritanceStaticFuncOverridingMethod.ts === +class a { +>a : a + + static x() { +>x : () => string + + return "10"; + } +} + +class b extends a { +>b : b +>a : a + + static x() { +>x : () => string + + return "20"; + } +} diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.types b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.types new file mode 100644 index 00000000000..842f9ffddf9 --- /dev/null +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/inheritanceStaticFuncOverridingPropertyOfFuncType.ts === +class a { +>a : a + + static x: () => string; +>x : () => string +} + +class b extends a { +>b : b +>a : a + + static x() { +>x : () => string + + return "20"; + } +} diff --git a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.types b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.types new file mode 100644 index 00000000000..4742dde63f6 --- /dev/null +++ b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/inheritanceStaticFunctionOverridingInstanceProperty.ts === +class a { +>a : a + + x: string; +>x : string +} + +class b extends a { +>b : b +>a : a + + static x() { +>x : () => string + + return new b().x; +>new b().x : string +>new b() : b +>b : typeof b +>x : string + } +} diff --git a/tests/baselines/reference/inheritanceStaticMembersCompatible.types b/tests/baselines/reference/inheritanceStaticMembersCompatible.types new file mode 100644 index 00000000000..cab8be93785 --- /dev/null +++ b/tests/baselines/reference/inheritanceStaticMembersCompatible.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/inheritanceStaticMembersCompatible.ts === +class a { +>a : a + + static x: a; +>x : a +>a : a +} + +class b extends a { +>b : b +>a : a + + static x: b; +>x : b +>b : b +} diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.types b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.types new file mode 100644 index 00000000000..958fb6723cc --- /dev/null +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/inheritanceStaticPropertyOverridingProperty.ts === +class a { +>a : a + + static x: () => string; +>x : () => string +} + +class b extends a { +>b : b +>a : a + + static x: () => string; +>x : () => string +} diff --git a/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.types b/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.types new file mode 100644 index 00000000000..c24c0545c3e --- /dev/null +++ b/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/inheritedFunctionAssignmentCompatibility.ts === +interface IResultCallback extends Function { } +>IResultCallback : IResultCallback +>Function : Function + +function fn(cb: IResultCallback) { } +>fn : (cb: IResultCallback) => void +>cb : IResultCallback +>IResultCallback : IResultCallback + +fn((a, b) => true); +>fn((a, b) => true) : void +>fn : (cb: IResultCallback) => void +>(a, b) => true : (a: any, b: any) => boolean +>a : any +>b : any + +fn(function (a, b) { return true; }) +>fn(function (a, b) { return true; }) : void +>fn : (cb: IResultCallback) => void +>function (a, b) { return true; } : (a: any, b: any) => boolean +>a : any +>b : any + + diff --git a/tests/baselines/reference/inheritedGenericCallSignature.types b/tests/baselines/reference/inheritedGenericCallSignature.types new file mode 100644 index 00000000000..0204c75918f --- /dev/null +++ b/tests/baselines/reference/inheritedGenericCallSignature.types @@ -0,0 +1,51 @@ +=== tests/cases/compiler/inheritedGenericCallSignature.ts === + +interface I1 { +>I1 : I1 +>T : T + + (a: T): T; +>a : T +>T : T +>T : T + +} + + +interface Object {} +>Object : Object + + + +interface I2 extends I1 { +>I2 : I2 +>T : T +>I1 : I1 +>T : T + + b: T; +>b : T +>T : T + +} + + + +var x: I2; +>x : I2 +>I2 : I2 +>Date : Date + + + +var y = x(undefined); +>y : Date[] +>x(undefined) : Date[] +>x : I2 +>undefined : undefined + +y.length; // should not error +>y.length : number +>y : Date[] +>length : number + diff --git a/tests/baselines/reference/inheritedMembersAndIndexSignaturesFromDifferentBases2.types b/tests/baselines/reference/inheritedMembersAndIndexSignaturesFromDifferentBases2.types new file mode 100644 index 00000000000..6d927feef1b --- /dev/null +++ b/tests/baselines/reference/inheritedMembersAndIndexSignaturesFromDifferentBases2.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/inheritedMembersAndIndexSignaturesFromDifferentBases2.ts === +interface A { +>A : A +>T : T + + [n: number]: T; +>n : number +>T : T +} + +interface B { +>B : B + + foo: number; +>foo : number +} + +interface C extends B, A { } // Should succeed +>C : C +>B : B +>A : A + diff --git a/tests/baselines/reference/inheritedOverloadedSpecializedSignatures.types b/tests/baselines/reference/inheritedOverloadedSpecializedSignatures.types new file mode 100644 index 00000000000..0284fa4bc43 --- /dev/null +++ b/tests/baselines/reference/inheritedOverloadedSpecializedSignatures.types @@ -0,0 +1,90 @@ +=== tests/cases/compiler/inheritedOverloadedSpecializedSignatures.ts === +interface A { +>A : A + + (key:string):void; +>key : string +} + +interface B extends A { +>B : B +>A : A + + (key:'foo'):string; +>key : 'foo' +} + +var b:B; +>b : B +>B : B + +// Should not error +b('foo').charAt(0); +>b('foo').charAt(0) : string +>b('foo').charAt : (pos: number) => string +>b('foo') : string +>b : B +>charAt : (pos: number) => string + +interface A { +>A : A + + (x: 'A1'): string; +>x : 'A1' + + (x: string): void; +>x : string +} + +interface B extends A { +>B : B +>A : A + + (x: 'B1'): number; +>x : 'B1' +} + +interface A { +>A : A + + (x: 'A2'): boolean; +>x : 'A2' +} + +interface B { +>B : B + + (x: 'B2'): string[]; +>x : 'B2' +} + +var b: B; +>b : B +>B : B + +// non of these lines should error +var x1: string[] = b('B2'); +>x1 : string[] +>b('B2') : string[] +>b : B + +var x2: number = b('B1'); +>x2 : number +>b('B1') : number +>b : B + +var x3: boolean = b('A2'); +>x3 : boolean +>b('A2') : boolean +>b : B + +var x4: string = b('A1'); +>x4 : string +>b('A1') : string +>b : B + +var x5: void = b('A0'); +>x5 : void +>b('A0') : void +>b : B + diff --git a/tests/baselines/reference/initializersWidened.types b/tests/baselines/reference/initializersWidened.types new file mode 100644 index 00000000000..f09d43115c5 --- /dev/null +++ b/tests/baselines/reference/initializersWidened.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/types/typeRelationships/widenedTypes/initializersWidened.ts === +// these are widened to any at the point of assignment + +var x = null; +>x : any + +var y = undefined; +>y : any +>undefined : undefined + diff --git a/tests/baselines/reference/innerAliases2.types b/tests/baselines/reference/innerAliases2.types new file mode 100644 index 00000000000..458f0019831 --- /dev/null +++ b/tests/baselines/reference/innerAliases2.types @@ -0,0 +1,45 @@ +=== tests/cases/compiler/innerAliases2.ts === +module _provider { +>_provider : typeof _provider + + export class UsefulClass { +>UsefulClass : UsefulClass + + public foo() { +>foo : () => void + } + } +} + +module consumer { +>consumer : typeof consumer + + import provider = _provider; +>provider : typeof _provider +>_provider : typeof _provider + + var g:provider.UsefulClass= null; +>g : UsefulClass +>provider : provider +>UsefulClass : UsefulClass + + function use():provider.UsefulClass { +>use : () => UsefulClass +>provider : provider +>UsefulClass : UsefulClass + + var p2:provider.UsefulClass= new provider.UsefulClass(); +>p2 : UsefulClass +>provider : provider +>UsefulClass : UsefulClass +>new provider.UsefulClass() : UsefulClass +>provider.UsefulClass : typeof UsefulClass +>provider : typeof _provider +>UsefulClass : typeof UsefulClass + + return p2; +>p2 : UsefulClass + } +} + + diff --git a/tests/baselines/reference/innerBoundLambdaEmit.types b/tests/baselines/reference/innerBoundLambdaEmit.types new file mode 100644 index 00000000000..f800aeb785d --- /dev/null +++ b/tests/baselines/reference/innerBoundLambdaEmit.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/innerBoundLambdaEmit.ts === +module M { +>M : typeof M + + export class Foo { +>Foo : Foo + } + var bar = () => { }; +>bar : () => void +>() => { } : () => void +} +interface Array { +>Array : T[] +>T : T + + toFoo(): M.Foo +>toFoo : () => Foo +>M : M +>Foo : Foo +} + diff --git a/tests/baselines/reference/innerExtern.types b/tests/baselines/reference/innerExtern.types new file mode 100644 index 00000000000..17ef88427b3 --- /dev/null +++ b/tests/baselines/reference/innerExtern.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/innerExtern.ts === +module A { +>A : typeof A + + export declare module BB { +>BB : typeof BB + + export var Elephant; +>Elephant : any + } + export module B { +>B : typeof B + + export class C { +>C : C + + x = BB.Elephant.X; +>x : any +>BB.Elephant.X : any +>BB.Elephant : any +>BB : typeof BB +>Elephant : any +>X : any + } + } +} + + + diff --git a/tests/baselines/reference/innerFunc.types b/tests/baselines/reference/innerFunc.types new file mode 100644 index 00000000000..8ca9e9d0a0b --- /dev/null +++ b/tests/baselines/reference/innerFunc.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/innerFunc.ts === +function salt() { +>salt : () => number + + function pepper() { return 5;} +>pepper : () => number + + return pepper(); +>pepper() : number +>pepper : () => number +} + +module M { +>M : typeof M + + export function tungsten() { +>tungsten : () => number + + function oxygen() { return 6; }; +>oxygen : () => number + + return oxygen(); +>oxygen() : number +>oxygen : () => number + } +} + diff --git a/tests/baselines/reference/innerOverloads.types b/tests/baselines/reference/innerOverloads.types new file mode 100644 index 00000000000..7168f6161f3 --- /dev/null +++ b/tests/baselines/reference/innerOverloads.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/innerOverloads.ts === + +function outer() { +>outer : () => any + + function inner(x:number); // should work +>inner : { (x: number): any; (x: string): any; } +>x : number + + function inner(x:string); +>inner : { (x: number): any; (x: string): any; } +>x : string + + function inner(a:any) { return a; } +>inner : { (x: number): any; (x: string): any; } +>a : any +>a : any + + return inner(0); +>inner(0) : any +>inner : { (x: number): any; (x: string): any; } +} + +var x = outer(); // should work +>x : any +>outer() : any +>outer : () => any + + diff --git a/tests/baselines/reference/innerTypeArgumentInference.types b/tests/baselines/reference/innerTypeArgumentInference.types new file mode 100644 index 00000000000..1bc46c44efe --- /dev/null +++ b/tests/baselines/reference/innerTypeArgumentInference.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/innerTypeArgumentInference.ts === +interface Generator { (): T; } +>Generator : Generator +>T : T +>T : T + +function Generate(func: Generator): U { +>Generate : (func: Generator) => U +>U : U +>func : Generator +>Generator : Generator +>U : U +>U : U + + return Generate(func); +>Generate(func) : U +>Generate : (func: Generator) => U +>func : Generator +} diff --git a/tests/baselines/reference/innerTypeParameterShadowingOuterOne.types b/tests/baselines/reference/innerTypeParameterShadowingOuterOne.types new file mode 100644 index 00000000000..eb1ffb17217 --- /dev/null +++ b/tests/baselines/reference/innerTypeParameterShadowingOuterOne.types @@ -0,0 +1,77 @@ +=== tests/cases/conformance/types/typeParameters/typeParameterLists/innerTypeParameterShadowingOuterOne.ts === +// inner type parameters shadow outer ones of the same name +// no errors expected + +function f() { +>f : () => void +>T : T +>Date : Date + + function g() { +>g : () => void +>T : T +>Number : Number + + var x: T; +>x : T +>T : T + + x.toFixed(); +>x.toFixed() : string +>x.toFixed : (fractionDigits?: number) => string +>x : T +>toFixed : (fractionDigits?: number) => string + } + var x: T; +>x : T +>T : T + + x.getDate(); +>x.getDate() : number +>x.getDate : () => number +>x : T +>getDate : () => number +} + +function f2() { +>f2 : () => void +>T : T +>Date : Date +>U : U +>Date : Date + + function g() { +>g : () => void +>T : T +>Number : Number +>U : U +>Number : Number + + var x: U; +>x : U +>U : U + + x.toFixed(); +>x.toFixed() : string +>x.toFixed : (fractionDigits?: number) => string +>x : U +>toFixed : (fractionDigits?: number) => string + } + var x: U; +>x : U +>U : U + + x.getDate(); +>x.getDate() : number +>x.getDate : () => number +>x : U +>getDate : () => number +} +//function f2() { +// function g() { +// var x: U; +// x.toFixed(); +// } +// var x: U; +// x.getDate(); +//} diff --git a/tests/baselines/reference/innerTypeParameterShadowingOuterOne2.types b/tests/baselines/reference/innerTypeParameterShadowingOuterOne2.types new file mode 100644 index 00000000000..08e19fe7f1e --- /dev/null +++ b/tests/baselines/reference/innerTypeParameterShadowingOuterOne2.types @@ -0,0 +1,90 @@ +=== tests/cases/conformance/types/typeParameters/typeParameterLists/innerTypeParameterShadowingOuterOne2.ts === +// inner type parameters shadow outer ones of the same name +// no errors expected + +class C { +>C : C +>T : T +>Date : Date + + g() { +>g : () => void +>T : T +>Number : Number + + var x: T; +>x : T +>T : T + + x.toFixed(); +>x.toFixed() : string +>x.toFixed : (fractionDigits?: number) => string +>x : T +>toFixed : (fractionDigits?: number) => string + } + + h() { +>h : () => void + + var x: T; +>x : T +>T : T + + x.getDate(); +>x.getDate() : number +>x.getDate : () => number +>x : T +>getDate : () => number + } +} + +class C2 { +>C2 : C2 +>T : T +>Date : Date +>U : U +>Date : Date + + g() { +>g : () => void +>T : T +>Number : Number +>U : U +>Number : Number + + var x: U; +>x : U +>U : U + + x.toFixed(); +>x.toFixed() : string +>x.toFixed : (fractionDigits?: number) => string +>x : U +>toFixed : (fractionDigits?: number) => string + } + + h() { +>h : () => void + + var x: U; +>x : U +>U : U + + x.getDate(); +>x.getDate() : number +>x.getDate : () => number +>x : U +>getDate : () => number + } +} +//class C2 { +// g() { +// var x: U; +// x.toFixed(); +// } + +// h() { +// var x: U; +// x.getDate(); +// } +//} diff --git a/tests/baselines/reference/instanceAndStaticDeclarations1.types b/tests/baselines/reference/instanceAndStaticDeclarations1.types new file mode 100644 index 00000000000..c80cf78e37a --- /dev/null +++ b/tests/baselines/reference/instanceAndStaticDeclarations1.types @@ -0,0 +1,65 @@ +=== tests/cases/compiler/instanceAndStaticDeclarations1.ts === +// from spec + +class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + + public distance(p: Point) { +>distance : (p: Point) => number +>p : Point +>Point : Point + + var dx = this.x - p.x; +>dx : number +>this.x - p.x : number +>this.x : number +>this : Point +>x : number +>p.x : number +>p : Point +>x : number + + var dy = this.y - p.y; +>dy : number +>this.y - p.y : number +>this.y : number +>this : Point +>y : number +>p.y : number +>p : Point +>y : number + + return Math.sqrt(dx * dx + dy * dy); +>Math.sqrt(dx * dx + dy * dy) : number +>Math.sqrt : (x: number) => number +>Math : Math +>sqrt : (x: number) => number +>dx * dx + dy * dy : number +>dx * dx : number +>dx : number +>dx : number +>dy * dy : number +>dy : number +>dy : number + } + static origin = new Point(0, 0); +>origin : Point +>new Point(0, 0) : Point +>Point : typeof Point + + static distance(p1: Point, p2: Point) { return p1.distance(p2); } +>distance : (p1: Point, p2: Point) => number +>p1 : Point +>Point : Point +>p2 : Point +>Point : Point +>p1.distance(p2) : number +>p1.distance : (p: Point) => number +>p1 : Point +>distance : (p: Point) => number +>p2 : Point +} diff --git a/tests/baselines/reference/instanceMemberInitialization.types b/tests/baselines/reference/instanceMemberInitialization.types new file mode 100644 index 00000000000..5e9d7df3706 --- /dev/null +++ b/tests/baselines/reference/instanceMemberInitialization.types @@ -0,0 +1,34 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberInitialization.ts === +class C { +>C : C + + x = 1; +>x : number +} + +var c = new C(); +>c : C +>new C() : C +>C : typeof C + +c.x = 3; +>c.x = 3 : number +>c.x : number +>c : C +>x : number + +var c2 = new C(); +>c2 : C +>new C() : C +>C : typeof C + +var r = c.x === c2.x; +>r : boolean +>c.x === c2.x : boolean +>c.x : number +>c : C +>x : number +>c2.x : number +>c2 : C +>x : number + diff --git a/tests/baselines/reference/instanceOfInExternalModules.types b/tests/baselines/reference/instanceOfInExternalModules.types new file mode 100644 index 00000000000..35594ac2d7b --- /dev/null +++ b/tests/baselines/reference/instanceOfInExternalModules.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/instanceOfInExternalModules_1.ts === +/// +import Bar = require("instanceOfInExternalModules_require"); +>Bar : typeof "tests/cases/compiler/instanceOfInExternalModules_require" + +function IsFoo(value: any): boolean { +>IsFoo : (value: any) => boolean +>value : any + + return value instanceof Bar.Foo; +>value instanceof Bar.Foo : boolean +>value : any +>Bar.Foo : typeof Foo +>Bar : typeof "tests/cases/compiler/instanceOfInExternalModules_require" +>Foo : typeof Foo +} + +=== tests/cases/compiler/instanceOfInExternalModules_require.ts === +export class Foo { foo: string; } +>Foo : Foo +>foo : string + diff --git a/tests/baselines/reference/instanceSubtypeCheck1.types b/tests/baselines/reference/instanceSubtypeCheck1.types new file mode 100644 index 00000000000..154c608dda4 --- /dev/null +++ b/tests/baselines/reference/instanceSubtypeCheck1.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/instanceSubtypeCheck1.ts === +interface A +>A : A +>T : T +{ + x: A> +>x : A> +>A : A +>B : B +>T : T +} + +interface B extends A +>B : B +>T : T +>A : A +>T : T +{ + x: B> +>x : B> +>B : B +>A : A +>T : T +} diff --git a/tests/baselines/reference/instanceofOperatorWithAny.types b/tests/baselines/reference/instanceofOperatorWithAny.types new file mode 100644 index 00000000000..e53aa2d75ca --- /dev/null +++ b/tests/baselines/reference/instanceofOperatorWithAny.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithAny.ts === +var a: any; +>a : any + +var r: boolean = a instanceof a; +>r : boolean +>a instanceof a : boolean +>a : any +>a : any + diff --git a/tests/baselines/reference/instanceofOperatorWithLHSIsObject.types b/tests/baselines/reference/instanceofOperatorWithLHSIsObject.types new file mode 100644 index 00000000000..26aea98028e --- /dev/null +++ b/tests/baselines/reference/instanceofOperatorWithLHSIsObject.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithLHSIsObject.ts === +class C { } +>C : C + +var x1: any; +>x1 : any + +var x2: Function; +>x2 : Function +>Function : Function + +var a: {}; +>a : {} + +var b: Object; +>b : Object +>Object : Object + +var c: C; +>c : C +>C : C + +var r1 = a instanceof x1; +>r1 : boolean +>a instanceof x1 : boolean +>a : {} +>x1 : any + +var r2 = b instanceof x2; +>r2 : boolean +>b instanceof x2 : boolean +>b : Object +>x2 : Function + +var r3 = c instanceof x1; +>r3 : boolean +>c instanceof x1 : boolean +>c : C +>x1 : any + diff --git a/tests/baselines/reference/instanceofOperatorWithLHSIsTypeParameter.types b/tests/baselines/reference/instanceofOperatorWithLHSIsTypeParameter.types new file mode 100644 index 00000000000..d10c6c5cafa --- /dev/null +++ b/tests/baselines/reference/instanceofOperatorWithLHSIsTypeParameter.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithLHSIsTypeParameter.ts === +function foo(t: T) { +>foo : (t: T) => void +>T : T +>t : T +>T : T + + var x: any; +>x : any + + var r = t instanceof x; +>r : boolean +>t instanceof x : boolean +>t : T +>x : any +} diff --git a/tests/baselines/reference/instanceofOperatorWithRHSIsSubtypeOfFunction.types b/tests/baselines/reference/instanceofOperatorWithRHSIsSubtypeOfFunction.types new file mode 100644 index 00000000000..2bcf91bb1ab --- /dev/null +++ b/tests/baselines/reference/instanceofOperatorWithRHSIsSubtypeOfFunction.types @@ -0,0 +1,57 @@ +=== tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithRHSIsSubtypeOfFunction.ts === +interface I extends Function { } +>I : I +>Function : Function + +var x: any; +>x : any + +var f1: Function; +>f1 : Function +>Function : Function + +var f2: I; +>f2 : I +>I : I + +var f3: { (): void }; +>f3 : () => void + +var f4: { new (): number }; +>f4 : new () => number + +var r1 = x instanceof f1; +>r1 : boolean +>x instanceof f1 : boolean +>x : any +>f1 : Function + +var r2 = x instanceof f2; +>r2 : boolean +>x instanceof f2 : boolean +>x : any +>f2 : I + +var r3 = x instanceof f3; +>r3 : boolean +>x instanceof f3 : boolean +>x : any +>f3 : () => void + +var r4 = x instanceof f4; +>r4 : boolean +>x instanceof f4 : boolean +>x : any +>f4 : new () => number + +var r5 = x instanceof null; +>r5 : boolean +>x instanceof null : boolean +>x : any + +var r6 = x instanceof undefined; +>r6 : boolean +>x instanceof undefined : boolean +>x : any +>undefined : undefined + diff --git a/tests/baselines/reference/instantiateGenericClassWithZeroTypeArguments.types b/tests/baselines/reference/instantiateGenericClassWithZeroTypeArguments.types new file mode 100644 index 00000000000..0fe962e9c8f --- /dev/null +++ b/tests/baselines/reference/instantiateGenericClassWithZeroTypeArguments.types @@ -0,0 +1,36 @@ +=== tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateGenericClassWithZeroTypeArguments.ts === +// no errors expected when instantiating a generic type with no type arguments provided + +class C { +>C : C +>T : T + + x: T; +>x : T +>T : T +} + +var c = new C(); +>c : C<{}> +>new C() : C<{}> +>C : typeof C + +class D { +>D : D +>T : T +>U : U + + x: T +>x : T +>T : T + + y: U +>y : U +>U : U +} + +var d = new D(); +>d : D<{}, {}> +>new D() : D<{}, {}> +>D : typeof D + diff --git a/tests/baselines/reference/instantiatedModule.types b/tests/baselines/reference/instantiatedModule.types new file mode 100644 index 00000000000..5021cce8afb --- /dev/null +++ b/tests/baselines/reference/instantiatedModule.types @@ -0,0 +1,197 @@ +=== tests/cases/conformance/internalModules/moduleDeclarations/instantiatedModule.ts === +// adding the var makes this an instantiated module + +module M { +>M : typeof M + + export interface Point { x: number; y: number } +>Point : Point +>x : number +>y : number + + export var Point = 1; +>Point : number +} + +// primary expression +var m: typeof M; +>m : typeof M +>M : typeof M + +var m = M; +>m : typeof M +>M : typeof M + +var a1: number; +>a1 : number + +var a1 = M.Point; +>a1 : number +>M.Point : number +>M : typeof M +>Point : number + +var a1 = m.Point; +>a1 : number +>m.Point : number +>m : typeof M +>Point : number + +var p1: { x: number; y: number; } +>p1 : { x: number; y: number; } +>x : number +>y : number + +var p1: M.Point; +>p1 : { x: number; y: number; } +>M : M +>Point : Point + +// making the point a class instead of an interface +// makes this an instantiated mmodule +module M2 { +>M2 : typeof M2 + + export class Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + + static Origin(): Point { +>Origin : () => Point +>Point : Point + + return { x: 0, y: 0 }; +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number + } + } +} + +var m2: typeof M2; +>m2 : typeof M2 +>M2 : typeof M2 + +var m2 = M2; +>m2 : typeof M2 +>M2 : typeof M2 + +// static side of the class +var a2: typeof M2.Point; +>a2 : typeof Point +>M2 : typeof M2 +>Point : typeof Point + +var a2 = m2.Point; +>a2 : typeof Point +>m2.Point : typeof Point +>m2 : typeof M2 +>Point : typeof Point + +var a2 = M2.Point; +>a2 : typeof Point +>M2.Point : typeof Point +>M2 : typeof M2 +>Point : typeof Point + +var o: M2.Point = a2.Origin(); +>o : Point +>M2 : M2 +>Point : Point +>a2.Origin() : Point +>a2.Origin : () => Point +>a2 : typeof Point +>Origin : () => Point + +var p2: { x: number; y: number } +>p2 : { x: number; y: number; } +>x : number +>y : number + +var p2: M2.Point; +>p2 : { x: number; y: number; } +>M2 : M2 +>Point : Point + +var p2 = new m2.Point(); +>p2 : { x: number; y: number; } +>new m2.Point() : Point +>m2.Point : typeof Point +>m2 : typeof M2 +>Point : typeof Point + +var p2 = new M2.Point(); +>p2 : { x: number; y: number; } +>new M2.Point() : Point +>M2.Point : typeof Point +>M2 : typeof M2 +>Point : typeof Point + +module M3 { +>M3 : typeof M3 + + export enum Color { Blue, Red } +>Color : Color +>Blue : Color +>Red : Color +} + +var m3: typeof M3; +>m3 : typeof M3 +>M3 : typeof M3 + +var m3 = M3; +>m3 : typeof M3 +>M3 : typeof M3 + +var a3: typeof M3.Color; +>a3 : typeof Color +>M3 : typeof M3 +>Color : typeof Color + +var a3 = m3.Color; +>a3 : typeof Color +>m3.Color : typeof Color +>m3 : typeof M3 +>Color : typeof Color + +var a3 = M3.Color; +>a3 : typeof Color +>M3.Color : typeof Color +>M3 : typeof M3 +>Color : typeof Color + +var blue: M3.Color = a3.Blue; +>blue : Color +>M3 : M3 +>Color : Color +>a3.Blue : Color +>a3 : typeof Color +>Blue : Color + +var p3: M3.Color; +>p3 : Color +>M3 : M3 +>Color : Color + +var p3 = M3.Color.Red; +>p3 : Color +>M3.Color.Red : Color +>M3.Color : typeof Color +>M3 : typeof M3 +>Color : typeof Color +>Red : Color + +var p3 = m3.Color.Blue; +>p3 : Color +>m3.Color.Blue : Color +>m3.Color : typeof Color +>m3 : typeof M3 +>Color : typeof Color +>Blue : Color + diff --git a/tests/baselines/reference/instantiatedReturnTypeContravariance.types b/tests/baselines/reference/instantiatedReturnTypeContravariance.types new file mode 100644 index 00000000000..e5145abf455 --- /dev/null +++ b/tests/baselines/reference/instantiatedReturnTypeContravariance.types @@ -0,0 +1,43 @@ +=== tests/cases/compiler/instantiatedReturnTypeContravariance.ts === +interface B { +>B : B +>T : T + +name: string; +>name : string + +x(): T; +>x : () => T +>T : T + +} + +class c { +>c : c + +foo(): B { +>foo : () => B +>B : B + +return null; + +} + +} + +class d extends c { +>d : d +>c : c + +foo(): B { +>foo : () => B +>B : B + +return null; + +} + +} + + + diff --git a/tests/baselines/reference/interMixingModulesInterfaces0.types b/tests/baselines/reference/interMixingModulesInterfaces0.types new file mode 100644 index 00000000000..a6f132970cd --- /dev/null +++ b/tests/baselines/reference/interMixingModulesInterfaces0.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/interMixingModulesInterfaces0.ts === +module A { +>A : typeof A + + export module B { +>B : typeof B + + export function createB(): B { +>createB : () => B +>B : B + + return null; + } + } + + export interface B { +>B : B + + name: string; +>name : string + + value: number; +>value : number + } +} + +var x: A.B = A.B.createB(); +>x : B +>A : A +>B : B +>A.B.createB() : B +>A.B.createB : () => B +>A.B : typeof B +>A : typeof A +>B : typeof B +>createB : () => B + diff --git a/tests/baselines/reference/interMixingModulesInterfaces1.types b/tests/baselines/reference/interMixingModulesInterfaces1.types new file mode 100644 index 00000000000..df54cefd96f --- /dev/null +++ b/tests/baselines/reference/interMixingModulesInterfaces1.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/interMixingModulesInterfaces1.ts === +module A { +>A : typeof A + + export interface B { +>B : B + + name: string; +>name : string + + value: number; +>value : number + } + + export module B { +>B : typeof B + + export function createB(): B { +>createB : () => B +>B : B + + return null; + } + } +} + +var x: A.B = A.B.createB(); +>x : B +>A : A +>B : B +>A.B.createB() : B +>A.B.createB : () => B +>A.B : typeof B +>A : typeof A +>B : typeof B +>createB : () => B + diff --git a/tests/baselines/reference/interMixingModulesInterfaces2.types b/tests/baselines/reference/interMixingModulesInterfaces2.types new file mode 100644 index 00000000000..67d8e04c571 --- /dev/null +++ b/tests/baselines/reference/interMixingModulesInterfaces2.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/interMixingModulesInterfaces2.ts === +module A { +>A : typeof A + + export interface B { +>B : B + + name: string; +>name : string + + value: number; +>value : number + } + + module B { +>B : typeof B + + export function createB(): B { +>createB : () => B +>B : B + + return null; + } + } +} + +var x: A.B = null; +>x : B +>A : A +>B : B + diff --git a/tests/baselines/reference/interMixingModulesInterfaces3.types b/tests/baselines/reference/interMixingModulesInterfaces3.types new file mode 100644 index 00000000000..9ffb4149b48 --- /dev/null +++ b/tests/baselines/reference/interMixingModulesInterfaces3.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/interMixingModulesInterfaces3.ts === +module A { +>A : typeof A + + module B { +>B : typeof B + + export function createB(): B { +>createB : () => B +>B : B + + return null; + } + } + + export interface B { +>B : B + + name: string; +>name : string + + value: number; +>value : number + } +} + +var x: A.B = null; +>x : B +>A : A +>B : B + diff --git a/tests/baselines/reference/interMixingModulesInterfaces4.types b/tests/baselines/reference/interMixingModulesInterfaces4.types new file mode 100644 index 00000000000..9df3388a09a --- /dev/null +++ b/tests/baselines/reference/interMixingModulesInterfaces4.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/interMixingModulesInterfaces4.ts === +module A { +>A : typeof A + + export module B { +>B : typeof B + + export function createB(): number { +>createB : () => number + + return null; + } + } + + interface B { +>B : B + + name: string; +>name : string + + value: number; +>value : number + } +} + +var x : number = A.B.createB(); +>x : number +>A.B.createB() : number +>A.B.createB : () => number +>A.B : typeof B +>A : typeof A +>B : typeof B +>createB : () => number + diff --git a/tests/baselines/reference/interMixingModulesInterfaces5.types b/tests/baselines/reference/interMixingModulesInterfaces5.types new file mode 100644 index 00000000000..de08a7be442 --- /dev/null +++ b/tests/baselines/reference/interMixingModulesInterfaces5.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/interMixingModulesInterfaces5.ts === +module A { +>A : typeof A + + interface B { +>B : B + + name: string; +>name : string + + value: number; +>value : number + } + + export module B { +>B : typeof B + + export function createB(): number { +>createB : () => number + + return null; + } + } +} + +var x: number = A.B.createB(); +>x : number +>A.B.createB() : number +>A.B.createB : () => number +>A.B : typeof B +>A : typeof A +>B : typeof B +>createB : () => number + diff --git a/tests/baselines/reference/interface0.types b/tests/baselines/reference/interface0.types new file mode 100644 index 00000000000..41f668e79ca --- /dev/null +++ b/tests/baselines/reference/interface0.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/interface0.ts === +interface Generic { +>Generic : Generic +>T : T + + x: T; +>x : T +>T : T +} + +var y: Generic = { x: 3 }; +>y : Generic +>Generic : Generic +>{ x: 3 } : { x: number; } +>x : number + diff --git a/tests/baselines/reference/interfaceContextualType.types b/tests/baselines/reference/interfaceContextualType.types new file mode 100644 index 00000000000..65bd6b7ae34 --- /dev/null +++ b/tests/baselines/reference/interfaceContextualType.types @@ -0,0 +1,67 @@ +=== tests/cases/compiler/interfaceContextualType.ts === +export interface IOptions { +>IOptions : IOptions + + italic?: boolean; +>italic : boolean + + bold?: boolean; +>bold : boolean +} +export interface IMap { +>IMap : IMap + + [s: string]: IOptions; +>s : string +>IOptions : IOptions +} + +class Bug { +>Bug : Bug + + public values: IMap; +>values : IMap +>IMap : IMap + + ok() { +>ok : () => void + + this.values = {}; +>this.values = {} : { [x: string]: IOptions; } +>this.values : IMap +>this : Bug +>values : IMap +>{} : { [x: string]: IOptions; } + + this.values['comments'] = { italic: true }; +>this.values['comments'] = { italic: true } : { italic: boolean; } +>this.values['comments'] : IOptions +>this.values : IMap +>this : Bug +>values : IMap +>{ italic: true } : { italic: boolean; } +>italic : boolean + } + shouldBeOK() { +>shouldBeOK : () => void + + this.values = { +>this.values = { + comments: { italic: true } + } : { [x: string]: IOptions; comments: { italic: boolean; }; } +>this.values : IMap +>this : Bug +>values : IMap +>{ + comments: { italic: true } + } : { [x: string]: IOptions; comments: { italic: boolean; }; } + + comments: { italic: true } +>comments : { italic: boolean; } +>{ italic: true } : { italic: boolean; } +>italic : boolean + + }; + } +} + diff --git a/tests/baselines/reference/interfaceDeclaration5.types b/tests/baselines/reference/interfaceDeclaration5.types new file mode 100644 index 00000000000..0cad7652a28 --- /dev/null +++ b/tests/baselines/reference/interfaceDeclaration5.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/interfaceDeclaration5.ts === +export interface I1 { item:string; } +>I1 : I1 +>item : string + +export class C1 { } +>C1 : C1 + diff --git a/tests/baselines/reference/interfaceExtendsClass1.types b/tests/baselines/reference/interfaceExtendsClass1.types new file mode 100644 index 00000000000..c2370f7fe7f --- /dev/null +++ b/tests/baselines/reference/interfaceExtendsClass1.types @@ -0,0 +1,39 @@ +=== tests/cases/compiler/interfaceExtendsClass1.ts === +class Control { +>Control : Control + + private state: any; +>state : any +} +interface SelectableControl extends Control { +>SelectableControl : SelectableControl +>Control : Control + + select(): void; +>select : () => void +} +class Button extends Control { +>Button : Button +>Control : Control + + select() { } +>select : () => void +} +class TextBox extends Control { +>TextBox : TextBox +>Control : Control + + select() { } +>select : () => void +} +class Image extends Control { +>Image : Image +>Control : Control +} +class Location { +>Location : Location + + select() { } +>select : () => void +} + diff --git a/tests/baselines/reference/interfaceInReopenedModule.types b/tests/baselines/reference/interfaceInReopenedModule.types new file mode 100644 index 00000000000..e0ed40b186e --- /dev/null +++ b/tests/baselines/reference/interfaceInReopenedModule.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/interfaceInReopenedModule.ts === +module m { +>m : typeof m +} + +// In second instance of same module, exported interface is not visible +module m { +>m : typeof m + + interface f {} +>f : f + + export class n { +>n : n + + private n: f; +>n : f +>f : f + } +} + diff --git a/tests/baselines/reference/interfaceInheritance2.types b/tests/baselines/reference/interfaceInheritance2.types new file mode 100644 index 00000000000..ac89931df61 --- /dev/null +++ b/tests/baselines/reference/interfaceInheritance2.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/interfaceInheritance2.ts === +interface I6 { +>I6 : I6 + + ():void; +} + +interface I7 extends I6 { } +>I7 : I7 +>I6 : I6 + +var v1:I7; +>v1 : I7 +>I7 : I7 + +v1(); +>v1() : void +>v1 : I7 + diff --git a/tests/baselines/reference/interfaceOnly.types b/tests/baselines/reference/interfaceOnly.types new file mode 100644 index 00000000000..0dc38bea01a --- /dev/null +++ b/tests/baselines/reference/interfaceOnly.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/interfaceOnly.ts === +interface foo { +>foo : foo + + foo(); +>foo : () => any + + f2 (f: ()=> void); +>f2 : (f: () => void) => any +>f : () => void +} diff --git a/tests/baselines/reference/interfacePropertiesWithSameName1.types b/tests/baselines/reference/interfacePropertiesWithSameName1.types new file mode 100644 index 00000000000..f034cd98255 --- /dev/null +++ b/tests/baselines/reference/interfacePropertiesWithSameName1.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/interfacePropertiesWithSameName1.ts === +interface Mover { +>Mover : Mover + + move(): void; +>move : () => void + + getStatus(): { speed: number; }; +>getStatus : () => { speed: number; } +>speed : number +} +interface Shaker { +>Shaker : Shaker + + shake(): void; +>shake : () => void + + getStatus(): { frequency: number; }; +>getStatus : () => { frequency: number; } +>frequency : number +} + +interface MoverShaker extends Mover, Shaker { +>MoverShaker : MoverShaker +>Mover : Mover +>Shaker : Shaker + + getStatus(): { speed: number; frequency: number; }; +>getStatus : () => { speed: number; frequency: number; } +>speed : number +>frequency : number +} + diff --git a/tests/baselines/reference/interfaceSubtyping.types b/tests/baselines/reference/interfaceSubtyping.types new file mode 100644 index 00000000000..d9b31a50df9 --- /dev/null +++ b/tests/baselines/reference/interfaceSubtyping.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/interfaceSubtyping.ts === +interface iface { +>iface : iface + + foo(): void; +>foo : () => void +} +class Camera implements iface{ +>Camera : Camera +>iface : iface + + constructor (public str: string) { +>str : string + } + foo() { return "s"; } +>foo : () => string +} + diff --git a/tests/baselines/reference/interfaceThatHidesBaseProperty.types b/tests/baselines/reference/interfaceThatHidesBaseProperty.types new file mode 100644 index 00000000000..f27ec5abfc8 --- /dev/null +++ b/tests/baselines/reference/interfaceThatHidesBaseProperty.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatHidesBaseProperty.ts === +interface Base { +>Base : Base + + x: { a: number }; +>x : { a: number; } +>a : number +} + +interface Derived extends Base { +>Derived : Derived +>Base : Base + + x: { +>x : { a: number; b: number; } + + a: number; b: number; +>a : number +>b : number + + }; +} diff --git a/tests/baselines/reference/interfaceWithCallAndConstructSignature.types b/tests/baselines/reference/interfaceWithCallAndConstructSignature.types new file mode 100644 index 00000000000..93d6bf7a419 --- /dev/null +++ b/tests/baselines/reference/interfaceWithCallAndConstructSignature.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithCallAndConstructSignature.ts === +interface Foo { +>Foo : Foo + + (): number; + new (): any; +} + +var f: Foo; +>f : Foo +>Foo : Foo + +var r = f(); +>r : number +>f() : number +>f : Foo + +var r2 = new f(); +>r2 : any +>new f() : any +>f : Foo + diff --git a/tests/baselines/reference/interfaceWithCallSignaturesThatHidesBaseSignature.types b/tests/baselines/reference/interfaceWithCallSignaturesThatHidesBaseSignature.types new file mode 100644 index 00000000000..63933b41bea --- /dev/null +++ b/tests/baselines/reference/interfaceWithCallSignaturesThatHidesBaseSignature.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithCallSignaturesThatHidesBaseSignature.ts === +interface Foo { +>Foo : Foo + + (): { a: number }; +>a : number +} + +interface Derived extends Foo { +>Derived : Derived +>Foo : Foo + + (): { a: number; b: number }; +>a : number +>b : number +} + +var d: Derived; +>d : Derived +>Derived : Derived + +var r = d(); +>r : { a: number; b: number; } +>d() : { a: number; b: number; } +>d : Derived + diff --git a/tests/baselines/reference/interfaceWithCallSignaturesThatHidesBaseSignature2.types b/tests/baselines/reference/interfaceWithCallSignaturesThatHidesBaseSignature2.types new file mode 100644 index 00000000000..c91d6864def --- /dev/null +++ b/tests/baselines/reference/interfaceWithCallSignaturesThatHidesBaseSignature2.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithCallSignaturesThatHidesBaseSignature2.ts === +interface Foo { +>Foo : Foo + + (): { a: number; b: number }; +>a : number +>b : number +} + +interface Derived extends Foo { // error +>Derived : Derived +>Foo : Foo + + (): { a: number }; +>a : number +} + +var d: Derived; +>d : Derived +>Derived : Derived + +var r = d(); +>r : { a: number; } +>d() : { a: number; } +>d : Derived + diff --git a/tests/baselines/reference/interfaceWithConstructSignaturesThatHidesBaseSignature.types b/tests/baselines/reference/interfaceWithConstructSignaturesThatHidesBaseSignature.types new file mode 100644 index 00000000000..45c14f60386 --- /dev/null +++ b/tests/baselines/reference/interfaceWithConstructSignaturesThatHidesBaseSignature.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithConstructSignaturesThatHidesBaseSignature.ts === +interface Foo { +>Foo : Foo + + new (): { a: number }; +>a : number +} + +interface Derived extends Foo { +>Derived : Derived +>Foo : Foo + + new (): { a: number; b: number }; +>a : number +>b : number +} + +var d: Derived; +>d : Derived +>Derived : Derived + +var r = new d(); +>r : { a: number; b: number; } +>new d() : { a: number; b: number; } +>d : Derived + diff --git a/tests/baselines/reference/interfaceWithConstructSignaturesThatHidesBaseSignature2.types b/tests/baselines/reference/interfaceWithConstructSignaturesThatHidesBaseSignature2.types new file mode 100644 index 00000000000..635625d5696 --- /dev/null +++ b/tests/baselines/reference/interfaceWithConstructSignaturesThatHidesBaseSignature2.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithConstructSignaturesThatHidesBaseSignature2.ts === +interface Foo { +>Foo : Foo + + new (): { a: number; b: number }; +>a : number +>b : number +} + +interface Derived extends Foo { +>Derived : Derived +>Foo : Foo + + new (): { a: number }; // constructors not checked for conformance like a call signature is +>a : number +} + +var d: Derived; +>d : Derived +>Derived : Derived + +var r = new d(); +>r : { a: number; } +>new d() : { a: number; } +>d : Derived + diff --git a/tests/baselines/reference/interfaceWithOptionalProperty.types b/tests/baselines/reference/interfaceWithOptionalProperty.types new file mode 100644 index 00000000000..862857483da --- /dev/null +++ b/tests/baselines/reference/interfaceWithOptionalProperty.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/interfaceWithOptionalProperty.ts === + +interface I { +>I : I + + x?: number; +>x : number +} diff --git a/tests/baselines/reference/interfaceWithOverloadedCallAndConstructSignatures.types b/tests/baselines/reference/interfaceWithOverloadedCallAndConstructSignatures.types new file mode 100644 index 00000000000..1172f10a3dd --- /dev/null +++ b/tests/baselines/reference/interfaceWithOverloadedCallAndConstructSignatures.types @@ -0,0 +1,38 @@ +=== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithOverloadedCallAndConstructSignatures.ts === +interface Foo { +>Foo : Foo + + (): number; + (x: string): number; +>x : string + + new (): any; + new (x: string): Object; +>x : string +>Object : Object +} + +var f: Foo; +>f : Foo +>Foo : Foo + +var r1 = f(); +>r1 : number +>f() : number +>f : Foo + +var r2 = f(''); +>r2 : number +>f('') : number +>f : Foo + +var r3 = new f(); +>r3 : any +>new f() : any +>f : Foo + +var r4 = new f(''); +>r4 : Object +>new f('') : Object +>f : Foo + diff --git a/tests/baselines/reference/interfaceWithPropertyOfEveryType.types b/tests/baselines/reference/interfaceWithPropertyOfEveryType.types new file mode 100644 index 00000000000..be340c70143 --- /dev/null +++ b/tests/baselines/reference/interfaceWithPropertyOfEveryType.types @@ -0,0 +1,164 @@ +=== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType.ts === +class C { foo: string; } +>C : C +>foo : string + +function f1() { } +>f1 : () => void + +module M { +>M : typeof M + + export var y = 1; +>y : number +} +enum E { A } +>E : E +>A : E + +interface Foo { +>Foo : Foo + + a: number; +>a : number + + b: string; +>b : string + + c: boolean; +>c : boolean + + d: any; +>d : any + + e: void; +>e : void + + f: number[]; +>f : number[] + + g: Object; +>g : Object +>Object : Object + + h: (x: number) => number; +>h : (x: number) => number +>x : number + + i: (x: T) => T; +>i : (x: T) => T +>T : T +>x : T +>T : T +>T : T + + j: Foo; +>j : Foo +>Foo : Foo + + k: C; +>k : C +>C : C + + l: typeof f1; +>l : () => void +>f1 : () => void + + m: typeof M; +>m : typeof M +>M : typeof M + + n: {}; +>n : {} + + o: E; +>o : E +>E : E +} + +var a: Foo = { +>a : Foo +>Foo : Foo +>{ + a: 1, + b: '', + c: true, + d: {}, + e: null , + f: [1], + g: {}, + h: (x: number) => 1, + i: (x: T) => x, + j: null, + k: new C(), + l: f1, + m: M, + n: {}, + o: E.A +} : { a: number; b: string; c: boolean; d: {}; e: null; f: number[]; g: {}; h: (x: number) => number; i: (x: T) => T; j: Foo; k: C; l: () => void; m: typeof M; n: {}; o: E; } + + a: 1, +>a : number + + b: '', +>b : string + + c: true, +>c : boolean + + d: {}, +>d : {} +>{} : {} + + e: null , +>e : any + + f: [1], +>f : number[] +>[1] : number[] + + g: {}, +>g : {} +>{} : {} + + h: (x: number) => 1, +>h : (x: number) => number +>(x: number) => 1 : (x: number) => number +>x : number + + i: (x: T) => x, +>i : (x: T) => T +>(x: T) => x : (x: T) => T +>T : T +>x : T +>T : T +>x : T + + j: null, +>j : Foo +>null : Foo +>Foo : Foo + + k: new C(), +>k : C +>new C() : C +>C : typeof C + + l: f1, +>l : () => void +>f1 : f1 + + m: M, +>m : typeof M +>M : M + + n: {}, +>n : {} +>{} : {} + + o: E.A +>o : E +>E.A : E +>E : typeof E +>A : E +} diff --git a/tests/baselines/reference/interfaceWithSpecializedCallAndConstructSignatures.types b/tests/baselines/reference/interfaceWithSpecializedCallAndConstructSignatures.types new file mode 100644 index 00000000000..e9bc0cd2889 --- /dev/null +++ b/tests/baselines/reference/interfaceWithSpecializedCallAndConstructSignatures.types @@ -0,0 +1,42 @@ +=== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithSpecializedCallAndConstructSignatures.ts === +interface Foo { +>Foo : Foo + + (x: 'a'): number; +>x : 'a' + + (x: string): any; +>x : string + + new (x: 'a'): any; +>x : 'a' + + new (x: string): Object; +>x : string +>Object : Object +} + +var f: Foo; +>f : Foo +>Foo : Foo + +var r = f('a'); +>r : number +>f('a') : number +>f : Foo + +var r2 = f('A'); +>r2 : any +>f('A') : any +>f : Foo + +var r3 = new f('a'); +>r3 : any +>new f('a') : any +>f : Foo + +var r4 = new f('A'); +>r4 : Object +>new f('A') : Object +>f : Foo + diff --git a/tests/baselines/reference/interfacedecl.types b/tests/baselines/reference/interfacedecl.types new file mode 100644 index 00000000000..377e4f28639 --- /dev/null +++ b/tests/baselines/reference/interfacedecl.types @@ -0,0 +1,95 @@ +=== tests/cases/compiler/interfacedecl.ts === +interface a0 { +>a0 : a0 + + (): string; + (a, b, c?: string): number; +>a : any +>b : any +>c : string + + new (): string; + new (s: string); +>s : string + + [n: number]: ()=>string; +>n : number + + [s: string]: any; +>s : string + + p1; +>p1 : any + + p2: string; +>p2 : string + + p3?; +>p3 : any + + p4?: number; +>p4 : number + + p5: (s: number) =>string; +>p5 : (s: number) => string +>s : number + + f1(); +>f1 : () => any + + f2? (); +>f2 : () => any + + f3(a: string): number; +>f3 : (a: string) => number +>a : string + + f4? (s: number): string; +>f4 : (s: number) => string +>s : number +} + + +interface a1 { +>a1 : a1 + + [n: number]: number; +>n : number +} + +interface a2 { +>a2 : a2 + + [s: string]: number; +>s : string +} + +interface a { +>a : a +} + +interface b extends a { +>b : b +>a : a +} + +interface c extends a, b { +>c : c +>a : a +>b : b +} + +interface d extends a { +>d : d +>a : a +} + +class c1 implements a { +>c1 : c1 +>a : a +} +var instance2 = new c1(); +>instance2 : c1 +>new c1() : c1 +>c1 : typeof c1 + diff --git a/tests/baselines/reference/internalAliasClass.types b/tests/baselines/reference/internalAliasClass.types new file mode 100644 index 00000000000..7315fc16ecc --- /dev/null +++ b/tests/baselines/reference/internalAliasClass.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/internalAliasClass.ts === +module a { +>a : typeof a + + export class c { +>c : c + } +} + +module c { +>c : typeof c + + import b = a.c; +>b : typeof c +>a : c +>c : c + + export var x: b = new b(); +>x : c +>b : b +>new b() : c +>b : typeof c +} diff --git a/tests/baselines/reference/internalAliasClassInsideLocalModuleWithExport.types b/tests/baselines/reference/internalAliasClassInsideLocalModuleWithExport.types new file mode 100644 index 00000000000..bdc08525865 --- /dev/null +++ b/tests/baselines/reference/internalAliasClassInsideLocalModuleWithExport.types @@ -0,0 +1,51 @@ +=== tests/cases/compiler/internalAliasClassInsideLocalModuleWithExport.ts === +export module x { +>x : typeof x + + export class c { +>c : c + + foo(a: number) { +>foo : (a: number) => number +>a : number + + return a; +>a : number + } + } +} + +export module m2 { +>m2 : typeof m2 + + export module m3 { +>m3 : typeof m3 + + export import c = x.c; +>c : typeof c +>x : c +>c : c + + export var cProp = new c(); +>cProp : c +>new c() : c +>c : typeof c + + var cReturnVal = cProp.foo(10); +>cReturnVal : number +>cProp.foo(10) : number +>cProp.foo : (a: number) => number +>cProp : c +>foo : (a: number) => number + } +} + +export var d = new m2.m3.c(); +>d : c +>new m2.m3.c() : c +>m2.m3.c : typeof c +>m2.m3 : typeof m3 +>m2 : typeof m2 +>m3 : typeof m3 +>c : typeof c + diff --git a/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExport.types b/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExport.types new file mode 100644 index 00000000000..a2de11b3a4b --- /dev/null +++ b/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExport.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/internalAliasClassInsideLocalModuleWithoutExport.ts === +export module x { +>x : typeof x + + export class c { +>c : c + + foo(a: number) { +>foo : (a: number) => number +>a : number + + return a; +>a : number + } + } +} + +export module m2 { +>m2 : typeof m2 + + export module m3 { +>m3 : typeof m3 + + import c = x.c; +>c : typeof c +>x : c +>c : c + + export var cProp = new c(); +>cProp : c +>new c() : c +>c : typeof c + + var cReturnVal = cProp.foo(10); +>cReturnVal : number +>cProp.foo(10) : number +>cProp.foo : (a: number) => number +>cProp : c +>foo : (a: number) => number + } +} diff --git a/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithExport.types b/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithExport.types new file mode 100644 index 00000000000..ea12761ba2c --- /dev/null +++ b/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithExport.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/internalAliasClassInsideTopLevelModuleWithExport.ts === +export module x { +>x : typeof x + + export class c { +>c : c + + foo(a: number) { +>foo : (a: number) => number +>a : number + + return a; +>a : number + } + } +} + +export import xc = x.c; +>xc : typeof c +>x : c +>c : c + +export var cProp = new xc(); +>cProp : c +>new xc() : c +>xc : typeof c + +var cReturnVal = cProp.foo(10); +>cReturnVal : number +>cProp.foo(10) : number +>cProp.foo : (a: number) => number +>cProp : c +>foo : (a: number) => number + diff --git a/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithoutExport.types b/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithoutExport.types new file mode 100644 index 00000000000..a531d528ff7 --- /dev/null +++ b/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithoutExport.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/internalAliasClassInsideTopLevelModuleWithoutExport.ts === +export module x { +>x : typeof x + + export class c { +>c : c + + foo(a: number) { +>foo : (a: number) => number +>a : number + + return a; +>a : number + } + } +} + +import xc = x.c; +>xc : typeof c +>x : c +>c : c + +export var cProp = new xc(); +>cProp : c +>new xc() : c +>xc : typeof c + +var cReturnVal = cProp.foo(10); +>cReturnVal : number +>cProp.foo(10) : number +>cProp.foo : (a: number) => number +>cProp : c +>foo : (a: number) => number + diff --git a/tests/baselines/reference/internalAliasEnum.types b/tests/baselines/reference/internalAliasEnum.types new file mode 100644 index 00000000000..54b8df5ae49 --- /dev/null +++ b/tests/baselines/reference/internalAliasEnum.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/internalAliasEnum.ts === +module a { +>a : typeof a + + export enum weekend { +>weekend : weekend + + Friday, +>Friday : weekend + + Saturday, +>Saturday : weekend + + Sunday +>Sunday : weekend + } +} + +module c { +>c : typeof c + + import b = a.weekend; +>b : typeof weekend +>a : weekend +>weekend : weekend + + export var bVal: b = b.Sunday; +>bVal : weekend +>b : b +>b.Sunday : weekend +>b : typeof weekend +>Sunday : weekend +} + diff --git a/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithExport.types b/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithExport.types new file mode 100644 index 00000000000..e2790db70d5 --- /dev/null +++ b/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithExport.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/internalAliasEnumInsideLocalModuleWithExport.ts === +export module a { +>a : typeof a + + export enum weekend { +>weekend : weekend + + Friday, +>Friday : weekend + + Saturday, +>Saturday : weekend + + Sunday +>Sunday : weekend + } +} + +export module c { +>c : typeof c + + export import b = a.weekend; +>b : typeof weekend +>a : weekend +>weekend : weekend + + export var bVal: b = b.Sunday; +>bVal : weekend +>b : b +>b.Sunday : weekend +>b : typeof weekend +>Sunday : weekend +} + diff --git a/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithoutExport.types b/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithoutExport.types new file mode 100644 index 00000000000..a8b0528ecb7 --- /dev/null +++ b/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithoutExport.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/internalAliasEnumInsideLocalModuleWithoutExport.ts === +export module a { +>a : typeof a + + export enum weekend { +>weekend : weekend + + Friday, +>Friday : weekend + + Saturday, +>Saturday : weekend + + Sunday +>Sunday : weekend + } +} + +export module c { +>c : typeof c + + import b = a.weekend; +>b : typeof weekend +>a : weekend +>weekend : weekend + + export var bVal: b = b.Sunday; +>bVal : weekend +>b : b +>b.Sunday : weekend +>b : typeof weekend +>Sunday : weekend +} + diff --git a/tests/baselines/reference/internalAliasEnumInsideTopLevelModuleWithExport.types b/tests/baselines/reference/internalAliasEnumInsideTopLevelModuleWithExport.types new file mode 100644 index 00000000000..bc4e2af89cb --- /dev/null +++ b/tests/baselines/reference/internalAliasEnumInsideTopLevelModuleWithExport.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/internalAliasEnumInsideTopLevelModuleWithExport.ts === +export module a { +>a : typeof a + + export enum weekend { +>weekend : weekend + + Friday, +>Friday : weekend + + Saturday, +>Saturday : weekend + + Sunday +>Sunday : weekend + } +} + +export import b = a.weekend; +>b : typeof weekend +>a : weekend +>weekend : weekend + +export var bVal: b = b.Sunday; +>bVal : weekend +>b : b +>b.Sunday : weekend +>b : typeof weekend +>Sunday : weekend + diff --git a/tests/baselines/reference/internalAliasEnumInsideTopLevelModuleWithoutExport.types b/tests/baselines/reference/internalAliasEnumInsideTopLevelModuleWithoutExport.types new file mode 100644 index 00000000000..d9ffa38d3ab --- /dev/null +++ b/tests/baselines/reference/internalAliasEnumInsideTopLevelModuleWithoutExport.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/internalAliasEnumInsideTopLevelModuleWithoutExport.ts === +export module a { +>a : typeof a + + export enum weekend { +>weekend : weekend + + Friday, +>Friday : weekend + + Saturday, +>Saturday : weekend + + Sunday +>Sunday : weekend + } +} + +import b = a.weekend; +>b : typeof weekend +>a : weekend +>weekend : weekend + +export var bVal: b = b.Sunday; +>bVal : weekend +>b : b +>b.Sunday : weekend +>b : typeof weekend +>Sunday : weekend + diff --git a/tests/baselines/reference/internalAliasFunction.types b/tests/baselines/reference/internalAliasFunction.types new file mode 100644 index 00000000000..77a6546d166 --- /dev/null +++ b/tests/baselines/reference/internalAliasFunction.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/internalAliasFunction.ts === +module a { +>a : typeof a + + export function foo(x: number) { +>foo : (x: number) => number +>x : number + + return x; +>x : number + } +} + +module c { +>c : typeof c + + import b = a.foo; +>b : (x: number) => number +>a : (x: number) => number +>foo : (x: number) => number + + export var bVal = b(10); +>bVal : number +>b(10) : number +>b : (x: number) => number + + export var bVal2 = b; +>bVal2 : (x: number) => number +>b : (x: number) => number +} + diff --git a/tests/baselines/reference/internalAliasFunctionInsideLocalModuleWithExport.types b/tests/baselines/reference/internalAliasFunctionInsideLocalModuleWithExport.types new file mode 100644 index 00000000000..ffeedf43e92 --- /dev/null +++ b/tests/baselines/reference/internalAliasFunctionInsideLocalModuleWithExport.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/internalAliasFunctionInsideLocalModuleWithExport.ts === +export module a { +>a : typeof a + + export function foo(x: number) { +>foo : (x: number) => number +>x : number + + return x; +>x : number + } +} + +export module c { +>c : typeof c + + export import b = a.foo; +>b : (x: number) => number +>a : (x: number) => number +>foo : (x: number) => number + + export var bVal = b(10); +>bVal : number +>b(10) : number +>b : (x: number) => number + + export var bVal2 = b; +>bVal2 : (x: number) => number +>b : (x: number) => number +} + diff --git a/tests/baselines/reference/internalAliasFunctionInsideLocalModuleWithoutExport.types b/tests/baselines/reference/internalAliasFunctionInsideLocalModuleWithoutExport.types new file mode 100644 index 00000000000..8ca1000f970 --- /dev/null +++ b/tests/baselines/reference/internalAliasFunctionInsideLocalModuleWithoutExport.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/internalAliasFunctionInsideLocalModuleWithoutExport.ts === +export module a { +>a : typeof a + + export function foo(x: number) { +>foo : (x: number) => number +>x : number + + return x; +>x : number + } +} + +export module c { +>c : typeof c + + import b = a.foo; +>b : (x: number) => number +>a : (x: number) => number +>foo : (x: number) => number + + var bVal = b(10); +>bVal : number +>b(10) : number +>b : (x: number) => number + + export var bVal2 = b; +>bVal2 : (x: number) => number +>b : (x: number) => number +} + diff --git a/tests/baselines/reference/internalAliasFunctionInsideTopLevelModuleWithExport.types b/tests/baselines/reference/internalAliasFunctionInsideTopLevelModuleWithExport.types new file mode 100644 index 00000000000..570ab7a0e85 --- /dev/null +++ b/tests/baselines/reference/internalAliasFunctionInsideTopLevelModuleWithExport.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/internalAliasFunctionInsideTopLevelModuleWithExport.ts === +export module a { +>a : typeof a + + export function foo(x: number) { +>foo : (x: number) => number +>x : number + + return x; +>x : number + } +} + +export import b = a.foo; +>b : (x: number) => number +>a : (x: number) => number +>foo : (x: number) => number + +export var bVal = b(10); +>bVal : number +>b(10) : number +>b : (x: number) => number + +export var bVal2 = b; +>bVal2 : (x: number) => number +>b : (x: number) => number + diff --git a/tests/baselines/reference/internalAliasFunctionInsideTopLevelModuleWithoutExport.types b/tests/baselines/reference/internalAliasFunctionInsideTopLevelModuleWithoutExport.types new file mode 100644 index 00000000000..40680a5d894 --- /dev/null +++ b/tests/baselines/reference/internalAliasFunctionInsideTopLevelModuleWithoutExport.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/internalAliasFunctionInsideTopLevelModuleWithoutExport.ts === +export module a { +>a : typeof a + + export function foo(x: number) { +>foo : (x: number) => number +>x : number + + return x; +>x : number + } +} + +import b = a.foo; +>b : (x: number) => number +>a : (x: number) => number +>foo : (x: number) => number + +export var bVal = b(10); +>bVal : number +>b(10) : number +>b : (x: number) => number + +export var bVal2 = b; +>bVal2 : (x: number) => number +>b : (x: number) => number + diff --git a/tests/baselines/reference/internalAliasInitializedModule.types b/tests/baselines/reference/internalAliasInitializedModule.types new file mode 100644 index 00000000000..dcd5e728030 --- /dev/null +++ b/tests/baselines/reference/internalAliasInitializedModule.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/internalAliasInitializedModule.ts === +module a { +>a : typeof a + + export module b { +>b : typeof b + + export class c { +>c : c + } + } +} + +module c { +>c : typeof c + + import b = a.b; +>b : typeof b +>a : typeof b +>b : typeof b + + export var x: b.c = new b.c(); +>x : c +>b : b +>c : c +>new b.c() : c +>b.c : typeof c +>b : typeof b +>c : typeof c +} diff --git a/tests/baselines/reference/internalAliasInitializedModuleInsideLocalModuleWithExport.types b/tests/baselines/reference/internalAliasInitializedModuleInsideLocalModuleWithExport.types new file mode 100644 index 00000000000..e9ab37ad589 --- /dev/null +++ b/tests/baselines/reference/internalAliasInitializedModuleInsideLocalModuleWithExport.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/internalAliasInitializedModuleInsideLocalModuleWithExport.ts === +export module a { +>a : typeof a + + export module b { +>b : typeof b + + export class c { +>c : c + } + } +} + +export module c { +>c : typeof c + + export import b = a.b; +>b : typeof b +>a : typeof b +>b : typeof b + + export var x: b.c = new b.c(); +>x : c +>b : b +>c : c +>new b.c() : c +>b.c : typeof c +>b : typeof b +>c : typeof c +} diff --git a/tests/baselines/reference/internalAliasInitializedModuleInsideLocalModuleWithoutExport.types b/tests/baselines/reference/internalAliasInitializedModuleInsideLocalModuleWithoutExport.types new file mode 100644 index 00000000000..8a78877c962 --- /dev/null +++ b/tests/baselines/reference/internalAliasInitializedModuleInsideLocalModuleWithoutExport.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/internalAliasInitializedModuleInsideLocalModuleWithoutExport.ts === +export module a { +>a : typeof a + + export module b { +>b : typeof b + + export class c { +>c : c + } + } +} + +export module c { +>c : typeof c + + import b = a.b; +>b : typeof b +>a : typeof b +>b : typeof b + + export var x: b.c = new b.c(); +>x : c +>b : b +>c : c +>new b.c() : c +>b.c : typeof c +>b : typeof b +>c : typeof c +} diff --git a/tests/baselines/reference/internalAliasInitializedModuleInsideTopLevelModuleWithExport.types b/tests/baselines/reference/internalAliasInitializedModuleInsideTopLevelModuleWithExport.types new file mode 100644 index 00000000000..e67c2110e01 --- /dev/null +++ b/tests/baselines/reference/internalAliasInitializedModuleInsideTopLevelModuleWithExport.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/internalAliasInitializedModuleInsideTopLevelModuleWithExport.ts === +export module a { +>a : typeof a + + export module b { +>b : typeof b + + export class c { +>c : c + } + } +} + +export import b = a.b; +>b : typeof b +>a : typeof b +>b : typeof b + +export var x: b.c = new b.c(); +>x : c +>b : b +>c : c +>new b.c() : c +>b.c : typeof c +>b : typeof b +>c : typeof c + diff --git a/tests/baselines/reference/internalAliasInitializedModuleInsideTopLevelModuleWithoutExport.types b/tests/baselines/reference/internalAliasInitializedModuleInsideTopLevelModuleWithoutExport.types new file mode 100644 index 00000000000..e76c848674b --- /dev/null +++ b/tests/baselines/reference/internalAliasInitializedModuleInsideTopLevelModuleWithoutExport.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/internalAliasInitializedModuleInsideTopLevelModuleWithoutExport.ts === +export module a { +>a : typeof a + + export module b { +>b : typeof b + + export class c { +>c : c + } + } +} + +import b = a.b; +>b : typeof b +>a : typeof b +>b : typeof b + +export var x: b.c = new b.c(); +>x : c +>b : b +>c : c +>new b.c() : c +>b.c : typeof c +>b : typeof b +>c : typeof c + diff --git a/tests/baselines/reference/internalAliasInterface.types b/tests/baselines/reference/internalAliasInterface.types new file mode 100644 index 00000000000..5a7d30d9882 --- /dev/null +++ b/tests/baselines/reference/internalAliasInterface.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/internalAliasInterface.ts === +module a { +>a : a + + export interface I { +>I : I + } +} + +module c { +>c : typeof c + + import b = a.I; +>b : b +>a : I +>I : I + + export var x: b; +>x : I +>b : b +} + diff --git a/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithExport.types b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithExport.types new file mode 100644 index 00000000000..023ee951af8 --- /dev/null +++ b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithExport.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithExport.ts === +export module a { +>a : a + + export interface I { +>I : I + } +} + +export module c { +>c : typeof c + + export import b = a.I; +>b : b +>a : I +>I : I + + export var x: b; +>x : I +>b : b +} + diff --git a/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExport.types b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExport.types new file mode 100644 index 00000000000..7a01e00fbff --- /dev/null +++ b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExport.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExport.ts === +export module a { +>a : a + + export interface I { +>I : I + } +} + +export module c { +>c : typeof c + + import b = a.I; +>b : b +>a : I +>I : I + + export var x: b; +>x : I +>b : b +} + diff --git a/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithExport.types b/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithExport.types new file mode 100644 index 00000000000..dd662b1541c --- /dev/null +++ b/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithExport.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/internalAliasInterfaceInsideTopLevelModuleWithExport.ts === +export module a { +>a : a + + export interface I { +>I : I + } +} + +export import b = a.I; +>b : b +>a : I +>I : I + +export var x: b; +>x : I +>b : b + diff --git a/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithoutExport.types b/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithoutExport.types new file mode 100644 index 00000000000..aa11f53c3ad --- /dev/null +++ b/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithoutExport.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/internalAliasInterfaceInsideTopLevelModuleWithoutExport.ts === +export module a { +>a : a + + export interface I { +>I : I + } +} + +import b = a.I; +>b : b +>a : I +>I : I + +export var x: b; +>x : I +>b : b + diff --git a/tests/baselines/reference/internalAliasUninitializedModule.types b/tests/baselines/reference/internalAliasUninitializedModule.types new file mode 100644 index 00000000000..2a05858edbf --- /dev/null +++ b/tests/baselines/reference/internalAliasUninitializedModule.types @@ -0,0 +1,35 @@ +=== tests/cases/compiler/internalAliasUninitializedModule.ts === +module a { +>a : a + + export module b { +>b : b + + export interface I { +>I : I + + foo(); +>foo : () => any + } + } +} + +module c { +>c : typeof c + + import b = a.b; +>b : b +>a : a +>b : b + + export var x: b.I; +>x : I +>b : b +>I : I + + x.foo(); +>x.foo() : any +>x.foo : () => any +>x : I +>foo : () => any +} diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.types b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.types new file mode 100644 index 00000000000..4220c67e677 --- /dev/null +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.types @@ -0,0 +1,35 @@ +=== tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithExport.ts === +export module a { +>a : a + + export module b { +>b : b + + export interface I { +>I : I + + foo(); +>foo : () => any + } + } +} + +export module c { +>c : typeof c + + export import b = a.b; +>b : b +>a : a +>b : b + + export var x: b.I; +>x : I +>b : b +>I : I + + x.foo(); +>x.foo() : any +>x.foo : () => any +>x : I +>foo : () => any +} diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.types b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.types new file mode 100644 index 00000000000..c42848cdd61 --- /dev/null +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.types @@ -0,0 +1,35 @@ +=== tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.ts === +export module a { +>a : a + + export module b { +>b : b + + export interface I { +>I : I + + foo(); +>foo : () => any + } + } +} + +export module c { +>c : typeof c + + import b = a.b; +>b : b +>a : a +>b : b + + export var x: b.I; +>x : I +>b : b +>I : I + + x.foo(); +>x.foo() : any +>x.foo : () => any +>x : I +>foo : () => any +} diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.types b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.types new file mode 100644 index 00000000000..cd6a928595a --- /dev/null +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.ts === +export module a { +>a : a + + export module b { +>b : b + + export interface I { +>I : I + + foo(); +>foo : () => any + } + } +} + +export import b = a.b; +>b : b +>a : a +>b : b + +export var x: b.I; +>x : I +>b : b +>I : I + +x.foo(); +>x.foo() : any +>x.foo : () => any +>x : I +>foo : () => any + diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.types b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.types new file mode 100644 index 00000000000..711e933ee74 --- /dev/null +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.ts === +export module a { +>a : a + + export module b { +>b : b + + export interface I { +>I : I + + foo(); +>foo : () => any + } + } +} + +import b = a.b; +>b : b +>a : a +>b : b + +export var x: b.I; +>x : I +>b : b +>I : I + +x.foo(); +>x.foo() : any +>x.foo : () => any +>x : I +>foo : () => any + diff --git a/tests/baselines/reference/internalAliasVar.types b/tests/baselines/reference/internalAliasVar.types new file mode 100644 index 00000000000..abfd384d3d1 --- /dev/null +++ b/tests/baselines/reference/internalAliasVar.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/internalAliasVar.ts === +module a { +>a : typeof a + + export var x = 10; +>x : number +} + +module c { +>c : typeof c + + import b = a.x; +>b : number +>a : number +>x : number + + export var bVal = b; +>bVal : number +>b : number +} + diff --git a/tests/baselines/reference/internalAliasVarInsideLocalModuleWithExport.types b/tests/baselines/reference/internalAliasVarInsideLocalModuleWithExport.types new file mode 100644 index 00000000000..72bcb43d8c1 --- /dev/null +++ b/tests/baselines/reference/internalAliasVarInsideLocalModuleWithExport.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/internalAliasVarInsideLocalModuleWithExport.ts === +export module a { +>a : typeof a + + export var x = 10; +>x : number +} + +export module c { +>c : typeof c + + export import b = a.x; +>b : number +>a : number +>x : number + + export var bVal = b; +>bVal : number +>b : number +} + diff --git a/tests/baselines/reference/internalAliasVarInsideLocalModuleWithoutExport.types b/tests/baselines/reference/internalAliasVarInsideLocalModuleWithoutExport.types new file mode 100644 index 00000000000..34669c93000 --- /dev/null +++ b/tests/baselines/reference/internalAliasVarInsideLocalModuleWithoutExport.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/internalAliasVarInsideLocalModuleWithoutExport.ts === +export module a { +>a : typeof a + + export var x = 10; +>x : number +} + +export module c { +>c : typeof c + + import b = a.x; +>b : number +>a : number +>x : number + + export var bVal = b; +>bVal : number +>b : number +} + diff --git a/tests/baselines/reference/internalAliasVarInsideTopLevelModuleWithExport.types b/tests/baselines/reference/internalAliasVarInsideTopLevelModuleWithExport.types new file mode 100644 index 00000000000..0a3488929dd --- /dev/null +++ b/tests/baselines/reference/internalAliasVarInsideTopLevelModuleWithExport.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/internalAliasVarInsideTopLevelModuleWithExport.ts === +export module a { +>a : typeof a + + export var x = 10; +>x : number +} + +export import b = a.x; +>b : number +>a : number +>x : number + +export var bVal = b; +>bVal : number +>b : number + + diff --git a/tests/baselines/reference/internalAliasVarInsideTopLevelModuleWithoutExport.types b/tests/baselines/reference/internalAliasVarInsideTopLevelModuleWithoutExport.types new file mode 100644 index 00000000000..b761d58f225 --- /dev/null +++ b/tests/baselines/reference/internalAliasVarInsideTopLevelModuleWithoutExport.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/internalAliasVarInsideTopLevelModuleWithoutExport.ts === +export module a { +>a : typeof a + + export var x = 10; +>x : number +} + +import b = a.x; +>b : number +>a : number +>x : number + +export var bVal = b; +>bVal : number +>b : number + + diff --git a/tests/baselines/reference/internalAliasWithDottedNameEmit.types b/tests/baselines/reference/internalAliasWithDottedNameEmit.types new file mode 100644 index 00000000000..cda70b9a32b --- /dev/null +++ b/tests/baselines/reference/internalAliasWithDottedNameEmit.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/internalAliasWithDottedNameEmit.ts === +module a.b.c { +>a : typeof a +>b : typeof b +>c : typeof c + + export var d; +>d : any +} +module a.e.f { +>a : typeof a +>e : e +>f : f + + import g = b.c; +>g : typeof c +>b : typeof c +>c : typeof c +} + diff --git a/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.types b/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.types new file mode 100644 index 00000000000..2a1afa214a2 --- /dev/null +++ b/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts === +class A { +>A : A + + aProp: string; +>aProp : string +} +module A { +>A : typeof A + + export interface X { s: string } +>X : X +>s : string + + export var a = 10; +>a : number +} + +module B { +>B : B + + import Y = A; +>Y : typeof A +>A : A +} + diff --git a/tests/baselines/reference/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.types b/tests/baselines/reference/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.types new file mode 100644 index 00000000000..131527c66a0 --- /dev/null +++ b/tests/baselines/reference/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.ts === +class A { +>A : A + + aProp: string; +>aProp : string +} +module A { +>A : typeof A + + export interface X { s: string } +>X : X +>s : string +} + +module B { +>B : B + + import Y = A; +>Y : typeof A +>A : A +} + diff --git a/tests/baselines/reference/internalImportUnInstantiatedModuleNotReferencingInstanceNoConflict.types b/tests/baselines/reference/internalImportUnInstantiatedModuleNotReferencingInstanceNoConflict.types new file mode 100644 index 00000000000..01549965a13 --- /dev/null +++ b/tests/baselines/reference/internalImportUnInstantiatedModuleNotReferencingInstanceNoConflict.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/internalImportUnInstantiatedModuleNotReferencingInstanceNoConflict.ts === +module A { +>A : A + + export interface X { s: string } +>X : X +>s : string +} + +module B { +>B : typeof B + + var A = 1; +>A : number + + import Y = A; +>Y : Y +>A : A +} + diff --git a/tests/baselines/reference/invalidSplice.types b/tests/baselines/reference/invalidSplice.types new file mode 100644 index 00000000000..ab4ad85d61f --- /dev/null +++ b/tests/baselines/reference/invalidSplice.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/invalidSplice.ts === +var arr = [].splice(0,3,4,5); +>arr : any[] +>[].splice(0,3,4,5) : any[] +>[].splice : { (start: number): any[]; (start: number, deleteCount: number, ...items: any[]): any[]; } +>[] : undefined[] +>splice : { (start: number): any[]; (start: number, deleteCount: number, ...items: any[]): any[]; } + diff --git a/tests/baselines/reference/invalidSwitchBreakStatement.types b/tests/baselines/reference/invalidSwitchBreakStatement.types new file mode 100644 index 00000000000..a17a2a7dee2 --- /dev/null +++ b/tests/baselines/reference/invalidSwitchBreakStatement.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/statements/breakStatements/invalidSwitchBreakStatement.ts === +// break is not allowed in a switch statement +No type information for this code. +No type information for this code.switch (12) { +No type information for this code. case 5: +No type information for this code. break; +No type information for this code.} +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/invalidTypeNames.types b/tests/baselines/reference/invalidTypeNames.types new file mode 100644 index 00000000000..d16ce3b57e0 --- /dev/null +++ b/tests/baselines/reference/invalidTypeNames.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/invalidTypeNames.ts === +// Refer to calling code - a real illegal name is subbed in here +class illegal_name_here { +>illegal_name_here : illegal_name_here +} + diff --git a/tests/baselines/reference/invalidUndefinedValues.types b/tests/baselines/reference/invalidUndefinedValues.types new file mode 100644 index 00000000000..9cc71b87c82 --- /dev/null +++ b/tests/baselines/reference/invalidUndefinedValues.types @@ -0,0 +1,108 @@ +=== tests/cases/conformance/types/primitives/undefined/invalidUndefinedValues.ts === +var x: typeof undefined; +>x : any +>undefined : undefined + +x = 1; +>x = 1 : number +>x : any + +x = ''; +>x = '' : string +>x : any + +x = true; +>x = true : boolean +>x : any + +var a: void; +>a : void + +x = a; +>x = a : void +>x : any +>a : void + +x = null; +>x = null : null +>x : any + +class C { foo: string } +>C : C +>foo : string + +var b: C; +>b : C +>C : C + +x = C; +>x = C : typeof C +>x : any +>C : typeof C + +x = b; +>x = b : C +>x : any +>b : C + +interface I { foo: string } +>I : I +>foo : string + +var c: I; +>c : I +>I : I + +x = c; +>x = c : I +>x : any +>c : I + +module M { export var x = 1; } +>M : typeof M +>x : number + +x = M; +>x = M : typeof M +>x : any +>M : typeof M + +x = { f() { } } +>x = { f() { } } : { f: () => void; } +>x : any +>{ f() { } } : { f: () => void; } +>f : () => void +>f() { } : () => void + +function f(a: T) { +>f : (a: T) => void +>T : T +>a : T +>T : T + + x = a; +>x = a : T +>x : any +>a : T +} +x = f; +>x = f : (a: T) => void +>x : any +>f : (a: T) => void + +enum E { A } +>E : E +>A : E + +x = E; +>x = E : typeof E +>x : any +>E : typeof E + +x = E.A; +>x = E.A : E +>x : any +>E.A : E +>E : typeof E +>A : E + diff --git a/tests/baselines/reference/ipromise2.types b/tests/baselines/reference/ipromise2.types new file mode 100644 index 00000000000..7dac9383e39 --- /dev/null +++ b/tests/baselines/reference/ipromise2.types @@ -0,0 +1,128 @@ +=== tests/cases/compiler/ipromise2.ts === +declare module Windows.Foundation { +>Windows : Windows +>Foundation : Foundation + + export interface IPromise { +>IPromise : IPromise +>T : T + + then(success?: (value: T) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; +>then : { (success?: (value: T) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: T) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: T) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>U : U +>success : (value: T) => IPromise +>value : T +>T : T +>IPromise : IPromise +>U : U +>error : (error: any) => IPromise +>error : any +>IPromise : IPromise +>U : U +>progress : (progress: any) => void +>progress : any +>Windows : Windows +>Foundation : Foundation +>IPromise : IPromise +>U : U + + then(success?: (value: T) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; +>then : { (success?: (value: T) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: T) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: T) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>U : U +>success : (value: T) => IPromise +>value : T +>T : T +>IPromise : IPromise +>U : U +>error : (error: any) => U +>error : any +>U : U +>progress : (progress: any) => void +>progress : any +>Windows : Windows +>Foundation : Foundation +>IPromise : IPromise +>U : U + + then(success?: (value: T) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; +>then : { (success?: (value: T) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: T) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: T) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>U : U +>success : (value: T) => U +>value : T +>T : T +>U : U +>error : (error: any) => IPromise +>error : any +>IPromise : IPromise +>U : U +>progress : (progress: any) => void +>progress : any +>Windows : Windows +>Foundation : Foundation +>IPromise : IPromise +>U : U + + then(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; +>then : { (success?: (value: T) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: T) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: T) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>U : U +>success : (value: T) => U +>value : T +>T : T +>U : U +>error : (error: any) => U +>error : any +>U : U +>progress : (progress: any) => void +>progress : any +>Windows : Windows +>Foundation : Foundation +>IPromise : IPromise +>U : U + + done(success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void; +>done : (success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void) => void +>U : U +>success : (value: T) => any +>value : T +>T : T +>error : (error: any) => any +>error : any +>progress : (progress: any) => void +>progress : any + + value: T; +>value : T +>T : T + } +} + +var p: Windows.Foundation.IPromise; +>p : IPromise +>Windows : Windows +>Foundation : Foundation +>IPromise : IPromise + +var p2 = p.then(function (s) { +>p2 : IPromise +>p.then(function (s) { + return 34; +} ) : IPromise +>p.then : { (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>p : IPromise +>then : { (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>function (s) { + return 34; +} : (s: string) => number +>s : string + + return 34; +} ); + + +var x: number = p2.value; +>x : number +>p2.value : number +>p2 : IPromise +>value : number + + diff --git a/tests/baselines/reference/ipromise3.types b/tests/baselines/reference/ipromise3.types new file mode 100644 index 00000000000..0d2eb3d6d7a --- /dev/null +++ b/tests/baselines/reference/ipromise3.types @@ -0,0 +1,103 @@ +=== tests/cases/compiler/ipromise3.ts === +interface IPromise3 { +>IPromise3 : IPromise3 +>T : T + + then(success?: (value: T) => IPromise3, error?: (error: any) => IPromise3, progress?: (progress: any) => void ): IPromise3; +>then : { (success?: (value: T) => IPromise3, error?: (error: any) => IPromise3, progress?: (progress: any) => void): IPromise3; (success?: (value: T) => IPromise3, error?: (error: any) => U, progress?: (progress: any) => void): IPromise3; (success?: (value: T) => U, error?: (error: any) => IPromise3, progress?: (progress: any) => void): IPromise3; (success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise3; } +>U : U +>success : (value: T) => IPromise3 +>value : T +>T : T +>IPromise3 : IPromise3 +>U : U +>error : (error: any) => IPromise3 +>error : any +>IPromise3 : IPromise3 +>U : U +>progress : (progress: any) => void +>progress : any +>IPromise3 : IPromise3 +>U : U + + then(success?: (value: T) => IPromise3, error?: (error: any) => U, progress?: (progress: any) => void ): IPromise3; +>then : { (success?: (value: T) => IPromise3, error?: (error: any) => IPromise3, progress?: (progress: any) => void): IPromise3; (success?: (value: T) => IPromise3, error?: (error: any) => U, progress?: (progress: any) => void): IPromise3; (success?: (value: T) => U, error?: (error: any) => IPromise3, progress?: (progress: any) => void): IPromise3; (success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise3; } +>U : U +>success : (value: T) => IPromise3 +>value : T +>T : T +>IPromise3 : IPromise3 +>U : U +>error : (error: any) => U +>error : any +>U : U +>progress : (progress: any) => void +>progress : any +>IPromise3 : IPromise3 +>U : U + + then(success?: (value: T) => U, error?: (error: any) => IPromise3, progress?: (progress: any) => void ): IPromise3; +>then : { (success?: (value: T) => IPromise3, error?: (error: any) => IPromise3, progress?: (progress: any) => void): IPromise3; (success?: (value: T) => IPromise3, error?: (error: any) => U, progress?: (progress: any) => void): IPromise3; (success?: (value: T) => U, error?: (error: any) => IPromise3, progress?: (progress: any) => void): IPromise3; (success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise3; } +>U : U +>success : (value: T) => U +>value : T +>T : T +>U : U +>error : (error: any) => IPromise3 +>error : any +>IPromise3 : IPromise3 +>U : U +>progress : (progress: any) => void +>progress : any +>IPromise3 : IPromise3 +>U : U + + then(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void ): IPromise3; +>then : { (success?: (value: T) => IPromise3, error?: (error: any) => IPromise3, progress?: (progress: any) => void): IPromise3; (success?: (value: T) => IPromise3, error?: (error: any) => U, progress?: (progress: any) => void): IPromise3; (success?: (value: T) => U, error?: (error: any) => IPromise3, progress?: (progress: any) => void): IPromise3; (success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise3; } +>U : U +>success : (value: T) => U +>value : T +>T : T +>U : U +>error : (error: any) => U +>error : any +>U : U +>progress : (progress: any) => void +>progress : any +>IPromise3 : IPromise3 +>U : U + + done? (success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void; +>done : (success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void) => void +>U : U +>success : (value: T) => any +>value : T +>T : T +>error : (error: any) => any +>error : any +>progress : (progress: any) => void +>progress : any +} +var p1: IPromise3; +>p1 : IPromise3 +>IPromise3 : IPromise3 + +var p2: IPromise3 = p1.then(function (x) { +>p2 : IPromise3 +>IPromise3 : IPromise3 +>p1.then(function (x) { + return x; +}) : IPromise3 +>p1.then : { (success?: (value: string) => IPromise3, error?: (error: any) => IPromise3, progress?: (progress: any) => void): IPromise3; (success?: (value: string) => IPromise3, error?: (error: any) => U, progress?: (progress: any) => void): IPromise3; (success?: (value: string) => U, error?: (error: any) => IPromise3, progress?: (progress: any) => void): IPromise3; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise3; } +>p1 : IPromise3 +>then : { (success?: (value: string) => IPromise3, error?: (error: any) => IPromise3, progress?: (progress: any) => void): IPromise3; (success?: (value: string) => IPromise3, error?: (error: any) => U, progress?: (progress: any) => void): IPromise3; (success?: (value: string) => U, error?: (error: any) => IPromise3, progress?: (progress: any) => void): IPromise3; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise3; } +>function (x) { + return x; +} : (x: string) => string +>x : string + + return x; +>x : string + +}); + diff --git a/tests/baselines/reference/ipromise4.types b/tests/baselines/reference/ipromise4.types new file mode 100644 index 00000000000..9f37c62b236 --- /dev/null +++ b/tests/baselines/reference/ipromise4.types @@ -0,0 +1,123 @@ +=== tests/cases/compiler/ipromise4.ts === +declare module Windows.Foundation { +>Windows : Windows +>Foundation : Foundation + + export interface IPromise { +>IPromise : IPromise +>T : T + + then(success?: (value: T) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; +>then : { (success?: (value: T) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: T) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: T) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>U : U +>success : (value: T) => IPromise +>value : T +>T : T +>IPromise : IPromise +>U : U +>error : (error: any) => IPromise +>error : any +>IPromise : IPromise +>U : U +>progress : (progress: any) => void +>progress : any +>Windows : Windows +>Foundation : Foundation +>IPromise : IPromise +>U : U + + then(success?: (value: T) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; +>then : { (success?: (value: T) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: T) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: T) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>U : U +>success : (value: T) => IPromise +>value : T +>T : T +>IPromise : IPromise +>U : U +>error : (error: any) => U +>error : any +>U : U +>progress : (progress: any) => void +>progress : any +>Windows : Windows +>Foundation : Foundation +>IPromise : IPromise +>U : U + + then(success?: (value: T) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; +>then : { (success?: (value: T) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: T) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: T) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>U : U +>success : (value: T) => U +>value : T +>T : T +>U : U +>error : (error: any) => IPromise +>error : any +>IPromise : IPromise +>U : U +>progress : (progress: any) => void +>progress : any +>Windows : Windows +>Foundation : Foundation +>IPromise : IPromise +>U : U + + then(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; +>then : { (success?: (value: T) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: T) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: T) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>U : U +>success : (value: T) => U +>value : T +>T : T +>U : U +>error : (error: any) => U +>error : any +>U : U +>progress : (progress: any) => void +>progress : any +>Windows : Windows +>Foundation : Foundation +>IPromise : IPromise +>U : U + + done? (success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void; +>done : (success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void) => void +>U : U +>success : (value: T) => any +>value : T +>T : T +>error : (error: any) => any +>error : any +>progress : (progress: any) => void +>progress : any + } +} + +var p: Windows.Foundation.IPromise = null; +>p : IPromise +>Windows : Windows +>Foundation : Foundation +>IPromise : IPromise + +p.then(function (x) { } ); // should not error +>p.then(function (x) { } ) : IPromise +>p.then : { (success?: (value: number) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: number) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: number) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>p : IPromise +>then : { (success?: (value: number) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: number) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: number) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>function (x) { } : (x: number) => void +>x : number + +p.then(function (x) { return "hello"; } ).then(function (x) { return x } ); // should not error +>p.then(function (x) { return "hello"; } ).then(function (x) { return x } ) : IPromise +>p.then(function (x) { return "hello"; } ).then : { (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>p.then(function (x) { return "hello"; } ) : IPromise +>p.then : { (success?: (value: number) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: number) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: number) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>p : IPromise +>then : { (success?: (value: number) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: number) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: number) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>function (x) { return "hello"; } : (x: number) => string +>x : number +>then : { (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>function (x) { return x } : (x: string) => string +>x : string +>x : string + + diff --git a/tests/baselines/reference/isLiteral1.types b/tests/baselines/reference/isLiteral1.types new file mode 100644 index 00000000000..f26eab098b4 --- /dev/null +++ b/tests/baselines/reference/isLiteral1.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/isLiteral1.ts === +var x: number = 02343; +>x : number + diff --git a/tests/baselines/reference/isLiteral2.types b/tests/baselines/reference/isLiteral2.types new file mode 100644 index 00000000000..32c1b29f13e --- /dev/null +++ b/tests/baselines/reference/isLiteral2.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/isLiteral2.ts === +var x: number = 02343 +>x : number + diff --git a/tests/baselines/reference/keywordField.types b/tests/baselines/reference/keywordField.types new file mode 100644 index 00000000000..a5c465ae39c --- /dev/null +++ b/tests/baselines/reference/keywordField.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/keywordField.ts === +var obj:any = {}; +>obj : any +>{} : {} + +obj.if = 1; +>obj.if = 1 : number +>obj.if : any +>obj : any +>if : any + +var a = { if: "test" } +>a : { if: string; } +>{ if: "test" } : { if: string; } +>if : string + +var n = a.if +>n : string +>a.if : string +>a : { if: string; } +>if : string + +var q = a["if"]; +>q : string +>a["if"] : string +>a : { if: string; } + diff --git a/tests/baselines/reference/lambdaASIEmit.types b/tests/baselines/reference/lambdaASIEmit.types new file mode 100644 index 00000000000..acdbd777f23 --- /dev/null +++ b/tests/baselines/reference/lambdaASIEmit.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/lambdaASIEmit.ts === + +function Foo(x: any) +>Foo : (x: any) => void +>x : any +{ +} + +Foo(() => +>Foo(() => + // do something + 127) : void +>Foo : (x: any) => void +>() => + // do something + 127 : () => number + + // do something + 127); + diff --git a/tests/baselines/reference/lambdaExpression.types b/tests/baselines/reference/lambdaExpression.types new file mode 100644 index 00000000000..d550781ebf7 --- /dev/null +++ b/tests/baselines/reference/lambdaExpression.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/lambdaExpression.ts === +() => 0; // Needs to be wrapped in parens to be a valid expression (not declaration) +>() => 0 : () => number + +var y = 0; +>y : number + +(()=>0); +>(()=>0) : () => number +>()=>0 : () => number + +var x = 0; +>x : number + diff --git a/tests/baselines/reference/libdtsFix.types b/tests/baselines/reference/libdtsFix.types new file mode 100644 index 00000000000..4f94635d998 --- /dev/null +++ b/tests/baselines/reference/libdtsFix.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/libdtsFix.ts === +interface HTMLElement { +>HTMLElement : HTMLElement + + type: string; +>type : string +} + diff --git a/tests/baselines/reference/library_ArraySlice.types b/tests/baselines/reference/library_ArraySlice.types new file mode 100644 index 00000000000..f1309844913 --- /dev/null +++ b/tests/baselines/reference/library_ArraySlice.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/library_ArraySlice.ts === +// Array.prototype.slice can have zero, one, or two arguments +Array.prototype.slice(); +>Array.prototype.slice() : any[] +>Array.prototype.slice : (start?: number, end?: number) => any[] +>Array.prototype : any[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } +>prototype : any[] +>slice : (start?: number, end?: number) => any[] + +Array.prototype.slice(0); +>Array.prototype.slice(0) : any[] +>Array.prototype.slice : (start?: number, end?: number) => any[] +>Array.prototype : any[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } +>prototype : any[] +>slice : (start?: number, end?: number) => any[] + +Array.prototype.slice(0, 1); +>Array.prototype.slice(0, 1) : any[] +>Array.prototype.slice : (start?: number, end?: number) => any[] +>Array.prototype : any[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } +>prototype : any[] +>slice : (start?: number, end?: number) => any[] + diff --git a/tests/baselines/reference/library_DatePrototypeProperties.types b/tests/baselines/reference/library_DatePrototypeProperties.types new file mode 100644 index 00000000000..15f4c860fa5 --- /dev/null +++ b/tests/baselines/reference/library_DatePrototypeProperties.types @@ -0,0 +1,354 @@ +=== tests/cases/compiler/library_DatePrototypeProperties.ts === +// Properties of the Date prototype object as per ES5 spec +// http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.5 +Date.prototype.constructor; +>Date.prototype.constructor : Function +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>constructor : Function + +Date.prototype.toString(); +>Date.prototype.toString() : string +>Date.prototype.toString : () => string +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>toString : () => string + +Date.prototype.toDateString(); +>Date.prototype.toDateString() : string +>Date.prototype.toDateString : () => string +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>toDateString : () => string + +Date.prototype.toTimeString(); +>Date.prototype.toTimeString() : string +>Date.prototype.toTimeString : () => string +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>toTimeString : () => string + +Date.prototype.toLocaleString(); +>Date.prototype.toLocaleString() : string +>Date.prototype.toLocaleString : () => string +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>toLocaleString : () => string + +Date.prototype.toLocaleDateString(); +>Date.prototype.toLocaleDateString() : string +>Date.prototype.toLocaleDateString : () => string +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>toLocaleDateString : () => string + +Date.prototype.toLocaleTimeString(); +>Date.prototype.toLocaleTimeString() : string +>Date.prototype.toLocaleTimeString : () => string +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>toLocaleTimeString : () => string + +Date.prototype.valueOf(); +>Date.prototype.valueOf() : number +>Date.prototype.valueOf : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>valueOf : () => number + +Date.prototype.getTime(); +>Date.prototype.getTime() : number +>Date.prototype.getTime : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getTime : () => number + +Date.prototype.getFullYear(); +>Date.prototype.getFullYear() : number +>Date.prototype.getFullYear : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getFullYear : () => number + +Date.prototype.getUTCFullYear(); +>Date.prototype.getUTCFullYear() : number +>Date.prototype.getUTCFullYear : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getUTCFullYear : () => number + +Date.prototype.getMonth(); +>Date.prototype.getMonth() : number +>Date.prototype.getMonth : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getMonth : () => number + +Date.prototype.getUTCMonth(); +>Date.prototype.getUTCMonth() : number +>Date.prototype.getUTCMonth : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getUTCMonth : () => number + +Date.prototype.getDate(); +>Date.prototype.getDate() : number +>Date.prototype.getDate : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getDate : () => number + +Date.prototype.getUTCDate(); +>Date.prototype.getUTCDate() : number +>Date.prototype.getUTCDate : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getUTCDate : () => number + +Date.prototype.getDay(); +>Date.prototype.getDay() : number +>Date.prototype.getDay : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getDay : () => number + +Date.prototype.getUTCDay(); +>Date.prototype.getUTCDay() : number +>Date.prototype.getUTCDay : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getUTCDay : () => number + +Date.prototype.getHours(); +>Date.prototype.getHours() : number +>Date.prototype.getHours : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getHours : () => number + +Date.prototype.getUTCHours(); +>Date.prototype.getUTCHours() : number +>Date.prototype.getUTCHours : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getUTCHours : () => number + +Date.prototype.getMinutes(); +>Date.prototype.getMinutes() : number +>Date.prototype.getMinutes : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getMinutes : () => number + +Date.prototype.getUTCMinutes(); +>Date.prototype.getUTCMinutes() : number +>Date.prototype.getUTCMinutes : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getUTCMinutes : () => number + +Date.prototype.getSeconds(); +>Date.prototype.getSeconds() : number +>Date.prototype.getSeconds : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getSeconds : () => number + +Date.prototype.getUTCSeconds(); +>Date.prototype.getUTCSeconds() : number +>Date.prototype.getUTCSeconds : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getUTCSeconds : () => number + +Date.prototype.getMilliseconds(); +>Date.prototype.getMilliseconds() : number +>Date.prototype.getMilliseconds : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getMilliseconds : () => number + +Date.prototype.getUTCMilliseconds(); +>Date.prototype.getUTCMilliseconds() : number +>Date.prototype.getUTCMilliseconds : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getUTCMilliseconds : () => number + +Date.prototype.getTimezoneOffset(); +>Date.prototype.getTimezoneOffset() : number +>Date.prototype.getTimezoneOffset : () => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>getTimezoneOffset : () => number + +Date.prototype.setTime(0); +>Date.prototype.setTime(0) : number +>Date.prototype.setTime : (time: number) => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>setTime : (time: number) => number + +Date.prototype.setMilliseconds(0); +>Date.prototype.setMilliseconds(0) : number +>Date.prototype.setMilliseconds : (ms: number) => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>setMilliseconds : (ms: number) => number + +Date.prototype.setUTCMilliseconds(0); +>Date.prototype.setUTCMilliseconds(0) : number +>Date.prototype.setUTCMilliseconds : (ms: number) => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>setUTCMilliseconds : (ms: number) => number + +Date.prototype.setSeconds(0); +>Date.prototype.setSeconds(0) : number +>Date.prototype.setSeconds : (sec: number, ms?: number) => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>setSeconds : (sec: number, ms?: number) => number + +Date.prototype.setUTCSeconds(0); +>Date.prototype.setUTCSeconds(0) : number +>Date.prototype.setUTCSeconds : (sec: number, ms?: number) => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>setUTCSeconds : (sec: number, ms?: number) => number + +Date.prototype.setMinutes(0); +>Date.prototype.setMinutes(0) : number +>Date.prototype.setMinutes : (min: number, sec?: number, ms?: number) => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>setMinutes : (min: number, sec?: number, ms?: number) => number + +Date.prototype.setUTCMinutes(0); +>Date.prototype.setUTCMinutes(0) : number +>Date.prototype.setUTCMinutes : (min: number, sec?: number, ms?: number) => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>setUTCMinutes : (min: number, sec?: number, ms?: number) => number + +Date.prototype.setHours(0); +>Date.prototype.setHours(0) : number +>Date.prototype.setHours : (hours: number, min?: number, sec?: number, ms?: number) => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>setHours : (hours: number, min?: number, sec?: number, ms?: number) => number + +Date.prototype.setUTCHours(0); +>Date.prototype.setUTCHours(0) : number +>Date.prototype.setUTCHours : (hours: number, min?: number, sec?: number, ms?: number) => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>setUTCHours : (hours: number, min?: number, sec?: number, ms?: number) => number + +Date.prototype.setDate(0); +>Date.prototype.setDate(0) : number +>Date.prototype.setDate : (date: number) => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>setDate : (date: number) => number + +Date.prototype.setUTCDate(0); +>Date.prototype.setUTCDate(0) : number +>Date.prototype.setUTCDate : (date: number) => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>setUTCDate : (date: number) => number + +Date.prototype.setMonth(0); +>Date.prototype.setMonth(0) : number +>Date.prototype.setMonth : (month: number, date?: number) => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>setMonth : (month: number, date?: number) => number + +Date.prototype.setUTCMonth(0); +>Date.prototype.setUTCMonth(0) : number +>Date.prototype.setUTCMonth : (month: number, date?: number) => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>setUTCMonth : (month: number, date?: number) => number + +Date.prototype.setFullYear(0); +>Date.prototype.setFullYear(0) : number +>Date.prototype.setFullYear : (year: number, month?: number, date?: number) => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>setFullYear : (year: number, month?: number, date?: number) => number + +Date.prototype.setUTCFullYear(0); +>Date.prototype.setUTCFullYear(0) : number +>Date.prototype.setUTCFullYear : (year: number, month?: number, date?: number) => number +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>setUTCFullYear : (year: number, month?: number, date?: number) => number + +Date.prototype.toUTCString(); +>Date.prototype.toUTCString() : string +>Date.prototype.toUTCString : () => string +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>toUTCString : () => string + +Date.prototype.toISOString(); +>Date.prototype.toISOString() : string +>Date.prototype.toISOString : () => string +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>toISOString : () => string + +Date.prototype.toJSON(null); +>Date.prototype.toJSON(null) : string +>Date.prototype.toJSON : (key?: any) => string +>Date.prototype : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } +>prototype : Date +>toJSON : (key?: any) => string + diff --git a/tests/baselines/reference/library_ObjectPrototypeProperties.types b/tests/baselines/reference/library_ObjectPrototypeProperties.types new file mode 100644 index 00000000000..447d855778f --- /dev/null +++ b/tests/baselines/reference/library_ObjectPrototypeProperties.types @@ -0,0 +1,59 @@ +=== tests/cases/compiler/library_ObjectPrototypeProperties.ts === +// Properties of the Object Prototype Object as per ES5 spec +// http://www.ecma-international.org/ecma-262/5.1/#sec-15.2.4 +Object.prototype.constructor; +>Object.prototype.constructor : Function +>Object.prototype : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } +>prototype : Object +>constructor : Function + +Object.prototype.toString(); +>Object.prototype.toString() : string +>Object.prototype.toString : () => string +>Object.prototype : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } +>prototype : Object +>toString : () => string + +Object.prototype.toLocaleString(); +>Object.prototype.toLocaleString() : string +>Object.prototype.toLocaleString : () => string +>Object.prototype : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } +>prototype : Object +>toLocaleString : () => string + +Object.prototype.valueOf(); +>Object.prototype.valueOf() : Object +>Object.prototype.valueOf : () => Object +>Object.prototype : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } +>prototype : Object +>valueOf : () => Object + +Object.prototype.hasOwnProperty("string"); +>Object.prototype.hasOwnProperty("string") : boolean +>Object.prototype.hasOwnProperty : (v: string) => boolean +>Object.prototype : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } +>prototype : Object +>hasOwnProperty : (v: string) => boolean + +Object.prototype.isPrototypeOf(Object); +>Object.prototype.isPrototypeOf(Object) : boolean +>Object.prototype.isPrototypeOf : (v: Object) => boolean +>Object.prototype : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } +>prototype : Object +>isPrototypeOf : (v: Object) => boolean +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } + +Object.prototype.propertyIsEnumerable("string"); +>Object.prototype.propertyIsEnumerable("string") : boolean +>Object.prototype.propertyIsEnumerable : (v: string) => boolean +>Object.prototype : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } +>prototype : Object +>propertyIsEnumerable : (v: string) => boolean + diff --git a/tests/baselines/reference/library_RegExpExecArraySlice.types b/tests/baselines/reference/library_RegExpExecArraySlice.types new file mode 100644 index 00000000000..ba5c3ccfb21 --- /dev/null +++ b/tests/baselines/reference/library_RegExpExecArraySlice.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/library_RegExpExecArraySlice.ts === +// RegExpExecArray.slice can have zero, one, or two arguments +var regExpExecArrayValue: RegExpExecArray; +>regExpExecArrayValue : RegExpExecArray +>RegExpExecArray : RegExpExecArray + +regExpExecArrayValue.slice(); +>regExpExecArrayValue.slice() : string[] +>regExpExecArrayValue.slice : (start?: number, end?: number) => string[] +>regExpExecArrayValue : RegExpExecArray +>slice : (start?: number, end?: number) => string[] + +regExpExecArrayValue.slice(0); +>regExpExecArrayValue.slice(0) : string[] +>regExpExecArrayValue.slice : (start?: number, end?: number) => string[] +>regExpExecArrayValue : RegExpExecArray +>slice : (start?: number, end?: number) => string[] + +regExpExecArrayValue.slice(0,1); +>regExpExecArrayValue.slice(0,1) : string[] +>regExpExecArrayValue.slice : (start?: number, end?: number) => string[] +>regExpExecArrayValue : RegExpExecArray +>slice : (start?: number, end?: number) => string[] + diff --git a/tests/baselines/reference/library_StringSlice.types b/tests/baselines/reference/library_StringSlice.types new file mode 100644 index 00000000000..4733ab39908 --- /dev/null +++ b/tests/baselines/reference/library_StringSlice.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/library_StringSlice.ts === +// String.prototype.slice can have zero, one, or two arguments +String.prototype.slice(); +>String.prototype.slice() : string +>String.prototype.slice : (start?: number, end?: number) => string +>String.prototype : String +>String : { (value?: any): string; new (value?: any): String; prototype: String; fromCharCode(...codes: number[]): string; } +>prototype : String +>slice : (start?: number, end?: number) => string + +String.prototype.slice(0); +>String.prototype.slice(0) : string +>String.prototype.slice : (start?: number, end?: number) => string +>String.prototype : String +>String : { (value?: any): string; new (value?: any): String; prototype: String; fromCharCode(...codes: number[]): string; } +>prototype : String +>slice : (start?: number, end?: number) => string + +String.prototype.slice(0,1); +>String.prototype.slice(0,1) : string +>String.prototype.slice : (start?: number, end?: number) => string +>String.prototype : String +>String : { (value?: any): string; new (value?: any): String; prototype: String; fromCharCode(...codes: number[]): string; } +>prototype : String +>slice : (start?: number, end?: number) => string + diff --git a/tests/baselines/reference/listFailure.types b/tests/baselines/reference/listFailure.types new file mode 100644 index 00000000000..febff9b9dd5 --- /dev/null +++ b/tests/baselines/reference/listFailure.types @@ -0,0 +1,127 @@ +=== tests/cases/compiler/listFailure.ts === +module Editor { +>Editor : typeof Editor + + export class Buffer { +>Buffer : Buffer + + lines: List = ListMakeHead(); +>lines : List +>List : List +>Line : Line +>ListMakeHead() : List +>ListMakeHead : () => List +>Line : Line + + addLine(lineText: string): List { +>addLine : (lineText: string) => List +>lineText : string +>List : List +>Line : Line + + var line: Line = new Line(); +>line : Line +>Line : Line +>new Line() : Line +>Line : typeof Line + + var lineEntry = this.lines.add(line); +>lineEntry : List +>this.lines.add(line) : List +>this.lines.add : (data: Line) => List +>this.lines : List +>this : Buffer +>lines : List +>add : (data: Line) => List +>line : Line + + return lineEntry; +>lineEntry : List + } + } + + export function ListRemoveEntry(entry: List): List { +>ListRemoveEntry : (entry: List) => List +>U : U +>entry : List +>List : List +>U : U +>List : List +>U : U + + return entry; +>entry : List + } + + export function ListMakeHead(): List { +>ListMakeHead : () => List +>U : U +>List : List +>U : U + + return null; + } + + export function ListMakeEntry(data: U): List { +>ListMakeEntry : (data: U) => List +>U : U +>data : U +>U : U +>List : List +>U : U + + return null; + } + + class List { +>List : List +>T : T + + public next: List; +>next : List +>List : List +>T : T + + add(data: T): List { +>add : (data: T) => List +>data : T +>T : T +>List : List +>T : T + + this.next = ListMakeEntry(data); +>this.next = ListMakeEntry(data) : List +>this.next : List +>this : List +>next : List +>ListMakeEntry(data) : List +>ListMakeEntry : (data: U) => List +>data : T + + return this.next; +>this.next : List +>this : List +>next : List + } + + popEntry(head: List): List { +>popEntry : (head: List) => List +>head : List +>List : List +>T : T +>List : List +>T : T + + return (ListRemoveEntry(this.next)); +>(ListRemoveEntry(this.next)) : List +>ListRemoveEntry(this.next) : List +>ListRemoveEntry : (entry: List) => List +>this.next : List +>this : List +>next : List + } + } + + export class Line {} +>Line : Line +} diff --git a/tests/baselines/reference/literals1.types b/tests/baselines/reference/literals1.types new file mode 100644 index 00000000000..b7c5d672eea --- /dev/null +++ b/tests/baselines/reference/literals1.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/literals1.ts === +var a = 42; +>a : number + +var b = 0xFA34; +>b : number + +var c = 0.1715; +>c : number + +var d = 3.14E5; +>d : number + +var e = 8.14e-5; +>e : number + +var f = true; +>f : boolean + +var g = false; +>g : boolean + +var h = ""; +>h : string + +var i = "hi"; +>i : string + +var j = ''; +>j : string + +var k = 'q\tq'; +>k : string + +var m = /q/; +>m : RegExp +>/q/ : RegExp + +var n = /\d+/g; +>n : RegExp +>/\d+/g : RegExp + +var o = /[3-5]+/i; +>o : RegExp +>/[3-5]+/i : RegExp + diff --git a/tests/baselines/reference/localAliasExportAssignment.types b/tests/baselines/reference/localAliasExportAssignment.types new file mode 100644 index 00000000000..5ea0d3085c1 --- /dev/null +++ b/tests/baselines/reference/localAliasExportAssignment.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/localAliasExportAssignment_1.ts === +/// +import connect = require('localAliasExportAssignment_0'); +>connect : () => any + +connect(); +>connect() : any +>connect : () => any + + + +=== tests/cases/compiler/localAliasExportAssignment_0.ts === +var server: { +>server : () => any + + (): any; +}; + +export = server; +>server : () => any + diff --git a/tests/baselines/reference/localImportNameVsGlobalName.types b/tests/baselines/reference/localImportNameVsGlobalName.types new file mode 100644 index 00000000000..87c546850aa --- /dev/null +++ b/tests/baselines/reference/localImportNameVsGlobalName.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/localImportNameVsGlobalName.ts === +module Keyboard { +>Keyboard : typeof Keyboard + + export enum Key { UP, DOWN, LEFT, RIGHT } +>Key : Key +>UP : Key +>DOWN : Key +>LEFT : Key +>RIGHT : Key +} + +module App { +>App : typeof App + + import Key = Keyboard.Key; +>Key : typeof Key +>Keyboard : Key +>Key : Key + + export function foo(key: Key): void {} +>foo : (key: Key) => void +>key : Key +>Key : Key + + foo(Key.UP); +>foo(Key.UP) : void +>foo : (key: Key) => void +>Key.UP : Key +>Key : typeof Key +>UP : Key + + foo(Key.DOWN); +>foo(Key.DOWN) : void +>foo : (key: Key) => void +>Key.DOWN : Key +>Key : typeof Key +>DOWN : Key + + foo(Key.LEFT); +>foo(Key.LEFT) : void +>foo : (key: Key) => void +>Key.LEFT : Key +>Key : typeof Key +>LEFT : Key +} diff --git a/tests/baselines/reference/localVariablesReturnedFromCatchBlocks.types b/tests/baselines/reference/localVariablesReturnedFromCatchBlocks.types new file mode 100644 index 00000000000..81ee0ddc74a --- /dev/null +++ b/tests/baselines/reference/localVariablesReturnedFromCatchBlocks.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/localVariablesReturnedFromCatchBlocks.ts === +function f() { +>f : () => any + + try { + } catch (e) { +>e : any + + var stack2 = e.stack; +>stack2 : any +>e.stack : any +>e : any +>stack : any + + return stack2; //error TS2095: Could not find symbol 'stack2'. +>stack2 : any + } +} diff --git a/tests/baselines/reference/logicalAndOperatorWithEveryType.types b/tests/baselines/reference/logicalAndOperatorWithEveryType.types new file mode 100644 index 00000000000..54f04926e98 --- /dev/null +++ b/tests/baselines/reference/logicalAndOperatorWithEveryType.types @@ -0,0 +1,615 @@ +=== tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAndOperatorWithEveryType.ts === +// The && operator permits the operands to be of any type and produces a result of the same +// type as the second operand. + +enum E { a, b, c } +>E : E +>a : E +>b : E +>c : E + +var a1: any; +>a1 : any + +var a2: boolean; +>a2 : boolean + +var a3: number +>a3 : number + +var a4: string; +>a4 : string + +var a5: void; +>a5 : void + +var a6: E; +>a6 : E +>E : E + +var a7: {}; +>a7 : {} + +var a8: string[]; +>a8 : string[] + +var ra1 = a1 && a1; +>ra1 : any +>a1 && a1 : any +>a1 : any +>a1 : any + +var ra2 = a2 && a1; +>ra2 : any +>a2 && a1 : any +>a2 : boolean +>a1 : any + +var ra3 = a3 && a1; +>ra3 : any +>a3 && a1 : any +>a3 : number +>a1 : any + +var ra4 = a4 && a1; +>ra4 : any +>a4 && a1 : any +>a4 : string +>a1 : any + +var ra5 = a5 && a1; +>ra5 : any +>a5 && a1 : any +>a5 : void +>a1 : any + +var ra6 = a6 && a1; +>ra6 : any +>a6 && a1 : any +>a6 : E +>a1 : any + +var ra7 = a7 && a1; +>ra7 : any +>a7 && a1 : any +>a7 : {} +>a1 : any + +var ra8 = a8 && a1; +>ra8 : any +>a8 && a1 : any +>a8 : string[] +>a1 : any + +var ra9 = null && a1; +>ra9 : any +>null && a1 : any +>a1 : any + +var ra10 = undefined && a1; +>ra10 : any +>undefined && a1 : any +>undefined : undefined +>a1 : any + +var rb1 = a1 && a2; +>rb1 : boolean +>a1 && a2 : boolean +>a1 : any +>a2 : boolean + +var rb2 = a2 && a2; +>rb2 : boolean +>a2 && a2 : boolean +>a2 : boolean +>a2 : boolean + +var rb3 = a3 && a2; +>rb3 : boolean +>a3 && a2 : boolean +>a3 : number +>a2 : boolean + +var rb4 = a4 && a2; +>rb4 : boolean +>a4 && a2 : boolean +>a4 : string +>a2 : boolean + +var rb5 = a5 && a2; +>rb5 : boolean +>a5 && a2 : boolean +>a5 : void +>a2 : boolean + +var rb6 = a6 && a2; +>rb6 : boolean +>a6 && a2 : boolean +>a6 : E +>a2 : boolean + +var rb7 = a7 && a2; +>rb7 : boolean +>a7 && a2 : boolean +>a7 : {} +>a2 : boolean + +var rb8 = a8 && a2; +>rb8 : boolean +>a8 && a2 : boolean +>a8 : string[] +>a2 : boolean + +var rb9 = null && a2; +>rb9 : boolean +>null && a2 : boolean +>a2 : boolean + +var rb10 = undefined && a2; +>rb10 : boolean +>undefined && a2 : boolean +>undefined : undefined +>a2 : boolean + +var rc1 = a1 && a3; +>rc1 : number +>a1 && a3 : number +>a1 : any +>a3 : number + +var rc2 = a2 && a3; +>rc2 : number +>a2 && a3 : number +>a2 : boolean +>a3 : number + +var rc3 = a3 && a3; +>rc3 : number +>a3 && a3 : number +>a3 : number +>a3 : number + +var rc4 = a4 && a3; +>rc4 : number +>a4 && a3 : number +>a4 : string +>a3 : number + +var rc5 = a5 && a3; +>rc5 : number +>a5 && a3 : number +>a5 : void +>a3 : number + +var rc6 = a6 && a3; +>rc6 : number +>a6 && a3 : number +>a6 : E +>a3 : number + +var rc7 = a7 && a3; +>rc7 : number +>a7 && a3 : number +>a7 : {} +>a3 : number + +var rc8 = a8 && a3; +>rc8 : number +>a8 && a3 : number +>a8 : string[] +>a3 : number + +var rc9 = null && a3; +>rc9 : number +>null && a3 : number +>a3 : number + +var rc10 = undefined && a3; +>rc10 : number +>undefined && a3 : number +>undefined : undefined +>a3 : number + +var rd1 = a1 && a4; +>rd1 : string +>a1 && a4 : string +>a1 : any +>a4 : string + +var rd2 = a2 && a4; +>rd2 : string +>a2 && a4 : string +>a2 : boolean +>a4 : string + +var rd3 = a3 && a4; +>rd3 : string +>a3 && a4 : string +>a3 : number +>a4 : string + +var rd4 = a4 && a4; +>rd4 : string +>a4 && a4 : string +>a4 : string +>a4 : string + +var rd5 = a5 && a4; +>rd5 : string +>a5 && a4 : string +>a5 : void +>a4 : string + +var rd6 = a6 && a4; +>rd6 : string +>a6 && a4 : string +>a6 : E +>a4 : string + +var rd7 = a7 && a4; +>rd7 : string +>a7 && a4 : string +>a7 : {} +>a4 : string + +var rd8 = a8 && a4; +>rd8 : string +>a8 && a4 : string +>a8 : string[] +>a4 : string + +var rd9 = null && a4; +>rd9 : string +>null && a4 : string +>a4 : string + +var rd10 = undefined && a4; +>rd10 : string +>undefined && a4 : string +>undefined : undefined +>a4 : string + +var re1 = a1 && a5; +>re1 : void +>a1 && a5 : void +>a1 : any +>a5 : void + +var re2 = a2 && a5; +>re2 : void +>a2 && a5 : void +>a2 : boolean +>a5 : void + +var re3 = a3 && a5; +>re3 : void +>a3 && a5 : void +>a3 : number +>a5 : void + +var re4 = a4 && a5; +>re4 : void +>a4 && a5 : void +>a4 : string +>a5 : void + +var re5 = a5 && a5; +>re5 : void +>a5 && a5 : void +>a5 : void +>a5 : void + +var re6 = a6 && a5; +>re6 : void +>a6 && a5 : void +>a6 : E +>a5 : void + +var re7 = a7 && a5; +>re7 : void +>a7 && a5 : void +>a7 : {} +>a5 : void + +var re8 = a8 && a5; +>re8 : void +>a8 && a5 : void +>a8 : string[] +>a5 : void + +var re9 = null && a5; +>re9 : void +>null && a5 : void +>a5 : void + +var re10 = undefined && a5; +>re10 : void +>undefined && a5 : void +>undefined : undefined +>a5 : void + +var rf1 = a1 && a6; +>rf1 : E +>a1 && a6 : E +>a1 : any +>a6 : E + +var rf2 = a2 && a6; +>rf2 : E +>a2 && a6 : E +>a2 : boolean +>a6 : E + +var rf3 = a3 && a6; +>rf3 : E +>a3 && a6 : E +>a3 : number +>a6 : E + +var rf4 = a4 && a6; +>rf4 : E +>a4 && a6 : E +>a4 : string +>a6 : E + +var rf5 = a5 && a6; +>rf5 : E +>a5 && a6 : E +>a5 : void +>a6 : E + +var rf6 = a6 && a6; +>rf6 : E +>a6 && a6 : E +>a6 : E +>a6 : E + +var rf7 = a7 && a6; +>rf7 : E +>a7 && a6 : E +>a7 : {} +>a6 : E + +var rf8 = a8 && a6; +>rf8 : E +>a8 && a6 : E +>a8 : string[] +>a6 : E + +var rf9 = null && a6; +>rf9 : E +>null && a6 : E +>a6 : E + +var rf10 = undefined && a6; +>rf10 : E +>undefined && a6 : E +>undefined : undefined +>a6 : E + +var rg1 = a1 && a7; +>rg1 : {} +>a1 && a7 : {} +>a1 : any +>a7 : {} + +var rg2 = a2 && a7; +>rg2 : {} +>a2 && a7 : {} +>a2 : boolean +>a7 : {} + +var rg3 = a3 && a7; +>rg3 : {} +>a3 && a7 : {} +>a3 : number +>a7 : {} + +var rg4 = a4 && a7; +>rg4 : {} +>a4 && a7 : {} +>a4 : string +>a7 : {} + +var rg5 = a5 && a7; +>rg5 : {} +>a5 && a7 : {} +>a5 : void +>a7 : {} + +var rg6 = a6 && a7; +>rg6 : {} +>a6 && a7 : {} +>a6 : E +>a7 : {} + +var rg7 = a7 && a7; +>rg7 : {} +>a7 && a7 : {} +>a7 : {} +>a7 : {} + +var rg8 = a8 && a7; +>rg8 : {} +>a8 && a7 : {} +>a8 : string[] +>a7 : {} + +var rg9 = null && a7; +>rg9 : {} +>null && a7 : {} +>a7 : {} + +var rg10 = undefined && a7; +>rg10 : {} +>undefined && a7 : {} +>undefined : undefined +>a7 : {} + +var rh1 = a1 && a8; +>rh1 : string[] +>a1 && a8 : string[] +>a1 : any +>a8 : string[] + +var rh2 = a2 && a8; +>rh2 : string[] +>a2 && a8 : string[] +>a2 : boolean +>a8 : string[] + +var rh3 = a3 && a8; +>rh3 : string[] +>a3 && a8 : string[] +>a3 : number +>a8 : string[] + +var rh4 = a4 && a8; +>rh4 : string[] +>a4 && a8 : string[] +>a4 : string +>a8 : string[] + +var rh5 = a5 && a8; +>rh5 : string[] +>a5 && a8 : string[] +>a5 : void +>a8 : string[] + +var rh6 = a6 && a8; +>rh6 : string[] +>a6 && a8 : string[] +>a6 : E +>a8 : string[] + +var rh7 = a7 && a8; +>rh7 : string[] +>a7 && a8 : string[] +>a7 : {} +>a8 : string[] + +var rh8 = a8 && a8; +>rh8 : string[] +>a8 && a8 : string[] +>a8 : string[] +>a8 : string[] + +var rh9 = null && a8; +>rh9 : string[] +>null && a8 : string[] +>a8 : string[] + +var rh10 = undefined && a8; +>rh10 : string[] +>undefined && a8 : string[] +>undefined : undefined +>a8 : string[] + +var ri1 = a1 && null; +>ri1 : any +>a1 && null : null +>a1 : any + +var ri2 = a2 && null; +>ri2 : any +>a2 && null : null +>a2 : boolean + +var ri3 = a3 && null; +>ri3 : any +>a3 && null : null +>a3 : number + +var ri4 = a4 && null; +>ri4 : any +>a4 && null : null +>a4 : string + +var ri5 = a5 && null; +>ri5 : any +>a5 && null : null +>a5 : void + +var ri6 = a6 && null; +>ri6 : any +>a6 && null : null +>a6 : E + +var ri7 = a7 && null; +>ri7 : any +>a7 && null : null +>a7 : {} + +var ri8 = a8 && null; +>ri8 : any +>a8 && null : null +>a8 : string[] + +var ri9 = null && null; +>ri9 : any +>null && null : null + +var ri10 = undefined && null; +>ri10 : any +>undefined && null : null +>undefined : undefined + +var rj1 = a1 && undefined; +>rj1 : any +>a1 && undefined : undefined +>a1 : any +>undefined : undefined + +var rj2 = a2 && undefined; +>rj2 : any +>a2 && undefined : undefined +>a2 : boolean +>undefined : undefined + +var rj3 = a3 && undefined; +>rj3 : any +>a3 && undefined : undefined +>a3 : number +>undefined : undefined + +var rj4 = a4 && undefined; +>rj4 : any +>a4 && undefined : undefined +>a4 : string +>undefined : undefined + +var rj5 = a5 && undefined; +>rj5 : any +>a5 && undefined : undefined +>a5 : void +>undefined : undefined + +var rj6 = a6 && undefined; +>rj6 : any +>a6 && undefined : undefined +>a6 : E +>undefined : undefined + +var rj7 = a7 && undefined; +>rj7 : any +>a7 && undefined : undefined +>a7 : {} +>undefined : undefined + +var rj8 = a8 && undefined; +>rj8 : any +>a8 && undefined : undefined +>a8 : string[] +>undefined : undefined + +var rj9 = null && undefined; +>rj9 : any +>null && undefined : undefined +>undefined : undefined + +var rj10 = undefined && undefined; +>rj10 : any +>undefined && undefined : undefined +>undefined : undefined +>undefined : undefined + diff --git a/tests/baselines/reference/logicalAndOperatorWithTypeParameters.types b/tests/baselines/reference/logicalAndOperatorWithTypeParameters.types new file mode 100644 index 00000000000..f77b231c6bc --- /dev/null +++ b/tests/baselines/reference/logicalAndOperatorWithTypeParameters.types @@ -0,0 +1,79 @@ +=== tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAndOperatorWithTypeParameters.ts === +// The && operator permits the operands to be of any type and produces a result of the same +// type as the second operand. + +function foo(t: T, u: U, v: V) { +>foo : (t: T, u: U, v: V) => void +>T : T +>U : U +>V : V +>t : T +>T : T +>u : U +>U : U +>v : V +>V : V + + var r1 = t && t; +>r1 : T +>t && t : T +>t : T +>t : T + + var r2 = u && t; +>r2 : T +>u && t : T +>u : U +>t : T + + var r3 = v && t; +>r3 : T +>v && t : T +>v : V +>t : T + + var r4 = t && u; +>r4 : U +>t && u : U +>t : T +>u : U + + var r5 = u && u; +>r5 : U +>u && u : U +>u : U +>u : U + + var r6 = v && u; +>r6 : U +>v && u : U +>v : V +>u : U + + var r7 = t && v; +>r7 : V +>t && v : V +>t : T +>v : V + + var r8 = u && v; +>r8 : V +>u && v : V +>u : U +>v : V + + var r9 = v && v; +>r9 : V +>v && v : V +>v : V +>v : V + + var a: number; +>a : number + + var r10 = t && a; +>r10 : number +>t && a : number +>t : T +>a : number +} diff --git a/tests/baselines/reference/logicalNotOperatorWithBooleanType.types b/tests/baselines/reference/logicalNotOperatorWithBooleanType.types new file mode 100644 index 00000000000..e232ae2af80 --- /dev/null +++ b/tests/baselines/reference/logicalNotOperatorWithBooleanType.types @@ -0,0 +1,112 @@ +=== tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithBooleanType.ts === +// ! operator on boolean type +var BOOLEAN: boolean; +>BOOLEAN : boolean + +function foo(): boolean { return true; } +>foo : () => boolean + +class A { +>A : A + + public a: boolean; +>a : boolean + + static foo() { return false; } +>foo : () => boolean +} +module M { +>M : typeof M + + export var n: boolean; +>n : boolean +} + +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// boolean type var +var ResultIsBoolean1 = !BOOLEAN; +>ResultIsBoolean1 : boolean +>!BOOLEAN : boolean +>BOOLEAN : boolean + +// boolean type literal +var ResultIsBoolean2 = !true; +>ResultIsBoolean2 : boolean +>!true : boolean + +var ResultIsBoolean3 = !{ x: true, y: false }; +>ResultIsBoolean3 : boolean +>!{ x: true, y: false } : boolean +>{ x: true, y: false } : { x: boolean; y: boolean; } +>x : boolean +>y : boolean + +// boolean type expressions +var ResultIsBoolean4 = !objA.a; +>ResultIsBoolean4 : boolean +>!objA.a : boolean +>objA.a : boolean +>objA : A +>a : boolean + +var ResultIsBoolean5 = !M.n; +>ResultIsBoolean5 : boolean +>!M.n : boolean +>M.n : boolean +>M : typeof M +>n : boolean + +var ResultIsBoolean6 = !foo(); +>ResultIsBoolean6 : boolean +>!foo() : boolean +>foo() : boolean +>foo : () => boolean + +var ResultIsBoolean7 = !A.foo(); +>ResultIsBoolean7 : boolean +>!A.foo() : boolean +>A.foo() : boolean +>A.foo : () => boolean +>A : typeof A +>foo : () => boolean + +// multiple ! operators +var ResultIsBoolean = !!BOOLEAN; +>ResultIsBoolean : boolean +>!!BOOLEAN : boolean +>!BOOLEAN : boolean +>BOOLEAN : boolean + +// miss assignment operators +!true; +>!true : boolean + +!BOOLEAN; +>!BOOLEAN : boolean +>BOOLEAN : boolean + +!foo(); +>!foo() : boolean +>foo() : boolean +>foo : () => boolean + +!true, false; +>!true, false : boolean +>!true : boolean + +!objA.a; +>!objA.a : boolean +>objA.a : boolean +>objA : A +>a : boolean + +!M.n; +>!M.n : boolean +>M.n : boolean +>M : typeof M +>n : boolean + diff --git a/tests/baselines/reference/logicalNotOperatorWithEnumType.types b/tests/baselines/reference/logicalNotOperatorWithEnumType.types new file mode 100644 index 00000000000..27cbb24d3bb --- /dev/null +++ b/tests/baselines/reference/logicalNotOperatorWithEnumType.types @@ -0,0 +1,71 @@ +=== tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType.ts === +// ! operator on enum type + +enum ENUM { 1, 2, 3 }; +>ENUM : ENUM + +enum ENUM1 { }; +>ENUM1 : ENUM1 + +// enum type var +var ResultIsBoolean1 = !ENUM; +>ResultIsBoolean1 : boolean +>!ENUM : boolean +>ENUM : typeof ENUM + +// enum type expressions +var ResultIsBoolean2 = !ENUM[1]; +>ResultIsBoolean2 : boolean +>!ENUM[1] : boolean +>ENUM[1] : ENUM +>ENUM : typeof ENUM + +var ResultIsBoolean3 = !(ENUM[1] + ENUM[2]); +>ResultIsBoolean3 : boolean +>!(ENUM[1] + ENUM[2]) : boolean +>(ENUM[1] + ENUM[2]) : number +>ENUM[1] + ENUM[2] : number +>ENUM[1] : ENUM +>ENUM : typeof ENUM +>ENUM[2] : ENUM +>ENUM : typeof ENUM + +// multiple ! operators +var ResultIsBoolean4 = !!ENUM; +>ResultIsBoolean4 : boolean +>!!ENUM : boolean +>!ENUM : boolean +>ENUM : typeof ENUM + +var ResultIsBoolean5 = !!!(ENUM[1] + ENUM[2]); +>ResultIsBoolean5 : boolean +>!!!(ENUM[1] + ENUM[2]) : boolean +>!!(ENUM[1] + ENUM[2]) : boolean +>!(ENUM[1] + ENUM[2]) : boolean +>(ENUM[1] + ENUM[2]) : number +>ENUM[1] + ENUM[2] : number +>ENUM[1] : ENUM +>ENUM : typeof ENUM +>ENUM[2] : ENUM +>ENUM : typeof ENUM + +// miss assignment operators +!ENUM; +>!ENUM : boolean +>ENUM : typeof ENUM + +!ENUM1; +>!ENUM1 : boolean +>ENUM1 : typeof ENUM1 + +!ENUM[1]; +>!ENUM[1] : boolean +>ENUM[1] : ENUM +>ENUM : typeof ENUM + +!ENUM, ENUM1; +>!ENUM, ENUM1 : typeof ENUM1 +>!ENUM : boolean +>ENUM : typeof ENUM +>ENUM1 : typeof ENUM1 + diff --git a/tests/baselines/reference/logicalNotOperatorWithNumberType.types b/tests/baselines/reference/logicalNotOperatorWithNumberType.types new file mode 100644 index 00000000000..4bcc8a14041 --- /dev/null +++ b/tests/baselines/reference/logicalNotOperatorWithNumberType.types @@ -0,0 +1,165 @@ +=== tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithNumberType.ts === +// ! operator on number type +var NUMBER: number; +>NUMBER : number + +var NUMBER1: number[] = [1, 2]; +>NUMBER1 : number[] +>[1, 2] : number[] + +function foo(): number { return 1; } +>foo : () => number + +class A { +>A : A + + public a: number; +>a : number + + static foo() { return 1; } +>foo : () => number +} +module M { +>M : typeof M + + export var n: number; +>n : number +} + +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// number type var +var ResultIsBoolean1 = !NUMBER; +>ResultIsBoolean1 : boolean +>!NUMBER : boolean +>NUMBER : number + +var ResultIsBoolean2 = !NUMBER1; +>ResultIsBoolean2 : boolean +>!NUMBER1 : boolean +>NUMBER1 : number[] + +// number type literal +var ResultIsBoolean3 = !1; +>ResultIsBoolean3 : boolean +>!1 : boolean + +var ResultIsBoolean4 = !{ x: 1, y: 2}; +>ResultIsBoolean4 : boolean +>!{ x: 1, y: 2} : boolean +>{ x: 1, y: 2} : { x: number; y: number; } +>x : number +>y : number + +var ResultIsBoolean5 = !{ x: 1, y: (n: number) => { return n; } }; +>ResultIsBoolean5 : boolean +>!{ x: 1, y: (n: number) => { return n; } } : boolean +>{ x: 1, y: (n: number) => { return n; } } : { x: number; y: (n: number) => number; } +>x : number +>y : (n: number) => number +>(n: number) => { return n; } : (n: number) => number +>n : number +>n : number + +// number type expressions +var ResultIsBoolean6 = !objA.a; +>ResultIsBoolean6 : boolean +>!objA.a : boolean +>objA.a : number +>objA : A +>a : number + +var ResultIsBoolean7 = !M.n; +>ResultIsBoolean7 : boolean +>!M.n : boolean +>M.n : number +>M : typeof M +>n : number + +var ResultIsBoolean8 = !NUMBER1[0]; +>ResultIsBoolean8 : boolean +>!NUMBER1[0] : boolean +>NUMBER1[0] : number +>NUMBER1 : number[] + +var ResultIsBoolean9 = !foo(); +>ResultIsBoolean9 : boolean +>!foo() : boolean +>foo() : number +>foo : () => number + +var ResultIsBoolean10 = !A.foo(); +>ResultIsBoolean10 : boolean +>!A.foo() : boolean +>A.foo() : number +>A.foo : () => number +>A : typeof A +>foo : () => number + +var ResultIsBoolean11 = !(NUMBER + NUMBER); +>ResultIsBoolean11 : boolean +>!(NUMBER + NUMBER) : boolean +>(NUMBER + NUMBER) : number +>NUMBER + NUMBER : number +>NUMBER : number +>NUMBER : number + +// multiple ! operator +var ResultIsBoolean12 = !!NUMBER; +>ResultIsBoolean12 : boolean +>!!NUMBER : boolean +>!NUMBER : boolean +>NUMBER : number + +var ResultIsBoolean13 = !!!(NUMBER + NUMBER); +>ResultIsBoolean13 : boolean +>!!!(NUMBER + NUMBER) : boolean +>!!(NUMBER + NUMBER) : boolean +>!(NUMBER + NUMBER) : boolean +>(NUMBER + NUMBER) : number +>NUMBER + NUMBER : number +>NUMBER : number +>NUMBER : number + +// miss assignment operators +!1; +>!1 : boolean + +!NUMBER; +>!NUMBER : boolean +>NUMBER : number + +!NUMBER1; +>!NUMBER1 : boolean +>NUMBER1 : number[] + +!foo(); +>!foo() : boolean +>foo() : number +>foo : () => number + +!objA.a; +>!objA.a : boolean +>objA.a : number +>objA : A +>a : number + +!M.n; +>!M.n : boolean +>M.n : number +>M : typeof M +>n : number + +!objA.a, M.n; +>!objA.a, M.n : number +>!objA.a : boolean +>objA.a : number +>objA : A +>a : number +>M.n : number +>M : typeof M +>n : number + diff --git a/tests/baselines/reference/logicalNotOperatorWithStringType.types b/tests/baselines/reference/logicalNotOperatorWithStringType.types new file mode 100644 index 00000000000..2decb1ade18 --- /dev/null +++ b/tests/baselines/reference/logicalNotOperatorWithStringType.types @@ -0,0 +1,161 @@ +=== tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithStringType.ts === +// ! operator on string type +var STRING: string; +>STRING : string + +var STRING1: string[] = ["", "abc"]; +>STRING1 : string[] +>["", "abc"] : string[] + +function foo(): string { return "abc"; } +>foo : () => string + +class A { +>A : A + + public a: string; +>a : string + + static foo() { return ""; } +>foo : () => string +} +module M { +>M : typeof M + + export var n: string; +>n : string +} + +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// string type var +var ResultIsBoolean1 = !STRING; +>ResultIsBoolean1 : boolean +>!STRING : boolean +>STRING : string + +var ResultIsBoolean2 = !STRING1; +>ResultIsBoolean2 : boolean +>!STRING1 : boolean +>STRING1 : string[] + +// string type literal +var ResultIsBoolean3 = !""; +>ResultIsBoolean3 : boolean +>!"" : boolean + +var ResultIsBoolean4 = !{ x: "", y: "" }; +>ResultIsBoolean4 : boolean +>!{ x: "", y: "" } : boolean +>{ x: "", y: "" } : { x: string; y: string; } +>x : string +>y : string + +var ResultIsBoolean5 = !{ x: "", y: (s: string) => { return s; } }; +>ResultIsBoolean5 : boolean +>!{ x: "", y: (s: string) => { return s; } } : boolean +>{ x: "", y: (s: string) => { return s; } } : { x: string; y: (s: string) => string; } +>x : string +>y : (s: string) => string +>(s: string) => { return s; } : (s: string) => string +>s : string +>s : string + +// string type expressions +var ResultIsBoolean6 = !objA.a; +>ResultIsBoolean6 : boolean +>!objA.a : boolean +>objA.a : string +>objA : A +>a : string + +var ResultIsBoolean7 = !M.n; +>ResultIsBoolean7 : boolean +>!M.n : boolean +>M.n : string +>M : typeof M +>n : string + +var ResultIsBoolean8 = !STRING1[0]; +>ResultIsBoolean8 : boolean +>!STRING1[0] : boolean +>STRING1[0] : string +>STRING1 : string[] + +var ResultIsBoolean9 = !foo(); +>ResultIsBoolean9 : boolean +>!foo() : boolean +>foo() : string +>foo : () => string + +var ResultIsBoolean10 = !A.foo(); +>ResultIsBoolean10 : boolean +>!A.foo() : boolean +>A.foo() : string +>A.foo : () => string +>A : typeof A +>foo : () => string + +var ResultIsBoolean11 = !(STRING + STRING); +>ResultIsBoolean11 : boolean +>!(STRING + STRING) : boolean +>(STRING + STRING) : string +>STRING + STRING : string +>STRING : string +>STRING : string + +var ResultIsBoolean12 = !STRING.charAt(0); +>ResultIsBoolean12 : boolean +>!STRING.charAt(0) : boolean +>STRING.charAt(0) : string +>STRING.charAt : (pos: number) => string +>STRING : string +>charAt : (pos: number) => string + +// multiple ! operator +var ResultIsBoolean13 = !!STRING; +>ResultIsBoolean13 : boolean +>!!STRING : boolean +>!STRING : boolean +>STRING : string + +var ResultIsBoolean14 = !!!(STRING + STRING); +>ResultIsBoolean14 : boolean +>!!!(STRING + STRING) : boolean +>!!(STRING + STRING) : boolean +>!(STRING + STRING) : boolean +>(STRING + STRING) : string +>STRING + STRING : string +>STRING : string +>STRING : string + +// miss assignment operators +!""; +>!"" : boolean + +!STRING; +>!STRING : boolean +>STRING : string + +!STRING1; +>!STRING1 : boolean +>STRING1 : string[] + +!foo(); +>!foo() : boolean +>foo() : string +>foo : () => string + +!objA.a,M.n; +>!objA.a,M.n : string +>!objA.a : boolean +>objA.a : string +>objA : A +>a : string +>M.n : string +>M : typeof M +>n : string + diff --git a/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.types b/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.types new file mode 100644 index 00000000000..d44b220e818 --- /dev/null +++ b/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.types @@ -0,0 +1,17 @@ +=== tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrExpressionIsContextuallyTyped.ts === +// The || operator permits the operands to be of any type. +// If the || expression is contextually typed, the operands are contextually typed by the +// same type and the result is of the best common type of the contextual type and the two +// operand types. + +var r: { a: string } = { a: '', b: 123 } || { a: '', b: true }; +>r : { a: string; } +>a : string +>{ a: '', b: 123 } || { a: '', b: true } : { a: string; } +>{ a: '', b: 123 } : { a: string; b: number; } +>a : string +>b : number +>{ a: '', b: true } : { a: string; b: boolean; } +>a : string +>b : boolean + diff --git a/tests/baselines/reference/logicalOrExpressionIsNotContextuallyTyped.types b/tests/baselines/reference/logicalOrExpressionIsNotContextuallyTyped.types new file mode 100644 index 00000000000..f450307758d --- /dev/null +++ b/tests/baselines/reference/logicalOrExpressionIsNotContextuallyTyped.types @@ -0,0 +1,24 @@ +=== tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrExpressionIsNotContextuallyTyped.ts === +// The || operator permits the operands to be of any type. +// If the || expression is not contextually typed, the right operand is contextually typed +// by the type of the left operand and the result is of the best common type of the two +// operand types. + + +var a: (a: string) => string; +>a : (a: string) => string +>a : string + +// bug 786110 +var r = a || ((a) => a.toLowerCase()); +>r : (a: any) => any +>a || ((a) => a.toLowerCase()) : (a: any) => any +>a : (a: string) => string +>((a) => a.toLowerCase()) : (a: any) => any +>(a) => a.toLowerCase() : (a: any) => any +>a : any +>a.toLowerCase() : any +>a.toLowerCase : any +>a : any +>toLowerCase : any + diff --git a/tests/baselines/reference/logicalOrOperatorWithEveryType.types b/tests/baselines/reference/logicalOrOperatorWithEveryType.types new file mode 100644 index 00000000000..3cf0399f437 --- /dev/null +++ b/tests/baselines/reference/logicalOrOperatorWithEveryType.types @@ -0,0 +1,618 @@ +=== tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrOperatorWithEveryType.ts === +// The || operator permits the operands to be of any type. +// If the || expression is not contextually typed, the right operand is contextually typed +// by the type of the left operand and the result is of the best common type of the two +// operand types. + +enum E { a, b, c } +>E : E +>a : E +>b : E +>c : E + +var a1: any; +>a1 : any + +var a2: boolean; +>a2 : boolean + +var a3: number +>a3 : number + +var a4: string; +>a4 : string + +var a5: void; +>a5 : void + +var a6: E; +>a6 : E +>E : E + +var a7: {a: string}; +>a7 : { a: string; } +>a : string + +var a8: string[]; +>a8 : string[] + +var ra1 = a1 || a1; // any || any is any +>ra1 : any +>a1 || a1 : any +>a1 : any +>a1 : any + +var ra2 = a2 || a1; // boolean || any is any +>ra2 : any +>a2 || a1 : any +>a2 : boolean +>a1 : any + +var ra3 = a3 || a1; // number || any is any +>ra3 : any +>a3 || a1 : any +>a3 : number +>a1 : any + +var ra4 = a4 || a1; // string || any is any +>ra4 : any +>a4 || a1 : any +>a4 : string +>a1 : any + +var ra5 = a5 || a1; // void || any is any +>ra5 : any +>a5 || a1 : any +>a5 : void +>a1 : any + +var ra6 = a6 || a1; // enum || any is any +>ra6 : any +>a6 || a1 : any +>a6 : E +>a1 : any + +var ra7 = a7 || a1; // object || any is any +>ra7 : any +>a7 || a1 : any +>a7 : { a: string; } +>a1 : any + +var ra8 = a8 || a1; // array || any is any +>ra8 : any +>a8 || a1 : any +>a8 : string[] +>a1 : any + +var ra9 = null || a1; // null || any is any +>ra9 : any +>null || a1 : any +>a1 : any + +var ra10 = undefined || a1; // undefined || any is any +>ra10 : any +>undefined || a1 : any +>undefined : undefined +>a1 : any + +var rb1 = a1 || a2; // any || boolean is any +>rb1 : any +>a1 || a2 : any +>a1 : any +>a2 : boolean + +var rb2 = a2 || a2; // boolean || boolean is boolean +>rb2 : boolean +>a2 || a2 : boolean +>a2 : boolean +>a2 : boolean + +var rb3 = a3 || a2; // number || boolean is {} +>rb3 : {} +>a3 || a2 : {} +>a3 : number +>a2 : boolean + +var rb4 = a4 || a2; // string || boolean is {} +>rb4 : {} +>a4 || a2 : {} +>a4 : string +>a2 : boolean + +var rb5 = a5 || a2; // void || boolean is {} +>rb5 : {} +>a5 || a2 : {} +>a5 : void +>a2 : boolean + +var rb6 = a6 || a2; // enum || boolean is {} +>rb6 : {} +>a6 || a2 : {} +>a6 : E +>a2 : boolean + +var rb7 = a7 || a2; // object || boolean is {} +>rb7 : {} +>a7 || a2 : {} +>a7 : { a: string; } +>a2 : boolean + +var rb8 = a8 || a2; // array || boolean is {} +>rb8 : {} +>a8 || a2 : {} +>a8 : string[] +>a2 : boolean + +var rb9 = null || a2; // null || boolean is boolean +>rb9 : boolean +>null || a2 : boolean +>a2 : boolean + +var rb10= undefined || a2; // undefined || boolean is boolean +>rb10 : boolean +>undefined || a2 : boolean +>undefined : undefined +>a2 : boolean + +var rc1 = a1 || a3; // any || number is any +>rc1 : any +>a1 || a3 : any +>a1 : any +>a3 : number + +var rc2 = a2 || a3; // boolean || number is {} +>rc2 : {} +>a2 || a3 : {} +>a2 : boolean +>a3 : number + +var rc3 = a3 || a3; // number || number is number +>rc3 : number +>a3 || a3 : number +>a3 : number +>a3 : number + +var rc4 = a4 || a3; // string || number is {} +>rc4 : {} +>a4 || a3 : {} +>a4 : string +>a3 : number + +var rc5 = a5 || a3; // void || number is {} +>rc5 : {} +>a5 || a3 : {} +>a5 : void +>a3 : number + +var rc6 = a6 || a3; // enum || number is number +>rc6 : number +>a6 || a3 : number +>a6 : E +>a3 : number + +var rc7 = a7 || a3; // object || number is {} +>rc7 : {} +>a7 || a3 : {} +>a7 : { a: string; } +>a3 : number + +var rc8 = a8 || a3; // array || number is {} +>rc8 : {} +>a8 || a3 : {} +>a8 : string[] +>a3 : number + +var rc9 = null || a3; // null || number is number +>rc9 : number +>null || a3 : number +>a3 : number + +var rc10 = undefined || a3; // undefined || number is number +>rc10 : number +>undefined || a3 : number +>undefined : undefined +>a3 : number + +var rd1 = a1 || a4; // any || string is any +>rd1 : any +>a1 || a4 : any +>a1 : any +>a4 : string + +var rd2 = a2 || a4; // boolean || string is {} +>rd2 : {} +>a2 || a4 : {} +>a2 : boolean +>a4 : string + +var rd3 = a3 || a4; // number || string is {} +>rd3 : {} +>a3 || a4 : {} +>a3 : number +>a4 : string + +var rd4 = a4 || a4; // string || string is string +>rd4 : string +>a4 || a4 : string +>a4 : string +>a4 : string + +var rd5 = a5 || a4; // void || string is {} +>rd5 : {} +>a5 || a4 : {} +>a5 : void +>a4 : string + +var rd6 = a6 || a4; // enum || string is {} +>rd6 : {} +>a6 || a4 : {} +>a6 : E +>a4 : string + +var rd7 = a7 || a4; // object || string is {} +>rd7 : {} +>a7 || a4 : {} +>a7 : { a: string; } +>a4 : string + +var rd8 = a8 || a4; // array || string is {} +>rd8 : {} +>a8 || a4 : {} +>a8 : string[] +>a4 : string + +var rd9 = null || a4; // null || string is string +>rd9 : string +>null || a4 : string +>a4 : string + +var rd10 = undefined || a4; // undefined || string is string +>rd10 : string +>undefined || a4 : string +>undefined : undefined +>a4 : string + +var re1 = a1 || a5; // any || void is any +>re1 : any +>a1 || a5 : any +>a1 : any +>a5 : void + +var re2 = a2 || a5; // boolean || void is {} +>re2 : {} +>a2 || a5 : {} +>a2 : boolean +>a5 : void + +var re3 = a3 || a5; // number || void is {} +>re3 : {} +>a3 || a5 : {} +>a3 : number +>a5 : void + +var re4 = a4 || a5; // string || void is {} +>re4 : {} +>a4 || a5 : {} +>a4 : string +>a5 : void + +var re5 = a5 || a5; // void || void is void +>re5 : void +>a5 || a5 : void +>a5 : void +>a5 : void + +var re6 = a6 || a5; // enum || void is {} +>re6 : {} +>a6 || a5 : {} +>a6 : E +>a5 : void + +var re7 = a7 || a5; // object || void is {} +>re7 : {} +>a7 || a5 : {} +>a7 : { a: string; } +>a5 : void + +var re8 = a8 || a5; // array || void is {} +>re8 : {} +>a8 || a5 : {} +>a8 : string[] +>a5 : void + +var re9 = null || a5; // null || void is void +>re9 : void +>null || a5 : void +>a5 : void + +var re10 = undefined || a5; // undefined || void is void +>re10 : void +>undefined || a5 : void +>undefined : undefined +>a5 : void + +var rg1 = a1 || a6; // any || enum is any +>rg1 : any +>a1 || a6 : any +>a1 : any +>a6 : E + +var rg2 = a2 || a6; // boolean || enum is {} +>rg2 : {} +>a2 || a6 : {} +>a2 : boolean +>a6 : E + +var rg3 = a3 || a6; // number || enum is number +>rg3 : number +>a3 || a6 : number +>a3 : number +>a6 : E + +var rg4 = a4 || a6; // string || enum is {} +>rg4 : {} +>a4 || a6 : {} +>a4 : string +>a6 : E + +var rg5 = a5 || a6; // void || enum is {} +>rg5 : {} +>a5 || a6 : {} +>a5 : void +>a6 : E + +var rg6 = a6 || a6; // enum || enum is E +>rg6 : E +>a6 || a6 : E +>a6 : E +>a6 : E + +var rg7 = a7 || a6; // object || enum is {} +>rg7 : {} +>a7 || a6 : {} +>a7 : { a: string; } +>a6 : E + +var rg8 = a8 || a6; // array || enum is {} +>rg8 : {} +>a8 || a6 : {} +>a8 : string[] +>a6 : E + +var rg9 = null || a6; // null || enum is E +>rg9 : E +>null || a6 : E +>a6 : E + +var rg10 = undefined || a6; // undefined || enum is E +>rg10 : E +>undefined || a6 : E +>undefined : undefined +>a6 : E + +var rh1 = a1 || a7; // any || object is any +>rh1 : any +>a1 || a7 : any +>a1 : any +>a7 : { a: string; } + +var rh2 = a2 || a7; // boolean || object is {} +>rh2 : {} +>a2 || a7 : {} +>a2 : boolean +>a7 : { a: string; } + +var rh3 = a3 || a7; // number || object is {} +>rh3 : {} +>a3 || a7 : {} +>a3 : number +>a7 : { a: string; } + +var rh4 = a4 || a7; // string || object is {} +>rh4 : {} +>a4 || a7 : {} +>a4 : string +>a7 : { a: string; } + +var rh5 = a5 || a7; // void || object is {} +>rh5 : {} +>a5 || a7 : {} +>a5 : void +>a7 : { a: string; } + +var rh6 = a6 || a7; // enum || object is {} +>rh6 : {} +>a6 || a7 : {} +>a6 : E +>a7 : { a: string; } + +var rh7 = a7 || a7; // object || object is object +>rh7 : { a: string; } +>a7 || a7 : { a: string; } +>a7 : { a: string; } +>a7 : { a: string; } + +var rh8 = a8 || a7; // array || object is {} +>rh8 : {} +>a8 || a7 : {} +>a8 : string[] +>a7 : { a: string; } + +var rh9 = null || a7; // null || object is object +>rh9 : { a: string; } +>null || a7 : { a: string; } +>a7 : { a: string; } + +var rh10 = undefined || a7; // undefined || object is object +>rh10 : { a: string; } +>undefined || a7 : { a: string; } +>undefined : undefined +>a7 : { a: string; } + +var ri1 = a1 || a8; // any || array is any +>ri1 : any +>a1 || a8 : any +>a1 : any +>a8 : string[] + +var ri2 = a2 || a8; // boolean || array is {} +>ri2 : {} +>a2 || a8 : {} +>a2 : boolean +>a8 : string[] + +var ri3 = a3 || a8; // number || array is {} +>ri3 : {} +>a3 || a8 : {} +>a3 : number +>a8 : string[] + +var ri4 = a4 || a8; // string || array is {} +>ri4 : {} +>a4 || a8 : {} +>a4 : string +>a8 : string[] + +var ri5 = a5 || a8; // void || array is {} +>ri5 : {} +>a5 || a8 : {} +>a5 : void +>a8 : string[] + +var ri6 = a6 || a8; // enum || array is {} +>ri6 : {} +>a6 || a8 : {} +>a6 : E +>a8 : string[] + +var ri7 = a7 || a8; // object || array is {} +>ri7 : {} +>a7 || a8 : {} +>a7 : { a: string; } +>a8 : string[] + +var ri8 = a8 || a8; // array || array is array +>ri8 : string[] +>a8 || a8 : string[] +>a8 : string[] +>a8 : string[] + +var ri9 = null || a8; // null || array is array +>ri9 : string[] +>null || a8 : string[] +>a8 : string[] + +var ri10 = undefined || a8; // undefined || array is array +>ri10 : string[] +>undefined || a8 : string[] +>undefined : undefined +>a8 : string[] + +var rj1 = a1 || null; // any || null is any +>rj1 : any +>a1 || null : any +>a1 : any + +var rj2 = a2 || null; // boolean || null is boolean +>rj2 : boolean +>a2 || null : boolean +>a2 : boolean + +var rj3 = a3 || null; // number || null is number +>rj3 : number +>a3 || null : number +>a3 : number + +var rj4 = a4 || null; // string || null is string +>rj4 : string +>a4 || null : string +>a4 : string + +var rj5 = a5 || null; // void || null is void +>rj5 : void +>a5 || null : void +>a5 : void + +var rj6 = a6 || null; // enum || null is E +>rj6 : E +>a6 || null : E +>a6 : E + +var rj7 = a7 || null; // object || null is object +>rj7 : { a: string; } +>a7 || null : { a: string; } +>a7 : { a: string; } + +var rj8 = a8 || null; // array || null is array +>rj8 : string[] +>a8 || null : string[] +>a8 : string[] + +var rj9 = null || null; // null || null is any +>rj9 : any +>null || null : null + +var rj10 = undefined || null; // undefined || null is any +>rj10 : any +>undefined || null : null +>undefined : undefined + +var rf1 = a1 || undefined; // any || undefined is any +>rf1 : any +>a1 || undefined : any +>a1 : any +>undefined : undefined + +var rf2 = a2 || undefined; // boolean || undefined is boolean +>rf2 : boolean +>a2 || undefined : boolean +>a2 : boolean +>undefined : undefined + +var rf3 = a3 || undefined; // number || undefined is number +>rf3 : number +>a3 || undefined : number +>a3 : number +>undefined : undefined + +var rf4 = a4 || undefined; // string || undefined is string +>rf4 : string +>a4 || undefined : string +>a4 : string +>undefined : undefined + +var rf5 = a5 || undefined; // void || undefined is void +>rf5 : void +>a5 || undefined : void +>a5 : void +>undefined : undefined + +var rf6 = a6 || undefined; // enum || undefined is E +>rf6 : E +>a6 || undefined : E +>a6 : E +>undefined : undefined + +var rf7 = a7 || undefined; // object || undefined is object +>rf7 : { a: string; } +>a7 || undefined : { a: string; } +>a7 : { a: string; } +>undefined : undefined + +var rf8 = a8 || undefined; // array || undefined is array +>rf8 : string[] +>a8 || undefined : string[] +>a8 : string[] +>undefined : undefined + +var rf9 = null || undefined; // null || undefined is any +>rf9 : any +>null || undefined : null +>undefined : undefined + +var rf10 = undefined || undefined; // undefined || undefined is any +>rf10 : any +>undefined || undefined : undefined +>undefined : undefined +>undefined : undefined + diff --git a/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types b/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types new file mode 100644 index 00000000000..ff0e0ce568a --- /dev/null +++ b/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types @@ -0,0 +1,122 @@ +=== tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrOperatorWithTypeParameters.ts === +function fn1(t: T, u: U) { +>fn1 : (t: T, u: U) => void +>T : T +>U : U +>t : T +>T : T +>u : U +>U : U + + var r1 = t || t; +>r1 : T +>t || t : T +>t : T +>t : T + + var r2: T = t || t; +>r2 : T +>T : T +>t || t : T +>t : T +>t : T + + var r3 = t || u; +>r3 : {} +>t || u : {} +>t : T +>u : U + + var r4: {} = t || u; +>r4 : {} +>t || u : {} +>t : T +>u : U +} + +function fn2(t: T, u: U, v: V) { +>fn2 : (t: T, u: U, v: V) => void +>T : T +>U : U +>V : V +>t : T +>T : T +>u : U +>U : U +>v : V +>V : V + + var r1 = t || u; +>r1 : {} +>t || u : {} +>t : T +>u : U + + //var r2: T = t || u; + var r3 = u || u; +>r3 : U +>u || u : U +>u : U +>u : U + + var r4: U = u || u; +>r4 : U +>U : U +>u || u : U +>u : U +>u : U + + var r5 = u || v; +>r5 : {} +>u || v : {} +>u : U +>v : V + + var r6: {} = u || v; +>r6 : {} +>u || v : {} +>u : U +>v : V + + //var r7: T = u || v; +} + +function fn3(t: T, u: U) { +>fn3 : (t: T, u: U) => void +>T : T +>a : string +>b : string +>U : U +>a : string +>b : number +>t : T +>T : T +>u : U +>U : U + + var r1 = t || u; +>r1 : {} +>t || u : {} +>t : T +>u : U + + var r2: {} = t || u; +>r2 : {} +>t || u : {} +>t : T +>u : U + + var r3 = t || { a: '' }; +>r3 : { a: string; } +>t || { a: '' } : { a: string; } +>t : T +>{ a: '' } : { a: string; } +>a : string + + var r4: { a: string } = t || u; +>r4 : { a: string; } +>a : string +>t || u : { a: string; } +>t : T +>u : U +} diff --git a/tests/baselines/reference/m7Bugs.types b/tests/baselines/reference/m7Bugs.types new file mode 100644 index 00000000000..fa627f20cf7 --- /dev/null +++ b/tests/baselines/reference/m7Bugs.types @@ -0,0 +1,67 @@ +=== tests/cases/compiler/m7Bugs.ts === +// scenario 1 +interface ISomething { +>ISomething : ISomething + + something: number; +>something : number +} + +var s: ISomething = ({ }); +>s : ISomething +>ISomething : ISomething +>({ }) : ISomething +>ISomething : ISomething +>({ }) : {} +>{ } : {} + + +// scenario 2 +interface A { x: string; } +>A : A +>x : string + +interface B extends A { } +>B : B +>A : A + +var x: B = { }; +>x : B +>B : B +>{ } : B +>B : B +>{ } : {} + +class C1 { +>C1 : C1 + + public x: string; +>x : string +} + +class C2 extends C1 {} +>C2 : C2 +>C1 : C1 + +var y1: C1 = new C2(); +>y1 : C1 +>C1 : C1 +>new C2() : C2 +>C2 : typeof C2 + +var y2: C1 = new C2(); +>y2 : C1 +>C1 : C1 +> new C2() : C1 +>C1 : C1 +>new C2() : C2 +>C2 : typeof C2 + +var y3: C1 = {}; +>y3 : C1 +>C1 : C1 +> {} : C1 +>C1 : C1 +>{} : {} + + diff --git a/tests/baselines/reference/memberAccessMustUseModuleInstances.types b/tests/baselines/reference/memberAccessMustUseModuleInstances.types new file mode 100644 index 00000000000..f549b4078f9 --- /dev/null +++ b/tests/baselines/reference/memberAccessMustUseModuleInstances.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/memberAccessMustUseModuleInstances_1.ts === +/// +import WinJS = require('memberAccessMustUseModuleInstances_0'); +>WinJS : typeof "tests/cases/compiler/memberAccessMustUseModuleInstances_0" + +WinJS.Promise.timeout(10); +>WinJS.Promise.timeout(10) : Promise +>WinJS.Promise.timeout : (delay: number) => Promise +>WinJS.Promise : typeof Promise +>WinJS : typeof "tests/cases/compiler/memberAccessMustUseModuleInstances_0" +>Promise : typeof Promise +>timeout : (delay: number) => Promise + +=== tests/cases/compiler/memberAccessMustUseModuleInstances_0.ts === +export class Promise { +>Promise : Promise + + static timeout(delay: number): Promise { +>timeout : (delay: number) => Promise +>delay : number +>Promise : Promise + + return null; + } +} + diff --git a/tests/baselines/reference/memberAccessOnConstructorType.types b/tests/baselines/reference/memberAccessOnConstructorType.types new file mode 100644 index 00000000000..d4d722619d4 --- /dev/null +++ b/tests/baselines/reference/memberAccessOnConstructorType.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/memberAccessOnConstructorType.ts === +var f: new () => void; +>f : new () => void + +f.arguments == 0; +>f.arguments == 0 : boolean +>f.arguments : any +>f : new () => void +>arguments : any + diff --git a/tests/baselines/reference/memberFunctionsWithPublicOverloads.types b/tests/baselines/reference/memberFunctionsWithPublicOverloads.types new file mode 100644 index 00000000000..7cbc2aca1ff --- /dev/null +++ b/tests/baselines/reference/memberFunctionsWithPublicOverloads.types @@ -0,0 +1,142 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicOverloads.ts === +class C { +>C : C + + public foo(x: number); +>foo : { (x: number): any; (x: number, y: string): any; } +>x : number + + public foo(x: number, y: string); +>foo : { (x: number): any; (x: number, y: string): any; } +>x : number +>y : string + + public foo(x: any, y?: any) { } +>foo : { (x: number): any; (x: number, y: string): any; } +>x : any +>y : any + + public bar(x: 'hi'); +>bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>x : 'hi' + + public bar(x: string); +>bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>x : string + + public bar(x: number, y: string); +>bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>x : number +>y : string + + public bar(x: any, y?: any) { } +>bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>x : any +>y : any + + public static foo(x: number); +>foo : { (x: number): any; (x: number, y: string): any; } +>x : number + + public static foo(x: number, y: string); +>foo : { (x: number): any; (x: number, y: string): any; } +>x : number +>y : string + + public static foo(x: any, y?: any) { } +>foo : { (x: number): any; (x: number, y: string): any; } +>x : any +>y : any + + public static bar(x: 'hi'); +>bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>x : 'hi' + + public static bar(x: string); +>bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>x : string + + public static bar(x: number, y: string); +>bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>x : number +>y : string + + public static bar(x: any, y?: any) { } +>bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>x : any +>y : any +} + +class D { +>D : D +>T : T + + public foo(x: number); +>foo : { (x: number): any; (x: T, y: T): any; } +>x : number + + public foo(x: T, y: T); +>foo : { (x: number): any; (x: T, y: T): any; } +>x : T +>T : T +>y : T +>T : T + + public foo(x: any, y?: any) { } +>foo : { (x: number): any; (x: T, y: T): any; } +>x : any +>y : any + + public bar(x: 'hi'); +>bar : { (x: 'hi'): any; (x: string): any; (x: T, y: T): any; } +>x : 'hi' + + public bar(x: string); +>bar : { (x: 'hi'): any; (x: string): any; (x: T, y: T): any; } +>x : string + + public bar(x: T, y: T); +>bar : { (x: 'hi'): any; (x: string): any; (x: T, y: T): any; } +>x : T +>T : T +>y : T +>T : T + + public bar(x: any, y?: any) { } +>bar : { (x: 'hi'): any; (x: string): any; (x: T, y: T): any; } +>x : any +>y : any + + public static foo(x: number); +>foo : { (x: number): any; (x: number, y: string): any; } +>x : number + + public static foo(x: number, y: string); +>foo : { (x: number): any; (x: number, y: string): any; } +>x : number +>y : string + + public static foo(x: any, y?: any) { } +>foo : { (x: number): any; (x: number, y: string): any; } +>x : any +>y : any + + public static bar(x: 'hi'); +>bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>x : 'hi' + + public static bar(x: string); +>bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>x : string + + public static bar(x: number, y: string); +>bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>x : number +>y : string + + public static bar(x: any, y?: any) { } +>bar : { (x: 'hi'): any; (x: string): any; (x: number, y: string): any; } +>x : any +>y : any + +} diff --git a/tests/baselines/reference/memberVariableDeclarations1.types b/tests/baselines/reference/memberVariableDeclarations1.types new file mode 100644 index 00000000000..10ec78d69dc --- /dev/null +++ b/tests/baselines/reference/memberVariableDeclarations1.types @@ -0,0 +1,85 @@ +=== tests/cases/compiler/memberVariableDeclarations1.ts === +// from spec + +class Employee { +>Employee : Employee + + public name: string; +>name : string + + public address: string; +>address : string + + public retired = false; +>retired : boolean + + public manager: Employee = null; +>manager : Employee +>Employee : Employee + + public reports: Employee[] = []; +>reports : Employee[] +>Employee : Employee +>[] : Employee[] +} + +class Employee2 { +>Employee2 : Employee2 + + public name: string; +>name : string + + public address: string; +>address : string + + public retired: boolean; +>retired : boolean + + public manager: Employee; +>manager : Employee +>Employee : Employee + + public reports: Employee[]; +>reports : Employee[] +>Employee : Employee + + constructor() { + this.retired = false; +>this.retired = false : boolean +>this.retired : boolean +>this : Employee2 +>retired : boolean + + this.manager = null; +>this.manager = null : null +>this.manager : Employee +>this : Employee2 +>manager : Employee + + this.reports = []; +>this.reports = [] : Employee[] +>this.reports : Employee[] +>this : Employee2 +>reports : Employee[] +>[] : Employee[] + } +} + +var e1: Employee; +>e1 : Employee +>Employee : Employee + +var e2: Employee2; +>e2 : Employee2 +>Employee2 : Employee2 + +e1 = e2; +>e1 = e2 : Employee2 +>e1 : Employee +>e2 : Employee2 + +e2 = e1; +>e2 = e1 : Employee +>e2 : Employee2 +>e1 : Employee + diff --git a/tests/baselines/reference/mergeThreeInterfaces.types b/tests/baselines/reference/mergeThreeInterfaces.types new file mode 100644 index 00000000000..5db2a931023 --- /dev/null +++ b/tests/baselines/reference/mergeThreeInterfaces.types @@ -0,0 +1,197 @@ +=== tests/cases/conformance/interfaces/declarationMerging/mergeThreeInterfaces.ts === +// interfaces with the same root module should merge + +// basic case +interface A { +>A : A + + foo: string; +>foo : string +} + +interface A { +>A : A + + bar: number; +>bar : number +} + +interface A { +>A : A + + baz: boolean; +>baz : boolean +} + +var a: A; +>a : A +>A : A + +var r1 = a.foo +>r1 : string +>a.foo : string +>a : A +>foo : string + +var r2 = a.bar; +>r2 : number +>a.bar : number +>a : A +>bar : number + +var r3 = a.baz; +>r3 : boolean +>a.baz : boolean +>a : A +>baz : boolean + +// basic generic case +interface B { +>B : B +>T : T + + foo: T; +>foo : T +>T : T +} + +interface B { +>B : B +>T : T + + bar: T; +>bar : T +>T : T +} + +interface B { +>B : B +>T : T + + baz: T; +>baz : T +>T : T +} + +var b: B; +>b : B +>B : B + +var r4 = b.foo +>r4 : string +>b.foo : string +>b : B +>foo : string + +var r5 = b.bar; +>r5 : string +>b.bar : string +>b : B +>bar : string + +var r6 = b.baz; +>r6 : string +>b.baz : string +>b : B +>baz : string + +// basic non-generic and generic case inside a module +module M { +>M : typeof M + + interface A { +>A : A + + foo: string; +>foo : string + } + + interface A { +>A : A + + bar: number; +>bar : number + } + + interface A { +>A : A + + baz: boolean; +>baz : boolean + } + + var a: A; +>a : A +>A : A + + var r1 = a.foo; +>r1 : string +>a.foo : string +>a : A +>foo : string + + // BUG 856491 + var r2 = a.bar; // any, should be number +>r2 : number +>a.bar : number +>a : A +>bar : number + + // BUG 856491 + var r3 = a.baz; // any, should be boolean +>r3 : boolean +>a.baz : boolean +>a : A +>baz : boolean + + interface B { +>B : B +>T : T + + foo: T; +>foo : T +>T : T + } + + interface B { +>B : B +>T : T + + bar: T; +>bar : T +>T : T + } + + interface B { +>B : B +>T : T + + baz: T; +>baz : T +>T : T + } + + var b: B; +>b : B +>B : B + + var r4 = b.foo +>r4 : string +>b.foo : string +>b : B +>foo : string + + // BUG 856491 + var r5 = b.bar; // any, should be number +>r5 : string +>b.bar : string +>b : B +>bar : string + + // BUG 856491 + var r6 = b.baz; // any, should be boolean +>r6 : string +>b.baz : string +>b : B +>baz : string +} diff --git a/tests/baselines/reference/mergeThreeInterfaces2.types b/tests/baselines/reference/mergeThreeInterfaces2.types new file mode 100644 index 00000000000..31339187e3d --- /dev/null +++ b/tests/baselines/reference/mergeThreeInterfaces2.types @@ -0,0 +1,176 @@ +=== tests/cases/conformance/interfaces/declarationMerging/mergeThreeInterfaces2.ts === +// two interfaces with the same root module should merge + +// root module now multiple module declarations +module M2 { +>M2 : typeof M2 + + export interface A { +>A : A + + foo: string; +>foo : string + } + + var a: A; +>a : A +>A : A + + var r1 = a.foo; +>r1 : string +>a.foo : string +>a : A +>foo : string + + var r2 = a.bar; +>r2 : number +>a.bar : number +>a : A +>bar : number +} + +module M2 { +>M2 : typeof M2 + + export interface A { +>A : A + + bar: number; +>bar : number + } + + export interface A { +>A : A + + baz: boolean; +>baz : boolean + } + + var a: A; +>a : A +>A : A + + var r1 = a.foo; +>r1 : string +>a.foo : string +>a : A +>foo : string + + var r2 = a.bar; +>r2 : number +>a.bar : number +>a : A +>bar : number + + var r3 = a.baz; +>r3 : boolean +>a.baz : boolean +>a : A +>baz : boolean +} + +// same as above but with an additional level of nesting and third module declaration +module M2 { +>M2 : typeof M2 + + export module M3 { +>M3 : typeof M3 + + export interface A { +>A : A + + foo: string; +>foo : string + } + + var a: A; +>a : A +>A : A + + var r1 = a.foo; +>r1 : string +>a.foo : string +>a : A +>foo : string + + var r2 = a.bar; +>r2 : number +>a.bar : number +>a : A +>bar : number + } +} + +module M2 { +>M2 : typeof M2 + + export module M3 { +>M3 : typeof M3 + + export interface A { +>A : A + + bar: number; +>bar : number + } + + var a: A; +>a : A +>A : A + + var r1 = a.foo +>r1 : string +>a.foo : string +>a : A +>foo : string + + var r2 = a.bar; +>r2 : number +>a.bar : number +>a : A +>bar : number + + var r3 = a.baz; +>r3 : boolean +>a.baz : boolean +>a : A +>baz : boolean + } +} + +module M2 { +>M2 : typeof M2 + + export module M3 { +>M3 : typeof M3 + + export interface A { +>A : A + + baz: boolean; +>baz : boolean + } + + var a: A; +>a : A +>A : A + + var r1 = a.foo +>r1 : string +>a.foo : string +>a : A +>foo : string + + var r2 = a.bar; +>r2 : number +>a.bar : number +>a : A +>bar : number + + var r3 = a.baz; +>r3 : boolean +>a.baz : boolean +>a : A +>baz : boolean + } +} diff --git a/tests/baselines/reference/mergeTwoInterfaces.types b/tests/baselines/reference/mergeTwoInterfaces.types new file mode 100644 index 00000000000..4c36d37ccb7 --- /dev/null +++ b/tests/baselines/reference/mergeTwoInterfaces.types @@ -0,0 +1,142 @@ +=== tests/cases/conformance/interfaces/declarationMerging/mergeTwoInterfaces.ts === +// two interfaces with the same root module should merge + +// basic case +interface A { +>A : A + + foo: string; +>foo : string +} + +interface A { +>A : A + + bar: number; +>bar : number +} + +var a: A; +>a : A +>A : A + +var r1 = a.foo +>r1 : string +>a.foo : string +>a : A +>foo : string + +var r2 = a.bar; +>r2 : number +>a.bar : number +>a : A +>bar : number + +// basic generic case +interface B { +>B : B +>T : T + + baz: string; +>baz : string + + foo: T; +>foo : T +>T : T +} + +interface B { +>B : B +>T : T + + bar: T; +>bar : T +>T : T +} + +var b: B; +>b : B +>B : B + +var r3 = b.foo +>r3 : string +>b.foo : string +>b : B +>foo : string + +var r4 = b.bar; +>r4 : string +>b.bar : string +>b : B +>bar : string + +// basic non-generic and generic case inside a module +module M { +>M : typeof M + + interface A { +>A : A + + foo: string; +>foo : string + } + + interface A { +>A : A + + bar: number; +>bar : number + } + + var a: A; +>a : A +>A : A + + var r1 = a.foo; +>r1 : string +>a.foo : string +>a : A +>foo : string + + // BUG 856491 + var r2 = a.bar; // any, should be number +>r2 : number +>a.bar : number +>a : A +>bar : number + + interface B { +>B : B +>T : T + + foo: T; +>foo : T +>T : T + } + + interface B { +>B : B +>T : T + + bar: T; +>bar : T +>T : T + } + + var b: B; +>b : B +>B : B + + var r3 = b.foo +>r3 : string +>b.foo : string +>b : B +>foo : string + + // BUG 856491 + var r4 = b.bar; // any, should be string +>r4 : string +>b.bar : string +>b : B +>bar : string +} diff --git a/tests/baselines/reference/mergeTwoInterfaces2.types b/tests/baselines/reference/mergeTwoInterfaces2.types new file mode 100644 index 00000000000..f3908a6fe67 --- /dev/null +++ b/tests/baselines/reference/mergeTwoInterfaces2.types @@ -0,0 +1,120 @@ +=== tests/cases/conformance/interfaces/declarationMerging/mergeTwoInterfaces2.ts === +// two interfaces with the same root module should merge + +// root module now multiple module declarations +module M2 { +>M2 : typeof M2 + + export interface A { +>A : A + + foo: string; +>foo : string + } + + var a: A; +>a : A +>A : A + + var r1 = a.foo +>r1 : string +>a.foo : string +>a : A +>foo : string + + var r2 = a.bar; +>r2 : number +>a.bar : number +>a : A +>bar : number +} + +module M2 { +>M2 : typeof M2 + + export interface A { +>A : A + + bar: number; +>bar : number + } + + var a: A; +>a : A +>A : A + + var r1 = a.foo +>r1 : string +>a.foo : string +>a : A +>foo : string + + var r2 = a.bar; +>r2 : number +>a.bar : number +>a : A +>bar : number +} + +// same as above but with an additional level of nesting +module M2 { +>M2 : typeof M2 + + export module M3 { +>M3 : typeof M3 + + export interface A { +>A : A + + foo: string; +>foo : string + } + + var a: A; +>a : A +>A : A + + var r1 = a.foo +>r1 : string +>a.foo : string +>a : A +>foo : string + + var r2 = a.bar; +>r2 : number +>a.bar : number +>a : A +>bar : number + } +} + +module M2 { +>M2 : typeof M2 + + export module M3 { +>M3 : typeof M3 + + export interface A { +>A : A + + bar: number; +>bar : number + } + + var a: A; +>a : A +>A : A + + var r1 = a.foo +>r1 : string +>a.foo : string +>a : A +>foo : string + + var r2 = a.bar; +>r2 : number +>a.bar : number +>a : A +>bar : number + } +} diff --git a/tests/baselines/reference/mergedDeclarations1.types b/tests/baselines/reference/mergedDeclarations1.types new file mode 100644 index 00000000000..d2b5cca6426 --- /dev/null +++ b/tests/baselines/reference/mergedDeclarations1.types @@ -0,0 +1,76 @@ +=== tests/cases/compiler/mergedDeclarations1.ts === +interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number +} +function point(x: number, y: number): Point { +>point : typeof point +>x : number +>y : number +>Point : Point + + return { x: x, y: y }; +>{ x: x, y: y } : { x: number; y: number; } +>x : number +>x : x +>y : number +>y : y +} +module point { +>point : typeof point + + export var origin = point(0, 0); +>origin : Point +>point(0, 0) : Point +>point : typeof point + + export function equals(p1: Point, p2: Point) { +>equals : (p1: Point, p2: Point) => boolean +>p1 : Point +>Point : Point +>p2 : Point +>Point : Point + + return p1.x == p2.x && p1.y == p2.y; +>p1.x == p2.x && p1.y == p2.y : boolean +>p1.x == p2.x : boolean +>p1.x : number +>p1 : Point +>x : number +>p2.x : number +>p2 : Point +>x : number +>p1.y == p2.y : boolean +>p1.y : number +>p1 : Point +>y : number +>p2.y : number +>p2 : Point +>y : number + } +} +var p1 = point(0, 0); +>p1 : Point +>point(0, 0) : Point +>point : typeof point + +var p2 = point.origin; +>p2 : Point +>point.origin : Point +>point : typeof point +>origin : Point + +var b = point.equals(p1, p2); +>b : boolean +>point.equals(p1, p2) : boolean +>point.equals : (p1: Point, p2: Point) => boolean +>point : typeof point +>equals : (p1: Point, p2: Point) => boolean +>p1 : Point +>p2 : Point + diff --git a/tests/baselines/reference/mergedDeclarations4.types b/tests/baselines/reference/mergedDeclarations4.types new file mode 100644 index 00000000000..08f06f0730c --- /dev/null +++ b/tests/baselines/reference/mergedDeclarations4.types @@ -0,0 +1,63 @@ +=== tests/cases/compiler/mergedDeclarations4.ts === +module M { +>M : typeof M + + export function f() { } +>f : typeof f + + f(); +>f() : void +>f : typeof f + + M.f(); +>M.f() : void +>M.f : typeof f +>M : typeof M +>f : typeof f + + var r = f.hello; +>r : number +>f.hello : number +>f : typeof f +>hello : number +} + +module M { +>M : typeof M + + export module f { +>f : typeof f + + export var hello = 1; +>hello : number + } + f(); +>f() : void +>f : typeof f + + M.f(); +>M.f() : void +>M.f : typeof f +>M : typeof M +>f : typeof f + + var r = f.hello; +>r : number +>f.hello : number +>f : typeof f +>hello : number +} + +M.f(); +>M.f() : void +>M.f : typeof f +>M : typeof M +>f : typeof f + +M.f.hello; +>M.f.hello : number +>M.f : typeof f +>M : typeof M +>f : typeof f +>hello : number + diff --git a/tests/baselines/reference/mergedEnumDeclarationCodeGen.types b/tests/baselines/reference/mergedEnumDeclarationCodeGen.types new file mode 100644 index 00000000000..84e6a8237e5 --- /dev/null +++ b/tests/baselines/reference/mergedEnumDeclarationCodeGen.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/mergedEnumDeclarationCodeGen.ts === +enum E { +>E : E + + a, +>a : E + + b = a +>b : E +>a : E +} +enum E { +>E : E + + c = a +>c : E +>a : E +} diff --git a/tests/baselines/reference/mergedInterfaceFromMultipleFiles1.types b/tests/baselines/reference/mergedInterfaceFromMultipleFiles1.types new file mode 100644 index 00000000000..ad6b07f0312 --- /dev/null +++ b/tests/baselines/reference/mergedInterfaceFromMultipleFiles1.types @@ -0,0 +1,63 @@ +=== tests/cases/compiler/mergedInterfaceFromMultipleFiles1_1.ts === +/// + +interface D { bar(): number; } +>D : D +>bar : () => number + +interface C extends D { +>C : C +>D : D + + b(): Date; +>b : () => Date +>Date : Date +} + +var c:C; +>c : C +>C : C + +var a: string = c.foo(); +>a : string +>c.foo() : string +>c.foo : () => string +>c : C +>foo : () => string + +var b: number = c.bar(); +>b : number +>c.bar() : number +>c.bar : () => number +>c : C +>bar : () => number + +var d: number = c.a(); +>d : number +>c.a() : number +>c.a : () => number +>c : C +>a : () => number + +var e: Date = c.b(); +>e : Date +>Date : Date +>c.b() : Date +>c.b : () => Date +>c : C +>b : () => Date + +=== tests/cases/compiler/mergedInterfaceFromMultipleFiles1_0.ts === + +interface I { foo(): string; } +>I : I +>foo : () => string + +interface C extends I { +>C : C +>I : I + + a(): number; +>a : () => number +} + diff --git a/tests/baselines/reference/mergedInterfacesWithIndexers.types b/tests/baselines/reference/mergedInterfacesWithIndexers.types new file mode 100644 index 00000000000..cd082153626 --- /dev/null +++ b/tests/baselines/reference/mergedInterfacesWithIndexers.types @@ -0,0 +1,38 @@ +=== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithIndexers.ts === +// indexers should behave like other members when merging interface declarations + +interface A { +>A : A + + [x: number]: string; +>x : number +} + + +interface A { +>A : A + + [x: string]: { length: number }; +>x : string +>length : number +} + +var a: A; +>a : A +>A : A + +var r = a[1]; +>r : string +>a[1] : string +>a : A + +var r2 = a['1']; +>r2 : { length: number; } +>a['1'] : { length: number; } +>a : A + +var r3 = a['hi']; +>r3 : { length: number; } +>a['hi'] : { length: number; } +>a : A + diff --git a/tests/baselines/reference/mergedInterfacesWithMultipleBases.types b/tests/baselines/reference/mergedInterfacesWithMultipleBases.types new file mode 100644 index 00000000000..33b72a51710 --- /dev/null +++ b/tests/baselines/reference/mergedInterfacesWithMultipleBases.types @@ -0,0 +1,121 @@ +=== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases.ts === +// merged interfaces behave as if all extends clauses from each declaration are merged together +// no errors expected + +class C { +>C : C + + a: number; +>a : number +} + +class C2 { +>C2 : C2 + + b: number; +>b : number +} + +interface A extends C { +>A : A +>C : C + + y: string; +>y : string +} + +interface A extends C2 { +>A : A +>C2 : C2 + + z: string; +>z : string +} + +class D implements A { +>D : D +>A : A + + a: number; +>a : number + + b: number; +>b : number + + y: string; +>y : string + + z: string; +>z : string +} + +var a: A; +>a : A +>A : A + +var r = a.a; +>r : number +>a.a : number +>a : A +>a : number + +// generic interfaces in a module +module M { +>M : typeof M + + class C { +>C : C +>T : T + + a: T; +>a : T +>T : T + } + + class C2 { +>C2 : C2 +>T : T + + b: T; +>b : T +>T : T + } + + interface A extends C { +>A : A +>T : T +>C : C +>T : T + + y: T; +>y : T +>T : T + } + + interface A extends C2 { +>A : A +>T : T +>C2 : C2 + + z: T; +>z : T +>T : T + } + + class D implements A { +>D : D +>A : A + + a: boolean; +>a : boolean + + b: string; +>b : string + + y: boolean; +>y : boolean + + z: boolean; +>z : boolean + } +} diff --git a/tests/baselines/reference/mergedInterfacesWithMultipleBases2.types b/tests/baselines/reference/mergedInterfacesWithMultipleBases2.types new file mode 100644 index 00000000000..862e1e6fc17 --- /dev/null +++ b/tests/baselines/reference/mergedInterfacesWithMultipleBases2.types @@ -0,0 +1,171 @@ +=== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases2.ts === +// merged interfaces behave as if all extends clauses from each declaration are merged together +// no errors expected + +class C { +>C : C + + a: number; +>a : number +} + +class C2 { +>C2 : C2 + + b: number; +>b : number +} + +class C3 { +>C3 : C3 + + c: string; +>c : string +} + +class C4 { +>C4 : C4 + + d: string; +>d : string +} + + +interface A extends C, C3 { +>A : A +>C : C +>C3 : C3 + + y: string; +>y : string +} + +interface A extends C2, C4 { +>A : A +>C2 : C2 +>C4 : C4 + + z: string; +>z : string +} + +class D implements A { +>D : D +>A : A + + a: number; +>a : number + + b: number; +>b : number + + c: string; +>c : string + + d: string; +>d : string + + y: string; +>y : string + + z: string; +>z : string +} + +var a: A; +>a : A +>A : A + +var r = a.a; +>r : number +>a.a : number +>a : A +>a : number + +// generic interfaces in a module +module M { +>M : typeof M + + class C { +>C : C +>T : T + + a: T; +>a : T +>T : T + } + + class C2 { +>C2 : C2 +>T : T + + b: T; +>b : T +>T : T + } + + class C3 { +>C3 : C3 +>T : T + + c: T; +>c : T +>T : T + } + + class C4 { +>C4 : C4 +>T : T + + d: T; +>d : T +>T : T + } + + interface A extends C, C3 { +>A : A +>T : T +>C : C +>T : T +>C3 : C3 +>T : T + + y: T; +>y : T +>T : T + } + + interface A extends C2, C4 { +>A : A +>T : T +>C2 : C2 +>C4 : C4 + + z: T; +>z : T +>T : T + } + + class D implements A { +>D : D +>A : A + + a: boolean; +>a : boolean + + b: string; +>b : string + + c: boolean; +>c : boolean + + d: string; +>d : string + + y: boolean; +>y : boolean + + z: boolean; +>z : boolean + } +} diff --git a/tests/baselines/reference/mergedInterfacesWithMultipleBases3.types b/tests/baselines/reference/mergedInterfacesWithMultipleBases3.types new file mode 100644 index 00000000000..423678ad0be --- /dev/null +++ b/tests/baselines/reference/mergedInterfacesWithMultipleBases3.types @@ -0,0 +1,85 @@ +=== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases3.ts === +// merged interfaces behave as if all extends clauses from each declaration are merged together +// no errors expected + +class C { +>C : C +>T : T + + a: T; +>a : T +>T : T +} + +class C2 { +>C2 : C2 +>T : T + + b: T; +>b : T +>T : T +} + +class C3 { +>C3 : C3 +>T : T + + c: T; +>c : T +>T : T +} + +class C4 { +>C4 : C4 +>T : T + + d: T; +>d : T +>T : T +} + +interface A extends C, C3 { +>A : A +>T : T +>C : C +>C3 : C3 + + y: T; +>y : T +>T : T +} + +interface A extends C, C4 { +>A : A +>T : T +>C : C +>C4 : C4 + + z: T; +>z : T +>T : T +} + +class D implements A { +>D : D +>A : A + + a: string; +>a : string + + b: Date; +>b : Date +>Date : Date + + c: string; +>c : string + + d: string; +>d : string + + y: boolean; +>y : boolean + + z: boolean; +>z : boolean +} diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen2.types b/tests/baselines/reference/mergedModuleDeclarationCodeGen2.types new file mode 100644 index 00000000000..d27056b3bdd --- /dev/null +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen2.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/mergedModuleDeclarationCodeGen2.ts === +module my.data.foo { +>my : typeof my +>data : typeof data +>foo : typeof foo + + export function buz() { } +>buz : () => void +} +module my.data { +>my : typeof my +>data : typeof data + + function data(my) { +>data : (my: any) => void +>my : any + + foo.buz(); +>foo.buz() : void +>foo.buz : () => void +>foo : typeof foo +>buz : () => void + } +} diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen3.types b/tests/baselines/reference/mergedModuleDeclarationCodeGen3.types new file mode 100644 index 00000000000..45f652fe3c0 --- /dev/null +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen3.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/mergedModuleDeclarationCodeGen3.ts === +module my.data { +>my : typeof my +>data : typeof data + + export function buz() { } +>buz : () => void +} +module my.data.foo { +>my : typeof my +>data : typeof data +>foo : typeof foo + + function data(my, foo) { +>data : (my: any, foo: any) => void +>my : any +>foo : any + + buz(); +>buz() : void +>buz : () => void + } +} diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen4.types b/tests/baselines/reference/mergedModuleDeclarationCodeGen4.types new file mode 100644 index 00000000000..0907a21a969 --- /dev/null +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen4.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/mergedModuleDeclarationCodeGen4.ts === +module superContain { +>superContain : typeof superContain + + export module contain { +>contain : typeof contain + + export module my.buz { +>my : typeof my +>buz : typeof buz + + export module data { +>data : typeof data + + export function foo() { } +>foo : () => void + } + } + export module my.buz { +>my : typeof my +>buz : typeof buz + + export module data { +>data : typeof data + + export function bar(contain, my, buz, data) { +>bar : (contain: any, my: any, buz: any, data: any) => void +>contain : any +>my : any +>buz : any +>data : any + + foo(); +>foo() : void +>foo : () => void + } + } + } + } +} diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen5.types b/tests/baselines/reference/mergedModuleDeclarationCodeGen5.types new file mode 100644 index 00000000000..344f052eb4c --- /dev/null +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen5.types @@ -0,0 +1,54 @@ +=== tests/cases/compiler/mergedModuleDeclarationCodeGen5.ts === +module M.buz.plop { +>M : typeof M +>buz : typeof buz +>plop : typeof plop + + export function doom() { } +>doom : () => void + + export function M() { } +>M : () => void +} +module M.buz.plop { +>M : typeof M +>buz : typeof buz +>plop : typeof plop + + function gunk() { } +>gunk : () => void + + function buz() { } +>buz : () => void + + export class fudge { } +>fudge : fudge + + export enum plop { } +>plop : plop + + // Emit these references as follows + var v1 = gunk; // gunk +>v1 : () => void +>gunk : () => void + + var v2 = buz; // buz +>v2 : () => void +>buz : () => void + + export var v3 = doom; // _plop.doom +>v3 : () => void +>doom : () => void + + export var v4 = M; // _plop.M +>v4 : () => void +>M : () => void + + export var v5 = fudge; // fudge +>v5 : typeof fudge +>fudge : typeof fudge + + export var v6 = plop; // plop +>v6 : typeof plop +>plop : typeof plop +} diff --git a/tests/baselines/reference/mergedModuleDeclarationWithSharedExportedVar.types b/tests/baselines/reference/mergedModuleDeclarationWithSharedExportedVar.types new file mode 100644 index 00000000000..89d155861a5 --- /dev/null +++ b/tests/baselines/reference/mergedModuleDeclarationWithSharedExportedVar.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/mergedModuleDeclarationWithSharedExportedVar.ts === +module M { +>M : typeof M + + export var v = 10; +>v : number + + v; +>v : number +} +module M { +>M : typeof M + + v; +>v : number +} diff --git a/tests/baselines/reference/methodContainingLocalFunction.types b/tests/baselines/reference/methodContainingLocalFunction.types new file mode 100644 index 00000000000..29d39cd9e19 --- /dev/null +++ b/tests/baselines/reference/methodContainingLocalFunction.types @@ -0,0 +1,147 @@ +=== tests/cases/compiler/methodContainingLocalFunction.ts === +// The first case here (BugExhibition) caused a crash. Try with different permutations of features. +class BugExhibition { +>BugExhibition : BugExhibition +>T : T + + public exhibitBug() { +>exhibitBug : () => void + + function localFunction() { } +>localFunction : () => void + + var x: { (): void; }; +>x : () => void + + x = localFunction; +>x = localFunction : () => void +>x : () => void +>localFunction : () => void + } +} + +class BugExhibition2 { +>BugExhibition2 : BugExhibition2 +>T : T + + private static get exhibitBug() { +>exhibitBug : any + + function localFunction() { } +>localFunction : () => void + + var x: { (): void; }; +>x : () => void + + x = localFunction; +>x = localFunction : () => void +>x : () => void +>localFunction : () => void + + return null; + } +} + +class BugExhibition3 { +>BugExhibition3 : BugExhibition3 +>T : T + + public exhibitBug() { +>exhibitBug : () => void + + function localGenericFunction(u?: U) { } +>localGenericFunction : (u?: U) => void +>U : U +>u : U +>U : U + + var x: { (): void; }; +>x : () => void + + x = localGenericFunction; +>x = localGenericFunction : (u?: U) => void +>x : () => void +>localGenericFunction : (u?: U) => void + } +} + +class C { +>C : C + + exhibit() { +>exhibit : () => void + + var funcExpr = (u?: U) => { }; +>funcExpr : (u?: U) => void +>(u?: U) => { } : (u?: U) => void +>U : U +>u : U +>U : U + + var x: { (): void; }; +>x : () => void + + x = funcExpr; +>x = funcExpr : (u?: U) => void +>x : () => void +>funcExpr : (u?: U) => void + } +} + +module M { +>M : typeof M + + export function exhibitBug() { +>exhibitBug : () => void + + function localFunction() { } +>localFunction : () => void + + var x: { (): void; }; +>x : () => void + + x = localFunction; +>x = localFunction : () => void +>x : () => void +>localFunction : () => void + } +} + +enum E { +>E : E + + A = (() => { +>A : E +>(() => { + function localFunction() { } + var x: { (): void; }; + x = localFunction; + return 0; + })() : number +>(() => { + function localFunction() { } + var x: { (): void; }; + x = localFunction; + return 0; + }) : () => number +>() => { + function localFunction() { } + var x: { (): void; }; + x = localFunction; + return 0; + } : () => number + + function localFunction() { } +>localFunction : () => void + + var x: { (): void; }; +>x : () => void + + x = localFunction; +>x = localFunction : () => void +>x : () => void +>localFunction : () => void + + return 0; + })() +} diff --git a/tests/baselines/reference/methodSignatureDeclarationEmit1.types b/tests/baselines/reference/methodSignatureDeclarationEmit1.types new file mode 100644 index 00000000000..30bcf0661b6 --- /dev/null +++ b/tests/baselines/reference/methodSignatureDeclarationEmit1.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/methodSignatureDeclarationEmit1.ts === +class C { +>C : C + + public foo(n: number): void; +>foo : { (n: number): void; (s: string): void; } +>n : number + + public foo(s: string): void; +>foo : { (n: number): void; (s: string): void; } +>s : string + + public foo(a: any): void { +>foo : { (n: number): void; (s: string): void; } +>a : any + } +} diff --git a/tests/baselines/reference/methodSignaturesWithOverloads2.types b/tests/baselines/reference/methodSignaturesWithOverloads2.types new file mode 100644 index 00000000000..1c0a44db753 --- /dev/null +++ b/tests/baselines/reference/methodSignaturesWithOverloads2.types @@ -0,0 +1,96 @@ +=== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/methodSignaturesWithOverloads2.ts === +// Object type literals permit overloads with optionality but they must match + +var c: { +>c : { func4?(x: number): number; func4?(s: string): string; func5?: { (x: number): number; (s: string): string; }; } + + func4?(x: number): number; +>func4 : { (x: number): number; (s: string): string; } +>x : number + + func4?(s: string): string; +>func4 : { (x: number): number; (s: string): string; } +>s : string + + func5?: { +>func5 : { (x: number): number; (s: string): string; } + + (x: number): number; +>x : number + + (s: string): string; +>s : string + + }; +}; + +// no errors +c.func4 = c.func5; +>c.func4 = c.func5 : { (x: number): number; (s: string): string; } +>c.func4 : { (x: number): number; (s: string): string; } +>c : { func4?(x: number): number; func4?(s: string): string; func5?: { (x: number): number; (s: string): string; }; } +>func4 : { (x: number): number; (s: string): string; } +>c.func5 : { (x: number): number; (s: string): string; } +>c : { func4?(x: number): number; func4?(s: string): string; func5?: { (x: number): number; (s: string): string; }; } +>func5 : { (x: number): number; (s: string): string; } + +c.func5 = c.func4; +>c.func5 = c.func4 : { (x: number): number; (s: string): string; } +>c.func5 : { (x: number): number; (s: string): string; } +>c : { func4?(x: number): number; func4?(s: string): string; func5?: { (x: number): number; (s: string): string; }; } +>func5 : { (x: number): number; (s: string): string; } +>c.func4 : { (x: number): number; (s: string): string; } +>c : { func4?(x: number): number; func4?(s: string): string; func5?: { (x: number): number; (s: string): string; }; } +>func4 : { (x: number): number; (s: string): string; } + + +var c2: { +>c2 : { func4?(x: T): number; func4?(s: T): string; func5?: { (x: T): number; (s: T): string; }; } + + func4?(x: T): number; +>func4 : { (x: T): number; (s: T): string; } +>T : T +>x : T +>T : T + + func4? (s: T): string; +>func4 : { (x: T): number; (s: T): string; } +>T : T +>s : T +>T : T + + func5?: { +>func5 : { (x: T): number; (s: T): string; } + + (x: T): number; +>T : T +>x : T +>T : T + + (s: T): string; +>T : T +>s : T +>T : T + + }; +}; + +// no errors +c2.func4 = c2.func5; +>c2.func4 = c2.func5 : { (x: T): number; (s: T): string; } +>c2.func4 : { (x: T): number; (s: T): string; } +>c2 : { func4?(x: T): number; func4?(s: T): string; func5?: { (x: T): number; (s: T): string; }; } +>func4 : { (x: T): number; (s: T): string; } +>c2.func5 : { (x: T): number; (s: T): string; } +>c2 : { func4?(x: T): number; func4?(s: T): string; func5?: { (x: T): number; (s: T): string; }; } +>func5 : { (x: T): number; (s: T): string; } + +c2.func5 = c2.func4; +>c2.func5 = c2.func4 : { (x: T): number; (s: T): string; } +>c2.func5 : { (x: T): number; (s: T): string; } +>c2 : { func4?(x: T): number; func4?(s: T): string; func5?: { (x: T): number; (s: T): string; }; } +>func5 : { (x: T): number; (s: T): string; } +>c2.func4 : { (x: T): number; (s: T): string; } +>c2 : { func4?(x: T): number; func4?(s: T): string; func5?: { (x: T): number; (s: T): string; }; } +>func4 : { (x: T): number; (s: T): string; } + diff --git a/tests/baselines/reference/mismatchedGenericArguments1.types b/tests/baselines/reference/mismatchedGenericArguments1.types new file mode 100644 index 00000000000..41982d1de1b --- /dev/null +++ b/tests/baselines/reference/mismatchedGenericArguments1.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/mismatchedGenericArguments1.ts === +interface IFoo { +>IFoo : IFoo +>T : T + + foo(x: T): T; +>foo : (x: T) => T +>T : T +>x : T +>T : T +>T : T +} +class C implements IFoo { +>C : C +>T : T +>IFoo : IFoo +>T : T + + foo(x: string): number { +>foo : (x: string) => number +>x : string + + return null; + } +} + +class C2 implements IFoo { +>C2 : C2 +>T : T +>IFoo : IFoo +>T : T + + foo(x: string): number { +>foo : (x: string) => number +>U : U +>x : string + + return null; + } +} + diff --git a/tests/baselines/reference/missingImportAfterModuleImport.types b/tests/baselines/reference/missingImportAfterModuleImport.types new file mode 100644 index 00000000000..b8602ca06d0 --- /dev/null +++ b/tests/baselines/reference/missingImportAfterModuleImport.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/missingImportAfterModuleImport_1.ts === +/// +import SubModule = require('SubModule'); +>SubModule : typeof SubModule + +class MainModule { +>MainModule : MainModule + + // public static SubModule: SubModule; + public SubModule: SubModule; +>SubModule : SubModule +>SubModule : SubModule + + constructor() { } +} +export = MainModule; +>MainModule : MainModule + + +=== tests/cases/compiler/missingImportAfterModuleImport_0.ts === + +declare module "SubModule" { + class SubModule { +>SubModule : SubModule + + public static StaticVar: number; +>StaticVar : number + + public InstanceVar: number; +>InstanceVar : number + + constructor(); + } + export = SubModule; +>SubModule : SubModule +} + diff --git a/tests/baselines/reference/missingSelf.types b/tests/baselines/reference/missingSelf.types new file mode 100644 index 00000000000..5b46bf85db1 --- /dev/null +++ b/tests/baselines/reference/missingSelf.types @@ -0,0 +1,53 @@ +=== tests/cases/compiler/missingSelf.ts === +class CalcButton +>CalcButton : CalcButton +{ + public a() { this.onClick(); } +>a : () => void +>this.onClick() : void +>this.onClick : () => void +>this : CalcButton +>onClick : () => void + + public onClick() { } +>onClick : () => void +} + +class CalcButton2 +>CalcButton2 : CalcButton2 +{ + public b() { () => this.onClick(); } +>b : () => void +>() => this.onClick() : () => void +>this.onClick() : void +>this.onClick : () => void +>this : CalcButton2 +>onClick : () => void + + public onClick() { } +>onClick : () => void +} + +var c = new CalcButton(); +>c : CalcButton +>new CalcButton() : CalcButton +>CalcButton : typeof CalcButton + +c.a(); +>c.a() : void +>c.a : () => void +>c : CalcButton +>a : () => void + +var c2 = new CalcButton2(); +>c2 : CalcButton2 +>new CalcButton2() : CalcButton2 +>CalcButton2 : typeof CalcButton2 + +c2.b(); +>c2.b() : void +>c2.b : () => void +>c2 : CalcButton2 +>b : () => void + + diff --git a/tests/baselines/reference/missingTypeArguments3.types b/tests/baselines/reference/missingTypeArguments3.types new file mode 100644 index 00000000000..6c4bc9b3ccf --- /dev/null +++ b/tests/baselines/reference/missingTypeArguments3.types @@ -0,0 +1,172 @@ +=== tests/cases/compiler/missingTypeArguments3.ts === +declare module linq { +>linq : linq + + interface Enumerable { +>Enumerable : Enumerable +>T : T + + OrderByDescending(keySelector?: string): OrderedEnumerable; +>OrderByDescending : (keySelector?: string) => OrderedEnumerable +>keySelector : string +>OrderedEnumerable : OrderedEnumerable +>T : T + + GroupBy(keySelector: (element: T) => TKey): Enumerable>; +>GroupBy : { (keySelector: (element: T) => TKey): Enumerable>; (keySelector: (element: T) => TKey, elementSelector: (element: T) => TElement): Enumerable>; } +>TKey : TKey +>keySelector : (element: T) => TKey +>element : T +>T : T +>TKey : TKey +>Enumerable : Enumerable +>Grouping : Grouping +>TKey : TKey +>T : T + + GroupBy(keySelector: (element: T) => TKey, elementSelector: (element: T) => TElement): Enumerable>; +>GroupBy : { (keySelector: (element: T) => TKey): Enumerable>; (keySelector: (element: T) => TKey, elementSelector: (element: T) => TElement): Enumerable>; } +>TKey : TKey +>TElement : TElement +>keySelector : (element: T) => TKey +>element : T +>T : T +>TKey : TKey +>elementSelector : (element: T) => TElement +>element : T +>T : T +>TElement : TElement +>Enumerable : Enumerable +>Grouping : Grouping +>TKey : TKey +>TElement : TElement + + ToDictionary(keySelector: (element: T) => TKey): Dictionary; +>ToDictionary : (keySelector: (element: T) => TKey) => Dictionary +>TKey : TKey +>keySelector : (element: T) => TKey +>element : T +>T : T +>TKey : TKey +>Dictionary : Dictionary +>TKey : TKey +>T : T + } + + interface OrderedEnumerable extends Enumerable { +>OrderedEnumerable : OrderedEnumerable +>T : T +>Enumerable : Enumerable +>T : T + + ThenBy(keySelector: (element: T) => TCompare): OrderedEnumerable; // used to incorrectly think this was missing a type argument +>ThenBy : (keySelector: (element: T) => TCompare) => OrderedEnumerable +>TCompare : TCompare +>keySelector : (element: T) => TCompare +>element : T +>T : T +>TCompare : TCompare +>OrderedEnumerable : OrderedEnumerable +>T : T + } + + interface Grouping extends Enumerable { +>Grouping : Grouping +>TKey : TKey +>TElement : TElement +>Enumerable : Enumerable +>TElement : TElement + + Key(): TKey; +>Key : () => TKey +>TKey : TKey + } + + interface Lookup { +>Lookup : Lookup +>TKey : TKey +>TElement : TElement + + Count(): number; +>Count : () => number + + Get(key): Enumerable; +>Get : (key: any) => Enumerable +>key : any +>Enumerable : Enumerable + + Contains(key): boolean; +>Contains : (key: any) => boolean +>key : any + + ToEnumerable(): Enumerable>; +>ToEnumerable : () => Enumerable> +>Enumerable : Enumerable +>Grouping : Grouping +>TKey : TKey + } + + interface Dictionary { +>Dictionary : Dictionary +>TKey : TKey +>TValue : TValue + + Add(key: TKey, value: TValue): void; +>Add : (key: TKey, value: TValue) => void +>key : TKey +>TKey : TKey +>value : TValue +>TValue : TValue + + Get(ke: TKey): TValue; +>Get : (ke: TKey) => TValue +>ke : TKey +>TKey : TKey +>TValue : TValue + + Set(key: TKey, value: TValue): boolean; +>Set : (key: TKey, value: TValue) => boolean +>key : TKey +>TKey : TKey +>value : TValue +>TValue : TValue + + Contains(key: TKey): boolean; +>Contains : (key: TKey) => boolean +>key : TKey +>TKey : TKey + + Clear(): void; +>Clear : () => void + + Remove(key: TKey): void; +>Remove : (key: TKey) => void +>key : TKey +>TKey : TKey + + Count(): number; +>Count : () => number + + ToEnumerable(): Enumerable>; +>ToEnumerable : () => Enumerable> +>Enumerable : Enumerable +>KeyValuePair : KeyValuePair +>TKey : TKey +>TValue : TValue + } + + interface KeyValuePair { +>KeyValuePair : KeyValuePair +>TKey : TKey +>TValue : TValue + + Key: TKey; +>Key : TKey +>TKey : TKey + + Value: TValue; +>Value : TValue +>TValue : TValue + } +} + diff --git a/tests/baselines/reference/mixedExports.types b/tests/baselines/reference/mixedExports.types new file mode 100644 index 00000000000..c9448423cb9 --- /dev/null +++ b/tests/baselines/reference/mixedExports.types @@ -0,0 +1,38 @@ +=== tests/cases/compiler/mixedExports.ts === +declare module M { +>M : typeof M + + function foo(); +>foo : { (): any; (): any; (): any; } + + export function foo(); +>foo : { (): any; (): any; (): any; } + + function foo(); +>foo : { (): any; (): any; (): any; } +} + +declare module M1 { +>M1 : M1 + + export interface Foo {} +>Foo : Foo + + interface Foo {} +>Foo : Foo +} + +module A { +>A : A + + interface X {x} +>X : X +>x : any + + export module X {} +>X : X + + interface X {y} +>X : X +>y : any +} diff --git a/tests/baselines/reference/mixingFunctionAndAmbientModule1.types b/tests/baselines/reference/mixingFunctionAndAmbientModule1.types new file mode 100644 index 00000000000..c9e2e1167a9 --- /dev/null +++ b/tests/baselines/reference/mixingFunctionAndAmbientModule1.types @@ -0,0 +1,90 @@ +=== tests/cases/compiler/mixingFunctionAndAmbientModule1.ts === +module A { +>A : typeof A + + declare module My { +>My : typeof My + + export var x: number; +>x : number + } + function My(s: string) { } +>My : typeof My +>s : string +} + +module B { +>B : typeof B + + declare module My { +>My : typeof My + + export var x: number; +>x : number + } + function My(s: boolean); +>My : typeof My +>s : boolean + + function My(s: any) { } +>My : typeof My +>s : any +} + +module C { +>C : typeof C + + declare module My { +>My : typeof My + + export var x: number; +>x : number + } + declare function My(s: boolean); +>My : typeof My +>s : boolean +} + +module D { +>D : typeof D + + declare module My { +>My : typeof My + + export var x: number; +>x : number + } + declare function My(s: boolean); +>My : typeof My +>s : boolean + + declare function My(s: any); +>My : typeof My +>s : any +} + + +module E { +>E : typeof E + + declare module My { +>My : typeof My + + export var x: number; +>x : number + } + declare function My(s: boolean); +>My : typeof My +>s : boolean + + declare module My { +>My : typeof My + + export var y: number; +>y : number + } + declare function My(s: any); +>My : typeof My +>s : any +} + diff --git a/tests/baselines/reference/modFunctionCrash.types b/tests/baselines/reference/modFunctionCrash.types new file mode 100644 index 00000000000..596dac999a1 --- /dev/null +++ b/tests/baselines/reference/modFunctionCrash.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/modFunctionCrash.ts === +declare module Q { +>Q : typeof Q + + function f(fn:()=>void); // typechecking the function type shouldnot crash the compiler +>f : (fn: () => void) => any +>fn : () => void +} + + +Q.f(function() {this;}); +>Q.f(function() {this;}) : any +>Q.f : (fn: () => void) => any +>Q : typeof Q +>f : (fn: () => void) => any +>function() {this;} : () => void +>this : any + diff --git a/tests/baselines/reference/modKeyword.types b/tests/baselines/reference/modKeyword.types new file mode 100644 index 00000000000..6c11fed31fc --- /dev/null +++ b/tests/baselines/reference/modKeyword.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/modKeyword.ts === +var module:any; +>module : any + +var foo:any; +>foo : any + +var _ = module.exports = foo +>_ : any +>module.exports = foo : any +>module.exports : any +>module : any +>exports : any +>foo : any + diff --git a/tests/baselines/reference/moduleAliasAsFunctionArgument.types b/tests/baselines/reference/moduleAliasAsFunctionArgument.types new file mode 100644 index 00000000000..15954c681e7 --- /dev/null +++ b/tests/baselines/reference/moduleAliasAsFunctionArgument.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/moduleAliasAsFunctionArgument_1.ts === +/// +import a = require('moduleAliasAsFunctionArgument_0'); +>a : typeof "tests/cases/compiler/moduleAliasAsFunctionArgument_0" + +function fn(arg: { x: number }) { +>fn : (arg: { x: number; }) => void +>arg : { x: number; } +>x : number +} + +a.x; // OK +>a.x : number +>a : typeof "tests/cases/compiler/moduleAliasAsFunctionArgument_0" +>x : number + +fn(a); // Error: property 'x' is missing from 'a' +>fn(a) : void +>fn : (arg: { x: number; }) => void +>a : typeof "tests/cases/compiler/moduleAliasAsFunctionArgument_0" + +=== tests/cases/compiler/moduleAliasAsFunctionArgument_0.ts === +export var x: number; +>x : number + diff --git a/tests/baselines/reference/moduleAliasInterface.types b/tests/baselines/reference/moduleAliasInterface.types new file mode 100644 index 00000000000..809aba0e634 --- /dev/null +++ b/tests/baselines/reference/moduleAliasInterface.types @@ -0,0 +1,121 @@ +=== tests/cases/compiler/moduleAliasInterface.ts === +module _modes { +>_modes : typeof _modes + + export interface IMode { +>IMode : IMode + + } + + export class Mode { +>Mode : Mode + + } +} + +// _modes. // produces an internal error - please implement in derived class + +module editor { +>editor : typeof editor + + import modes = _modes; +>modes : typeof _modes +>_modes : typeof _modes + + var i : modes.IMode; +>i : IMode +>modes : modes +>IMode : IMode + + // If you just use p1:modes, the compiler accepts it - should be an error + class Bug { +>Bug : Bug + + constructor(p1: modes.IMode, p2: modes.Mode) { }// should be an error on p2 - it's not exported +>p1 : IMode +>modes : modes +>IMode : IMode +>p2 : Mode +>modes : modes +>Mode : Mode + + public foo(p1:modes.IMode) { +>foo : (p1: IMode) => void +>p1 : IMode +>modes : modes +>IMode : IMode + + } + } +} + +import modesOuter = _modes; +>modesOuter : typeof _modes +>_modes : typeof _modes + +module editor2 { +>editor2 : typeof editor2 + + var i : modesOuter.IMode; +>i : IMode +>modesOuter : modesOuter +>IMode : IMode + + class Bug { +>Bug : Bug + + constructor(p1: modesOuter.IMode, p2: modesOuter.Mode) { }// no error here, since modesOuter is declared externally +>p1 : IMode +>modesOuter : modesOuter +>IMode : IMode +>p2 : Mode +>modesOuter : modesOuter +>Mode : Mode + + } + + module Foo { export class Bar{} } +>Foo : typeof Foo +>Bar : Bar + + class Bug2 { +>Bug2 : Bug2 + + constructor(p1: Foo.Bar, p2: modesOuter.Mode) { } +>p1 : Bar +>Foo : Foo +>Bar : Bar +>p2 : Mode +>modesOuter : modesOuter +>Mode : Mode + } +} + +module A1 { +>A1 : typeof A1 + + export interface A1I1 {} +>A1I1 : A1I1 + + export class A1C1 {} +>A1C1 : A1C1 +} + +module B1 { +>B1 : typeof B1 + + import A1Alias1 = A1; +>A1Alias1 : typeof A1 +>A1 : typeof A1 + + var i : A1Alias1.A1I1; +>i : A1I1 +>A1Alias1 : A1Alias1 +>A1I1 : A1I1 + + var c : A1Alias1.A1C1; +>c : A1C1 +>A1Alias1 : A1Alias1 +>A1C1 : A1C1 +} + diff --git a/tests/baselines/reference/moduleAndInterfaceSharingName.types b/tests/baselines/reference/moduleAndInterfaceSharingName.types new file mode 100644 index 00000000000..65f8d8c9c70 --- /dev/null +++ b/tests/baselines/reference/moduleAndInterfaceSharingName.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/moduleAndInterfaceSharingName.ts === +module X { +>X : X + + export module Y { +>Y : Y + + export interface Z { } +>Z : Z + } + export interface Y { } +>Y : Y +} +var z: X.Y.Z = null; +>z : Z +>X : X +>Y : Y +>Z : Z + +var z2: X.Y; +>z2 : Y +>X : X +>Y : Y + diff --git a/tests/baselines/reference/moduleAndInterfaceSharingName3.types b/tests/baselines/reference/moduleAndInterfaceSharingName3.types new file mode 100644 index 00000000000..59fe842a5d6 --- /dev/null +++ b/tests/baselines/reference/moduleAndInterfaceSharingName3.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/moduleAndInterfaceSharingName3.ts === +module X { +>X : X + + export module Y { +>Y : Y + + export interface Z { } +>Z : Z + } + export interface Y { } +>Y : Y +>T : T +} +var z: X.Y.Z = null; +>z : Z +>X : X +>Y : Y +>Z : Z + +var z2: X.Y; +>z2 : Y +>X : X +>Y : Y + diff --git a/tests/baselines/reference/moduleAndInterfaceSharingName4.types b/tests/baselines/reference/moduleAndInterfaceSharingName4.types new file mode 100644 index 00000000000..ef933ef7fe5 --- /dev/null +++ b/tests/baselines/reference/moduleAndInterfaceSharingName4.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/moduleAndInterfaceSharingName4.ts === +declare module D3 { +>D3 : typeof D3 + + var x: D3.Color.Color; +>x : Color +>D3 : D3 +>Color : Color +>Color : Color + + module Color { +>Color : Color + + export interface Color { +>Color : Color + + darker: Color; +>darker : Color +>Color : Color + } + } +} diff --git a/tests/baselines/reference/moduleCodeGenTest3.types b/tests/baselines/reference/moduleCodeGenTest3.types new file mode 100644 index 00000000000..d5e10130c0d --- /dev/null +++ b/tests/baselines/reference/moduleCodeGenTest3.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/moduleCodeGenTest3.ts === +module Baz { export var x = "hello"; } +>Baz : typeof Baz +>x : string + +Baz.x = "goodbye"; +>Baz.x = "goodbye" : string +>Baz.x : string +>Baz : typeof Baz +>x : string + diff --git a/tests/baselines/reference/moduleCodeGenTest5.types b/tests/baselines/reference/moduleCodeGenTest5.types new file mode 100644 index 00000000000..40161509aff --- /dev/null +++ b/tests/baselines/reference/moduleCodeGenTest5.types @@ -0,0 +1,53 @@ +=== tests/cases/compiler/moduleCodeGenTest5.ts === +export var x = 0; +>x : number + +var y = 0; +>y : number + +export function f1() {} +>f1 : () => void + +function f2() {} +>f2 : () => void + +export class C1 { +>C1 : C1 + + public p1 = 0; +>p1 : number + + public p2() {} +>p2 : () => void +} +class C2{ +>C2 : C2 + + public p1 = 0; +>p1 : number + + public p2() {} +>p2 : () => void +} + +export enum E1 {A=0} +>E1 : E1 +>A : E1 + +var u = E1.A; +>u : E1 +>E1.A : E1 +>E1 : typeof E1 +>A : E1 + +enum E2 {B=0} +>E2 : E2 +>B : E2 + +var v = E2.B; +>v : E2 +>E2.B : E2 +>E2 : typeof E2 +>B : E2 + + diff --git a/tests/baselines/reference/moduleCodegenTest4.types b/tests/baselines/reference/moduleCodegenTest4.types new file mode 100644 index 00000000000..7b9229a46c1 --- /dev/null +++ b/tests/baselines/reference/moduleCodegenTest4.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/moduleCodegenTest4.ts === +export module Baz { export var x = "hello"; } +>Baz : typeof Baz +>x : string + +Baz.x = "goodbye"; +>Baz.x = "goodbye" : string +>Baz.x : string +>Baz : typeof Baz +>x : string + +void 0; +>void 0 : undefined + diff --git a/tests/baselines/reference/moduleIdentifiers.types b/tests/baselines/reference/moduleIdentifiers.types new file mode 100644 index 00000000000..db8b1c3f720 --- /dev/null +++ b/tests/baselines/reference/moduleIdentifiers.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/moduleIdentifiers.ts === +module M { +>M : typeof M + + interface P { x: number; y: number; } +>P : P +>x : number +>y : number + + export var a = 1 +>a : number +} + +//var p: M.P; +//var m: M = M; +var x1 = M.a; +>x1 : number +>M.a : number +>M : typeof M +>a : number + +//var x2 = m.a; +//var q: m.P; diff --git a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.types b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.types new file mode 100644 index 00000000000..264d862675a --- /dev/null +++ b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/moduleImportedForTypeArgumentPosition_1.ts === +/**This is on import declaration*/ +import M2 = require("moduleImportedForTypeArgumentPosition_0"); +>M2 : typeof "tests/cases/compiler/moduleImportedForTypeArgumentPosition_0" + +class C1{ } +>C1 : C1 +>T : T + +class Test1 extends C1 { +>Test1 : Test1 +>C1 : C1 +>M2 : M2 +>M2C : M2C +} + +=== tests/cases/compiler/moduleImportedForTypeArgumentPosition_0.ts === +export interface M2C { } +>M2C : M2C + diff --git a/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.types b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.types new file mode 100644 index 00000000000..d8f6083b2c9 --- /dev/null +++ b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.types @@ -0,0 +1,116 @@ +=== tests/cases/compiler/moduleMemberWithoutTypeAnnotation1.ts === +module TypeScript.Parser { +>TypeScript : typeof TypeScript +>Parser : typeof Parser + + class SyntaxCursor { +>SyntaxCursor : SyntaxCursor + + public currentNode(): SyntaxNode { +>currentNode : () => SyntaxNode +>SyntaxNode : SyntaxNode + + return null; + } + } +} + +module TypeScript { +>TypeScript : typeof TypeScript + + export interface ISyntaxElement { }; +>ISyntaxElement : ISyntaxElement + + export interface ISyntaxToken { }; +>ISyntaxToken : ISyntaxToken + + export class PositionedElement { +>PositionedElement : PositionedElement + + public childIndex(child: ISyntaxElement) { +>childIndex : (child: ISyntaxElement) => void +>child : ISyntaxElement +>ISyntaxElement : ISyntaxElement + + return Syntax.childIndex(); +>Syntax.childIndex() : void +>Syntax.childIndex : () => void +>Syntax : typeof Syntax +>childIndex : () => void + } + } + + export class PositionedToken { +>PositionedToken : PositionedToken + + constructor(parent: PositionedElement, token: ISyntaxToken, fullStart: number) { +>parent : PositionedElement +>PositionedElement : PositionedElement +>token : ISyntaxToken +>ISyntaxToken : ISyntaxToken +>fullStart : number + } + } +} + +module TypeScript { +>TypeScript : typeof TypeScript + + export class SyntaxNode { +>SyntaxNode : SyntaxNode + + public findToken(position: number, includeSkippedTokens: boolean = false): PositionedToken { +>findToken : (position: number, includeSkippedTokens?: boolean) => PositionedToken +>position : number +>includeSkippedTokens : boolean +>PositionedToken : PositionedToken + + var positionedToken = this.findTokenInternal(null, position, 0); +>positionedToken : any +>this.findTokenInternal(null, position, 0) : any +>this.findTokenInternal : (x: any, y: any, z: any) => any +>this : SyntaxNode +>findTokenInternal : (x: any, y: any, z: any) => any +>position : number + + return null; + } + findTokenInternal(x, y, z) { +>findTokenInternal : (x: any, y: any, z: any) => any +>x : any +>y : any +>z : any + + return null; + } + } +} + +module TypeScript.Syntax { +>TypeScript : typeof TypeScript +>Syntax : typeof Syntax + + export function childIndex() { } +>childIndex : () => void + + export class VariableWidthTokenWithTrailingTrivia implements ISyntaxToken { +>VariableWidthTokenWithTrailingTrivia : VariableWidthTokenWithTrailingTrivia +>ISyntaxToken : ISyntaxToken + + private findTokenInternal(parent: PositionedElement, position: number, fullStart: number) { +>findTokenInternal : (parent: PositionedElement, position: number, fullStart: number) => PositionedToken +>parent : PositionedElement +>PositionedElement : PositionedElement +>position : number +>fullStart : number + + return new PositionedToken(parent, this, fullStart); +>new PositionedToken(parent, this, fullStart) : PositionedToken +>PositionedToken : typeof PositionedToken +>parent : PositionedElement +>this : VariableWidthTokenWithTrailingTrivia +>fullStart : number + } + } +} + diff --git a/tests/baselines/reference/moduleMemberWithoutTypeAnnotation2.types b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation2.types new file mode 100644 index 00000000000..2a5d2c76e76 --- /dev/null +++ b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation2.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/moduleMemberWithoutTypeAnnotation2.ts === +module TypeScript { +>TypeScript : typeof TypeScript + + export module CompilerDiagnostics { +>CompilerDiagnostics : typeof CompilerDiagnostics + + export interface IDiagnosticWriter { +>IDiagnosticWriter : IDiagnosticWriter + + Alert(output: string): void; +>Alert : (output: string) => void +>output : string + } + + export var diagnosticWriter = null; +>diagnosticWriter : any + + export function Alert(output: string) { +>Alert : (output: string) => void +>output : string + + if (diagnosticWriter) { +>diagnosticWriter : any + + diagnosticWriter.Alert(output); +>diagnosticWriter.Alert(output) : any +>diagnosticWriter.Alert : any +>diagnosticWriter : any +>Alert : any +>output : string + } + } + } +} + diff --git a/tests/baselines/reference/moduleMerge.types b/tests/baselines/reference/moduleMerge.types new file mode 100644 index 00000000000..b70f786b7a2 --- /dev/null +++ b/tests/baselines/reference/moduleMerge.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/moduleMerge.ts === +// This should not compile both B classes are in the same module this should be a collission + +module A +>A : typeof A +{ + class B +>B : B + { + public Hello(): string +>Hello : () => string + { + return "from private B"; + } + } +} + +module A +>A : typeof A +{ + export class B +>B : B + { + public Hello(): string +>Hello : () => string + { + return "from export B"; + } + } +} diff --git a/tests/baselines/reference/moduleNoEmit.types b/tests/baselines/reference/moduleNoEmit.types new file mode 100644 index 00000000000..7fb6b6164d6 --- /dev/null +++ b/tests/baselines/reference/moduleNoEmit.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/moduleNoEmit.ts === +module Foo { +>Foo : typeof Foo + + 1+1; +>1+1 : number +} diff --git a/tests/baselines/reference/moduleOuterQualification.types b/tests/baselines/reference/moduleOuterQualification.types new file mode 100644 index 00000000000..e60ae3ca51f --- /dev/null +++ b/tests/baselines/reference/moduleOuterQualification.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/moduleOuterQualification.ts === + +declare module outer { +>outer : outer + + interface Beta { } +>Beta : Beta + + module inner { +>inner : inner + + // .d.ts emit: should be 'extends outer.Beta' + export interface Beta extends outer.Beta { } +>Beta : Beta +>outer : outer +>Beta : Beta + } +} + diff --git a/tests/baselines/reference/moduleRedifinitionErrors.types b/tests/baselines/reference/moduleRedifinitionErrors.types new file mode 100644 index 00000000000..34a5f428596 --- /dev/null +++ b/tests/baselines/reference/moduleRedifinitionErrors.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/moduleRedifinitionErrors.ts === +class A { +>A : A +} +module A { +>A : typeof A +} + diff --git a/tests/baselines/reference/moduleReopenedTypeOtherBlock.types b/tests/baselines/reference/moduleReopenedTypeOtherBlock.types new file mode 100644 index 00000000000..f98c069c338 --- /dev/null +++ b/tests/baselines/reference/moduleReopenedTypeOtherBlock.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/moduleReopenedTypeOtherBlock.ts === +module M { +>M : typeof M + + export class C1 { } +>C1 : C1 + + export interface I { n: number; } +>I : I +>n : number +} +module M { +>M : typeof M + + export class C2 { f(): I { return null; } } +>C2 : C2 +>f : () => I +>I : I +} + diff --git a/tests/baselines/reference/moduleReopenedTypeSameBlock.types b/tests/baselines/reference/moduleReopenedTypeSameBlock.types new file mode 100644 index 00000000000..8f119fff60c --- /dev/null +++ b/tests/baselines/reference/moduleReopenedTypeSameBlock.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/moduleReopenedTypeSameBlock.ts === +module M { export class C1 { } } +>M : typeof M +>C1 : C1 + +module M { +>M : typeof M + + export interface I { n: number; } +>I : I +>n : number + + export class C2 { f(): I { return null; } } +>C2 : C2 +>f : () => I +>I : I +} + diff --git a/tests/baselines/reference/moduleScopingBug.types b/tests/baselines/reference/moduleScopingBug.types new file mode 100644 index 00000000000..b92b8de0c81 --- /dev/null +++ b/tests/baselines/reference/moduleScopingBug.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/moduleScopingBug.ts === +module M +>M : typeof M + +{ + + var outer: number; +>outer : number + + function f() { +>f : () => void + + var inner = outer; // Ok +>inner : number +>outer : number + + } + + class C { +>C : C + + constructor() { + var inner = outer; // Ok +>inner : number +>outer : number + } + + } + + module X { +>X : typeof X + + var inner = outer; // Error: outer not visible +>inner : number +>outer : number + + } + +} + + diff --git a/tests/baselines/reference/moduleUnassignedVariable.types b/tests/baselines/reference/moduleUnassignedVariable.types new file mode 100644 index 00000000000..7d1dd8600cf --- /dev/null +++ b/tests/baselines/reference/moduleUnassignedVariable.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/moduleUnassignedVariable.ts === +module Bar { +>Bar : typeof Bar + + export var a = 1; +>a : number + + function fooA() { return a; } // Correct: return Bar.a +>fooA : () => number +>a : number + + export var b; +>b : any + + function fooB() { return b; } // Incorrect: return b +>fooB : () => any +>b : any +} + diff --git a/tests/baselines/reference/moduleVariableArrayIndexer.types b/tests/baselines/reference/moduleVariableArrayIndexer.types new file mode 100644 index 00000000000..564de3ff972 --- /dev/null +++ b/tests/baselines/reference/moduleVariableArrayIndexer.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/moduleVariableArrayIndexer.ts === +module Bar { +>Bar : typeof Bar + + export var a = 1; +>a : number + + var t = undefined[a][a]; // CG: var t = undefined[Bar.a][a]; +>t : any +>undefined[a][a] : any +>undefined[a] : any +>undefined : undefined +>a : number +>a : number +} + diff --git a/tests/baselines/reference/moduleVariables.types b/tests/baselines/reference/moduleVariables.types new file mode 100644 index 00000000000..2c00df87f56 --- /dev/null +++ b/tests/baselines/reference/moduleVariables.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/moduleVariables.ts === +declare var console: any; +>console : any + +var x = 1; +>x : number + +module M { +>M : typeof M + + export var x = 2; +>x : number + + console.log(x); // 2 +>console.log(x) : any +>console.log : any +>console : any +>log : any +>x : number +} + +module M { +>M : typeof M + + console.log(x); // 2 +>console.log(x) : any +>console.log : any +>console : any +>log : any +>x : number +} + +module M { +>M : typeof M + + var x = 3; +>x : number + + console.log(x); // 3 +>console.log(x) : any +>console.log : any +>console : any +>log : any +>x : number +} + diff --git a/tests/baselines/reference/moduleVisibilityTest1.types b/tests/baselines/reference/moduleVisibilityTest1.types new file mode 100644 index 00000000000..bb20aac9e46 --- /dev/null +++ b/tests/baselines/reference/moduleVisibilityTest1.types @@ -0,0 +1,175 @@ +=== tests/cases/compiler/moduleVisibilityTest1.ts === + + +module OuterMod { +>OuterMod : typeof OuterMod + + export function someExportedOuterFunc() { return -1; } +>someExportedOuterFunc : () => number +>-1 : number + + export module OuterInnerMod { +>OuterInnerMod : typeof OuterInnerMod + + export function someExportedOuterInnerFunc() { return "foo"; } +>someExportedOuterInnerFunc : () => string + } +} + +import OuterInnerAlias = OuterMod.OuterInnerMod; +>OuterInnerAlias : typeof OuterInnerMod +>OuterMod : typeof OuterInnerMod +>OuterInnerMod : typeof OuterInnerMod + +module M { +>M : typeof M + + export module InnerMod { +>InnerMod : typeof InnerMod + + export function someExportedInnerFunc() { return -2; } +>someExportedInnerFunc : () => number +>-2 : number + } + + export enum E { +>E : E + + A, +>A : E + + B, +>B : E + + C, +>C : E + } + + export var x = 5; +>x : number + + export declare var exported_var; +>exported_var : any + + var y = x + x; +>y : number +>x + x : number +>x : number +>x : number + + + export interface I { +>I : I + + someMethod():number; +>someMethod : () => number + } + + class B {public b = 0;} +>B : B +>b : number + + export class C implements I { +>C : C +>I : I + + public someMethodThatCallsAnOuterMethod() {return OuterInnerAlias.someExportedOuterInnerFunc();} +>someMethodThatCallsAnOuterMethod : () => string +>OuterInnerAlias.someExportedOuterInnerFunc() : string +>OuterInnerAlias.someExportedOuterInnerFunc : () => string +>OuterInnerAlias : typeof OuterInnerMod +>someExportedOuterInnerFunc : () => string + + public someMethodThatCallsAnInnerMethod() {return InnerMod.someExportedInnerFunc();} +>someMethodThatCallsAnInnerMethod : () => number +>InnerMod.someExportedInnerFunc() : number +>InnerMod.someExportedInnerFunc : () => number +>InnerMod : typeof InnerMod +>someExportedInnerFunc : () => number + + public someMethodThatCallsAnOuterInnerMethod() {return OuterMod.someExportedOuterFunc();} +>someMethodThatCallsAnOuterInnerMethod : () => number +>OuterMod.someExportedOuterFunc() : number +>OuterMod.someExportedOuterFunc : () => number +>OuterMod : typeof OuterMod +>someExportedOuterFunc : () => number + + public someMethod() { return 0; } +>someMethod : () => number + + public someProp = 1; +>someProp : number + + constructor() { + function someInnerFunc() { return 2; } +>someInnerFunc : () => number + + var someInnerVar = 3; +>someInnerVar : number + } + } + + var someModuleVar = 4; +>someModuleVar : number + + function someModuleFunction() { return 5;} +>someModuleFunction : () => number +} + +module M { +>M : typeof M + + export var c = x; +>c : number +>x : number + + export var meb = M.E.B; +>meb : E +>M.E.B : E +>M.E : typeof E +>M : typeof M +>E : typeof E +>B : E +} + +var cprime : M.I = null; +>cprime : I +>M : M +>I : I +>null : I +>M : M +>I : I + +var c = new M.C(); +>c : C +>new M.C() : C +>M.C : typeof C +>M : typeof M +>C : typeof C + +var z = M.x; +>z : number +>M.x : number +>M : typeof M +>x : number + +var alpha = M.E.A; +>alpha : E +>M.E.A : E +>M.E : typeof E +>M : typeof M +>E : typeof E +>A : E + +var omega = M.exported_var; +>omega : any +>M.exported_var : any +>M : typeof M +>exported_var : any + +c.someMethodThatCallsAnOuterMethod(); +>c.someMethodThatCallsAnOuterMethod() : string +>c.someMethodThatCallsAnOuterMethod : () => string +>c : C +>someMethodThatCallsAnOuterMethod : () => string + diff --git a/tests/baselines/reference/moduleWithStatementsOfEveryKind.types b/tests/baselines/reference/moduleWithStatementsOfEveryKind.types new file mode 100644 index 00000000000..af596503e5c --- /dev/null +++ b/tests/baselines/reference/moduleWithStatementsOfEveryKind.types @@ -0,0 +1,153 @@ +=== tests/cases/conformance/internalModules/moduleBody/moduleWithStatementsOfEveryKind.ts === +module A { +>A : typeof A + + class A { s: string } +>A : A +>s : string + + class AA { s: T } +>AA : AA +>T : T +>s : T +>T : T + + interface I { id: number } +>I : I +>id : number + + class B extends AA implements I { id: number } +>B : B +>AA : AA +>I : I +>id : number + + class BB extends A { +>BB : BB +>T : T +>A : A + + id: number; +>id : number + } + + module Module { +>Module : typeof Module + + class A { s: string } +>A : A +>s : string + } + enum Color { Blue, Red } +>Color : Color +>Blue : Color +>Red : Color + + var x = 12; +>x : number + + function F(s: string): number { +>F : (s: string) => number +>s : string + + return 2; + } + var array: I[] = null; +>array : I[] +>I : I + + var fn = (s: string) => { +>fn : (s: string) => string +>(s: string) => { + return 'hello ' + s; + } : (s: string) => string +>s : string + + return 'hello ' + s; +>'hello ' + s : string +>s : string + } + var ol = { s: 'hello', id: 2, isvalid: true }; +>ol : { s: string; id: number; isvalid: boolean; } +>{ s: 'hello', id: 2, isvalid: true } : { s: string; id: number; isvalid: boolean; } +>s : string +>id : number +>isvalid : boolean +} + +module Y { +>Y : typeof Y + + export class A { s: string } +>A : A +>s : string + + export class AA { s: T } +>AA : AA +>T : T +>s : T +>T : T + + export interface I { id: number } +>I : I +>id : number + + export class B extends AA implements I { id: number } +>B : B +>AA : AA +>I : I +>id : number + + export class BB extends A { +>BB : BB +>T : T +>A : A + + id: number; +>id : number + } + + export module Module { +>Module : typeof Module + + class A { s: string } +>A : A +>s : string + } + export enum Color { Blue, Red } +>Color : Color +>Blue : Color +>Red : Color + + export var x = 12; +>x : number + + export function F(s: string): number { +>F : (s: string) => number +>s : string + + return 2; + } + export var array: I[] = null; +>array : I[] +>I : I + + export var fn = (s: string) => { +>fn : (s: string) => string +>(s: string) => { + return 'hello ' + s; + } : (s: string) => string +>s : string + + return 'hello ' + s; +>'hello ' + s : string +>s : string + } + export var ol = { s: 'hello', id: 2, isvalid: true }; +>ol : { s: string; id: number; isvalid: boolean; } +>{ s: 'hello', id: 2, isvalid: true } : { s: string; id: number; isvalid: boolean; } +>s : string +>id : number +>isvalid : boolean +} + diff --git a/tests/baselines/reference/moduleWithTryStatement1.types b/tests/baselines/reference/moduleWithTryStatement1.types new file mode 100644 index 00000000000..9e18b649735 --- /dev/null +++ b/tests/baselines/reference/moduleWithTryStatement1.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/moduleWithTryStatement1.ts === +module M { +>M : typeof M + + try { + } + catch (e) { +>e : any + } +} +var v = M; +>v : typeof M +>M : typeof M + diff --git a/tests/baselines/reference/multiCallOverloads.types b/tests/baselines/reference/multiCallOverloads.types new file mode 100644 index 00000000000..8c789510580 --- /dev/null +++ b/tests/baselines/reference/multiCallOverloads.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/multiCallOverloads.ts === +interface ICallback { +>ICallback : ICallback + + (x?: string):void; +>x : string +} + +function load(f: ICallback) {} +>load : (f: ICallback) => void +>f : ICallback +>ICallback : ICallback + +var f1: ICallback = function(z?) {} +>f1 : ICallback +>ICallback : ICallback +>function(z?) {} : (z?: string) => void +>z : string + +var f2: ICallback = function(z?) {} +>f2 : ICallback +>ICallback : ICallback +>function(z?) {} : (z?: string) => void +>z : string + +load(f1) // ok +>load(f1) : void +>load : (f: ICallback) => void +>f1 : ICallback + +load(f2) // ok +>load(f2) : void +>load : (f: ICallback) => void +>f2 : ICallback + +load(function() {}) // this shouldn’t be an error +>load(function() {}) : void +>load : (f: ICallback) => void +>function() {} : () => void + +load(function(z?) {}) // this shouldn't be an error +>load(function(z?) {}) : void +>load : (f: ICallback) => void +>function(z?) {} : (z?: string) => void +>z : string + diff --git a/tests/baselines/reference/multiExtendsSplitInterfaces2.types b/tests/baselines/reference/multiExtendsSplitInterfaces2.types new file mode 100644 index 00000000000..b957d3dc260 --- /dev/null +++ b/tests/baselines/reference/multiExtendsSplitInterfaces2.types @@ -0,0 +1,59 @@ +=== tests/cases/compiler/multiExtendsSplitInterfaces2.ts === +interface A { +>A : A + + a: number; +>a : number +} + +interface I extends A { +>I : I +>A : A + + i1: number; +>i1 : number +} + +interface B { +>B : B + + b: number; +>b : number +} + +interface I extends B { +>I : I +>B : B + + i2: number; +>i2 : number +} + +var i: I; +>i : I +>I : I + +var a = i.a; +>a : number +>i.a : number +>i : I +>a : number + +var i1 = i.i1; +>i1 : number +>i.i1 : number +>i : I +>i1 : number + +var b = i.b; +>b : number +>i.b : number +>i : I +>b : number + +var i2 = i.i2; +>i2 : number +>i.i2 : number +>i : I +>i2 : number + diff --git a/tests/baselines/reference/multiModuleClodule1.types b/tests/baselines/reference/multiModuleClodule1.types new file mode 100644 index 00000000000..f7379e33173 --- /dev/null +++ b/tests/baselines/reference/multiModuleClodule1.types @@ -0,0 +1,53 @@ +=== tests/cases/compiler/multiModuleClodule1.ts === +class C { +>C : C + + constructor(x: number) { } +>x : number + + foo() { } +>foo : () => void + + bar() { } +>bar : () => void + + static boo() { } +>boo : () => void +} + +module C { +>C : typeof C + + export var x = 1; +>x : number + + var y = 2; +>y : number +} +module C { +>C : typeof C + + export function foo() { } +>foo : () => void + + function baz() { return ''; } +>baz : () => string +} + +var c = new C(C.x); +>c : C +>new C(C.x) : C +>C : typeof C +>C.x : number +>C : typeof C +>x : number + +c.foo = C.foo; +>c.foo = C.foo : () => void +>c.foo : () => void +>c : C +>foo : () => void +>C.foo : () => void +>C : typeof C +>foo : () => void + diff --git a/tests/baselines/reference/multiModuleFundule1.types b/tests/baselines/reference/multiModuleFundule1.types new file mode 100644 index 00000000000..c78a195f4b1 --- /dev/null +++ b/tests/baselines/reference/multiModuleFundule1.types @@ -0,0 +1,35 @@ +=== tests/cases/compiler/multiModuleFundule1.ts === +function C(x: number) { } +>C : typeof C +>x : number + +module C { +>C : typeof C + + export var x = 1; +>x : number +} +module C { +>C : typeof C + + export function foo() { } +>foo : () => void +} + +var r = C(2); +>r : void +>C(2) : void +>C : typeof C + +var r2 = new C(2); // using void returning function as constructor +>r2 : any +>new C(2) : any +>C : typeof C + +var r3 = C.foo(); +>r3 : void +>C.foo() : void +>C.foo : () => void +>C : typeof C +>foo : () => void + diff --git a/tests/baselines/reference/mutrec.types b/tests/baselines/reference/mutrec.types new file mode 100644 index 00000000000..6c147174484 --- /dev/null +++ b/tests/baselines/reference/mutrec.types @@ -0,0 +1,106 @@ +=== tests/cases/compiler/mutrec.ts === +interface A { +>A : A + + x:B[]; +>x : B[] +>B : B +} + +interface B { +>B : B + + x:A[]; +>x : A[] +>A : A +} + +function f(p: A) { return p }; +>f : (p: A) => A +>p : A +>A : A +>p : A + +var b:B; +>b : B +>B : B + +f(b); +>f(b) : A +>f : (p: A) => A +>b : B + +interface I1 { +>I1 : I1 + + y:I2; +>y : I2 +>I2 : I2 +} + +interface I2 { +>I2 : I2 + + y:I3; +>y : I3 +>I3 : I3 +} + +interface I3 { +>I3 : I3 + + y:I1; +>y : I1 +>I1 : I1 +} + +function g(p: I1) { return p }; +>g : (p: I1) => I1 +>p : I1 +>I1 : I1 +>p : I1 + +var i2:I2; +>i2 : I2 +>I2 : I2 + +g(i2); +>g(i2) : I1 +>g : (p: I1) => I1 +>i2 : I2 + +var i3:I3; +>i3 : I3 +>I3 : I3 + +g(i3); +>g(i3) : I1 +>g : (p: I1) => I1 +>i3 : I3 + +interface I4 { +>I4 : I4 + + y:I5; +>y : I5 +>I5 : I5 +} + +interface I5 { +>I5 : I5 + + y:I4; +>y : I4 +>I4 : I4 +} + +var i4:I4; +>i4 : I4 +>I4 : I4 + +g(i4); +>g(i4) : I1 +>g : (p: I1) => I1 +>i4 : I4 + + diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes1.types b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes1.types new file mode 100644 index 00000000000..24fc40448f2 --- /dev/null +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes1.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/mutuallyRecursiveGenericBaseTypes1.ts === +interface A { +>A : A +>T : T + + foo(): B; // instead of B does see this +>foo : { (): B; (): void; } +>B : B +>T : T + + foo(): void; // instead of B does see this +>foo : { (): B; (): void; } + + foo2(): B; +>foo2 : () => B +>B : B +} + +interface B extends A { +>B : B +>T : T +>A : A +>T : T + + bar(): void; +>bar : () => void +} + +var b: B; +>b : B +>B : B + +b.foo(); // should not error +>b.foo() : B +>b.foo : { (): B; (): void; } +>b : B +>foo : { (): B; (): void; } + + + diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.types b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.types new file mode 100644 index 00000000000..a619c91f6ab --- /dev/null +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/mutuallyRecursiveGenericBaseTypes2.ts === +class foo +>foo : foo +>T : T +{ + bar(): foo2 { return null; } +>bar : () => foo2 +>foo2 : foo2 +>T : T +} + +class foo2 extends foo { +>foo2 : foo2 +>T : T +>foo : foo +>T : T +} + +var test = new foo(); +>test : foo +>new foo() : foo +>foo : typeof foo + diff --git a/tests/baselines/reference/nameCollision.types b/tests/baselines/reference/nameCollision.types new file mode 100644 index 00000000000..02266304873 --- /dev/null +++ b/tests/baselines/reference/nameCollision.types @@ -0,0 +1,88 @@ +=== tests/cases/conformance/internalModules/codeGeneration/nameCollision.ts === +module A { +>A : typeof A + + // these 2 statements force an underscore before the 'A' + // in the generated function call. + var A = 12; +>A : number + + var _A = ''; +>_A : string +} + +module B { +>B : typeof B + + var A = 12; +>A : number +} + +module B { +>B : typeof B + + // re-opened module with colliding name + // this should add an underscore. + class B { +>B : B + + name: string; +>name : string + } +} + +module X { +>X : typeof X + + var X = 13; +>X : number + + export module Y { +>Y : typeof Y + + var Y = 13; +>Y : number + + export module Z { +>Z : typeof Z + + var X = 12; +>X : number + + var Y = 12; +>Y : number + + var Z = 12; +>Z : number + } + } +} + +module Y.Y { +>Y : typeof Y +>Y : typeof Y + + export enum Y { +>Y : Y + + Red, Blue +>Red : Y +>Blue : Y + } +} + +// no collision, since interface doesn't +// generate code. +module D { +>D : typeof D + + export interface D { +>D : D + + id: number; +>id : number + } + + export var E = 'hello'; +>E : string +} diff --git a/tests/baselines/reference/nameCollisionsInPropertyAssignments.types b/tests/baselines/reference/nameCollisionsInPropertyAssignments.types new file mode 100644 index 00000000000..1628b673621 --- /dev/null +++ b/tests/baselines/reference/nameCollisionsInPropertyAssignments.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/nameCollisionsInPropertyAssignments.ts === +var x = 1 +>x : number + +var y = { x() { x++; } }; +>y : { x: () => void; } +>{ x() { x++; } } : { x: () => void; } +>x : () => void +>x() { x++; } : () => void +>x++ : number +>x : number + diff --git a/tests/baselines/reference/nameDelimitedBySlashes.types b/tests/baselines/reference/nameDelimitedBySlashes.types new file mode 100644 index 00000000000..4e994d1cd4d --- /dev/null +++ b/tests/baselines/reference/nameDelimitedBySlashes.types @@ -0,0 +1,15 @@ +=== tests/cases/conformance/externalModules/foo_1.ts === +import foo = require('./test/foo_0'); +>foo : typeof "tests/cases/conformance/externalModules/test/foo_0" + +var x = foo.foo + 42; +>x : number +>foo.foo + 42 : number +>foo.foo : number +>foo : typeof "tests/cases/conformance/externalModules/test/foo_0" +>foo : number + +=== tests/cases/conformance/externalModules/test/foo_0.ts === +export var foo = 42; +>foo : number + diff --git a/tests/baselines/reference/nameWithRelativePaths.types b/tests/baselines/reference/nameWithRelativePaths.types new file mode 100644 index 00000000000..c20c4bc152d --- /dev/null +++ b/tests/baselines/reference/nameWithRelativePaths.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/externalModules/test/foo_3.ts === +import foo0 = require('../foo_0'); +>foo0 : typeof "tests/cases/conformance/externalModules/foo_0" + +import foo1 = require('./test/foo_1'); +>foo1 : typeof "tests/cases/conformance/externalModules/test/test/foo_1" + +import foo2 = require('./.././test/foo_2'); +>foo2 : typeof "tests/cases/conformance/externalModules/test/foo_2" + +if(foo2.M2.x){ +>foo2.M2.x : boolean +>foo2.M2 : typeof M2 +>foo2 : typeof "tests/cases/conformance/externalModules/test/foo_2" +>M2 : typeof M2 +>x : boolean + + var x = foo0.foo + foo1.f(); +>x : number +>foo0.foo + foo1.f() : number +>foo0.foo : number +>foo0 : typeof "tests/cases/conformance/externalModules/foo_0" +>foo : number +>foo1.f() : number +>foo1.f : () => number +>foo1 : typeof "tests/cases/conformance/externalModules/test/test/foo_1" +>f : () => number +} + +=== tests/cases/conformance/externalModules/foo_0.ts === +export var foo = 42; +>foo : number + +=== tests/cases/conformance/externalModules/test/test/foo_1.ts === +export function f(){ +>f : () => number + + return 42; +} + +=== tests/cases/conformance/externalModules/test/foo_2.ts === +export module M2 { +>M2 : typeof M2 + + export var x = true; +>x : boolean +} + diff --git a/tests/baselines/reference/namedFunctionExpressionAssignedToClassProperty.types b/tests/baselines/reference/namedFunctionExpressionAssignedToClassProperty.types new file mode 100644 index 00000000000..870734b0c6e --- /dev/null +++ b/tests/baselines/reference/namedFunctionExpressionAssignedToClassProperty.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/namedFunctionExpressionAssignedToClassProperty.ts === +class Foo{ +>Foo : Foo + + a = function bar(){ +>a : () => void +>function bar(){ + + } : () => void +>bar : () => void + + }; // this shouldn't crash the compiler... + + + + constructor(){ + + } + +} + diff --git a/tests/baselines/reference/namedFunctionExpressionCall.types b/tests/baselines/reference/namedFunctionExpressionCall.types new file mode 100644 index 00000000000..2f36c07f7d7 --- /dev/null +++ b/tests/baselines/reference/namedFunctionExpressionCall.types @@ -0,0 +1,39 @@ +=== tests/cases/compiler/namedFunctionExpressionCall.ts === +var recurser = function foo() { +>recurser : any +>function foo() { + // using the local name + foo(); + + // using the globally visible name + recurser(); +} : () => void +>foo : () => void + + // using the local name + foo(); +>foo() : void +>foo : () => void + + // using the globally visible name + recurser(); +>recurser() : any +>recurser : any + +}; + + +(function bar() { +>(function bar() { + bar(); +}) : () => void +>function bar() { + bar(); +} : () => void +>bar : () => void + + bar(); +>bar() : void +>bar : () => void + +}); diff --git a/tests/baselines/reference/namedFunctionExpressionInModule.types b/tests/baselines/reference/namedFunctionExpressionInModule.types new file mode 100644 index 00000000000..4898b2cbc1e --- /dev/null +++ b/tests/baselines/reference/namedFunctionExpressionInModule.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/namedFunctionExpressionInModule.ts === +module Variables{ +>Variables : typeof Variables + + var x = function bar(a, b, c) { +>x : (a: any, b: any, c: any) => void +>function bar(a, b, c) { + } : (a: any, b: any, c: any) => void +>bar : (a: any, b: any, c: any) => void +>a : any +>b : any +>c : any + } + x(1, 2, 3); +>x(1, 2, 3) : void +>x : (a: any, b: any, c: any) => void +} + diff --git a/tests/baselines/reference/namespaces1.types b/tests/baselines/reference/namespaces1.types new file mode 100644 index 00000000000..22c2887855a --- /dev/null +++ b/tests/baselines/reference/namespaces1.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/namespaces1.ts === +module X { +>X : X + + export module Y { +>Y : Y + + export interface Z { } +>Z : Z + } + export interface Y { } +>Y : Y +} + +var x: X.Y.Z; +>x : Z +>X : X +>Y : Y +>Z : Z + +var x2: X.Y; +>x2 : Y +>X : X +>Y : Y + diff --git a/tests/baselines/reference/namespaces2.types b/tests/baselines/reference/namespaces2.types new file mode 100644 index 00000000000..fb3c0375b7b --- /dev/null +++ b/tests/baselines/reference/namespaces2.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/namespaces2.ts === +module A { +>A : typeof A + + export module B { +>B : typeof B + + export class C { } +>C : C + } +} + +var c: A.B.C = new A.B.C(); +>c : C +>A : A +>B : B +>C : C +>new A.B.C() : C +>A.B.C : typeof C +>A.B : typeof B +>A : typeof A +>B : typeof B +>C : typeof C + diff --git a/tests/baselines/reference/negateOperatorWithAnyOtherType.types b/tests/baselines/reference/negateOperatorWithAnyOtherType.types new file mode 100644 index 00000000000..8785ab073b2 --- /dev/null +++ b/tests/baselines/reference/negateOperatorWithAnyOtherType.types @@ -0,0 +1,189 @@ +=== tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorWithAnyOtherType.ts === +// - operator on any type + +var ANY: any; +>ANY : any + +var ANY1; +>ANY1 : any + +var ANY2: any[] = ["", ""]; +>ANY2 : any[] +>["", ""] : any[] + +var obj: () => {} +>obj : () => {} + +var obj1 = { x: "", y: () => { }}; +>obj1 : { x: string; y: () => void; } +>{ x: "", y: () => { }} : { x: string; y: () => void; } +>x : string +>y : () => void +>() => { } : () => void + +function foo(): any { +>foo : () => any + + var a; +>a : any + + return a; +>a : any +} +class A { +>A : A + + public a: any; +>a : any + + static foo() { +>foo : () => any + + var a; +>a : any + + return a; +>a : any + } +} +module M { +>M : typeof M + + export var n: any; +>n : any +} +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// any type var +var ResultIsNumber1 = -ANY1; +>ResultIsNumber1 : number +>-ANY1 : number +>ANY1 : any + +var ResultIsNumber2 = -ANY2; +>ResultIsNumber2 : number +>-ANY2 : number +>ANY2 : any[] + +var ResultIsNumber3 = -A; +>ResultIsNumber3 : number +>-A : number +>A : typeof A + +var ResultIsNumber4 = -M; +>ResultIsNumber4 : number +>-M : number +>M : typeof M + +var ResultIsNumber5 = -obj; +>ResultIsNumber5 : number +>-obj : number +>obj : () => {} + +var ResultIsNumber6 = -obj1; +>ResultIsNumber6 : number +>-obj1 : number +>obj1 : { x: string; y: () => void; } + +// any type literal +var ResultIsNumber7 = -undefined; +>ResultIsNumber7 : number +>-undefined : number +>undefined : undefined + +var ResultIsNumber = -null; +>ResultIsNumber : number +>-null : number + +// any type expressions +var ResultIsNumber8 = -ANY2[0]; +>ResultIsNumber8 : number +>-ANY2[0] : number +>ANY2[0] : any +>ANY2 : any[] + +var ResultIsNumber9 = -obj1.x; +>ResultIsNumber9 : number +>-obj1.x : number +>obj1.x : string +>obj1 : { x: string; y: () => void; } +>x : string + +var ResultIsNumber10 = -obj1.y; +>ResultIsNumber10 : number +>-obj1.y : number +>obj1.y : () => void +>obj1 : { x: string; y: () => void; } +>y : () => void + +var ResultIsNumber11 = -objA.a; +>ResultIsNumber11 : number +>-objA.a : number +>objA.a : any +>objA : A +>a : any + +var ResultIsNumber12 = -M.n; +>ResultIsNumber12 : number +>-M.n : number +>M.n : any +>M : typeof M +>n : any + +var ResultIsNumber13 = -foo(); +>ResultIsNumber13 : number +>-foo() : number +>foo() : any +>foo : () => any + +var ResultIsNumber14 = -A.foo(); +>ResultIsNumber14 : number +>-A.foo() : number +>A.foo() : any +>A.foo : () => any +>A : typeof A +>foo : () => any + +var ResultIsNumber15 = -(ANY - ANY1); +>ResultIsNumber15 : number +>-(ANY - ANY1) : number +>(ANY - ANY1) : number +>ANY - ANY1 : number +>ANY : any +>ANY1 : any + +// miss assignment operators +-ANY; +>-ANY : number +>ANY : any + +-ANY1; +>-ANY1 : number +>ANY1 : any + +-ANY2[0]; +>-ANY2[0] : number +>ANY2[0] : any +>ANY2 : any[] + +-ANY, ANY1; +>-ANY, ANY1 : any +>-ANY : number +>ANY : any +>ANY1 : any + +-objA.a; +>-objA.a : number +>objA.a : any +>objA : A +>a : any + +-M.n; +>-M.n : number +>M.n : any +>M : typeof M +>n : any + diff --git a/tests/baselines/reference/negateOperatorWithBooleanType.types b/tests/baselines/reference/negateOperatorWithBooleanType.types new file mode 100644 index 00000000000..49467d87845 --- /dev/null +++ b/tests/baselines/reference/negateOperatorWithBooleanType.types @@ -0,0 +1,105 @@ +=== tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorWithBooleanType.ts === +// - operator on boolean type +var BOOLEAN: boolean; +>BOOLEAN : boolean + +function foo(): boolean { return true; } +>foo : () => boolean + +class A { +>A : A + + public a: boolean; +>a : boolean + + static foo() { return false; } +>foo : () => boolean +} +module M { +>M : typeof M + + export var n: boolean; +>n : boolean +} + +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// boolean type var +var ResultIsNumber1 = -BOOLEAN; +>ResultIsNumber1 : number +>-BOOLEAN : number +>BOOLEAN : boolean + +// boolean type literal +var ResultIsNumber2 = -true; +>ResultIsNumber2 : number +>-true : number + +var ResultIsNumber3 = -{ x: true, y: false }; +>ResultIsNumber3 : number +>-{ x: true, y: false } : number +>{ x: true, y: false } : { x: boolean; y: boolean; } +>x : boolean +>y : boolean + +// boolean type expressions +var ResultIsNumber4 = -objA.a; +>ResultIsNumber4 : number +>-objA.a : number +>objA.a : boolean +>objA : A +>a : boolean + +var ResultIsNumber5 = -M.n; +>ResultIsNumber5 : number +>-M.n : number +>M.n : boolean +>M : typeof M +>n : boolean + +var ResultIsNumber6 = -foo(); +>ResultIsNumber6 : number +>-foo() : number +>foo() : boolean +>foo : () => boolean + +var ResultIsNumber7 = -A.foo(); +>ResultIsNumber7 : number +>-A.foo() : number +>A.foo() : boolean +>A.foo : () => boolean +>A : typeof A +>foo : () => boolean + +// miss assignment operators +-true; +>-true : number + +-BOOLEAN; +>-BOOLEAN : number +>BOOLEAN : boolean + +-foo(); +>-foo() : number +>foo() : boolean +>foo : () => boolean + +-true, false; +>-true, false : boolean +>-true : number + +-objA.a; +>-objA.a : number +>objA.a : boolean +>objA : A +>a : boolean + +-M.n; +>-M.n : number +>M.n : boolean +>M : typeof M +>n : boolean + diff --git a/tests/baselines/reference/negateOperatorWithEnumType.types b/tests/baselines/reference/negateOperatorWithEnumType.types new file mode 100644 index 00000000000..b2e0cb91c51 --- /dev/null +++ b/tests/baselines/reference/negateOperatorWithEnumType.types @@ -0,0 +1,52 @@ +=== tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType.ts === +// - operator on enum type + +enum ENUM { }; +>ENUM : ENUM + +enum ENUM1 { 1, 2, "" }; +>ENUM1 : ENUM1 + +// enum type var +var ResultIsNumber1 = -ENUM; +>ResultIsNumber1 : number +>-ENUM : number +>ENUM : typeof ENUM + +// expressions +var ResultIsNumber2 = -ENUM1[1]; +>ResultIsNumber2 : number +>-ENUM1[1] : number +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 + +var ResultIsNumber3 = -(ENUM1[1] + ENUM1[2]); +>ResultIsNumber3 : number +>-(ENUM1[1] + ENUM1[2]) : number +>(ENUM1[1] + ENUM1[2]) : number +>ENUM1[1] + ENUM1[2] : number +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 +>ENUM1[2] : ENUM1 +>ENUM1 : typeof ENUM1 + +// miss assignment operators +-ENUM; +>-ENUM : number +>ENUM : typeof ENUM + +-ENUM1; +>-ENUM1 : number +>ENUM1 : typeof ENUM1 + +-ENUM1[1]; +>-ENUM1[1] : number +>ENUM1[1] : ENUM1 +>ENUM1 : typeof ENUM1 + +-ENUM, ENUM1; +>-ENUM, ENUM1 : typeof ENUM1 +>-ENUM : number +>ENUM : typeof ENUM +>ENUM1 : typeof ENUM1 + diff --git a/tests/baselines/reference/negateOperatorWithNumberType.types b/tests/baselines/reference/negateOperatorWithNumberType.types new file mode 100644 index 00000000000..f6cee89f6df --- /dev/null +++ b/tests/baselines/reference/negateOperatorWithNumberType.types @@ -0,0 +1,148 @@ +=== tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorWithNumberType.ts === +// - operator on number type +var NUMBER: number; +>NUMBER : number + +var NUMBER1: number[] = [1, 2]; +>NUMBER1 : number[] +>[1, 2] : number[] + +function foo(): number { return 1; } +>foo : () => number + +class A { +>A : A + + public a: number; +>a : number + + static foo() { return 1; } +>foo : () => number +} +module M { +>M : typeof M + + export var n: number; +>n : number +} + +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// number type var +var ResultIsNumber1 = -NUMBER; +>ResultIsNumber1 : number +>-NUMBER : number +>NUMBER : number + +var ResultIsNumber2 = -NUMBER1; +>ResultIsNumber2 : number +>-NUMBER1 : number +>NUMBER1 : number[] + +// number type literal +var ResultIsNumber3 = -1; +>ResultIsNumber3 : number +>-1 : number + +var ResultIsNumber4 = -{ x: 1, y: 2}; +>ResultIsNumber4 : number +>-{ x: 1, y: 2} : number +>{ x: 1, y: 2} : { x: number; y: number; } +>x : number +>y : number + +var ResultIsNumber5 = -{ x: 1, y: (n: number) => { return n; } }; +>ResultIsNumber5 : number +>-{ x: 1, y: (n: number) => { return n; } } : number +>{ x: 1, y: (n: number) => { return n; } } : { x: number; y: (n: number) => number; } +>x : number +>y : (n: number) => number +>(n: number) => { return n; } : (n: number) => number +>n : number +>n : number + +// number type expressions +var ResultIsNumber6 = -objA.a; +>ResultIsNumber6 : number +>-objA.a : number +>objA.a : number +>objA : A +>a : number + +var ResultIsNumber7 = -M.n; +>ResultIsNumber7 : number +>-M.n : number +>M.n : number +>M : typeof M +>n : number + +var ResultIsNumber8 = -NUMBER1[0]; +>ResultIsNumber8 : number +>-NUMBER1[0] : number +>NUMBER1[0] : number +>NUMBER1 : number[] + +var ResultIsNumber9 = -foo(); +>ResultIsNumber9 : number +>-foo() : number +>foo() : number +>foo : () => number + +var ResultIsNumber10 = -A.foo(); +>ResultIsNumber10 : number +>-A.foo() : number +>A.foo() : number +>A.foo : () => number +>A : typeof A +>foo : () => number + +var ResultIsNumber11 = -(NUMBER - NUMBER); +>ResultIsNumber11 : number +>-(NUMBER - NUMBER) : number +>(NUMBER - NUMBER) : number +>NUMBER - NUMBER : number +>NUMBER : number +>NUMBER : number + +// miss assignment operators +-1; +>-1 : number + +-NUMBER; +>-NUMBER : number +>NUMBER : number + +-NUMBER1; +>-NUMBER1 : number +>NUMBER1 : number[] + +-foo(); +>-foo() : number +>foo() : number +>foo : () => number + +-objA.a; +>-objA.a : number +>objA.a : number +>objA : A +>a : number + +-M.n; +>-M.n : number +>M.n : number +>M : typeof M +>n : number + +-objA.a, M.n; +>-objA.a, M.n : number +>-objA.a : number +>objA.a : number +>objA : A +>a : number +>M.n : number +>M : typeof M +>n : number + diff --git a/tests/baselines/reference/negateOperatorWithStringType.types b/tests/baselines/reference/negateOperatorWithStringType.types new file mode 100644 index 00000000000..43a9f05cc5b --- /dev/null +++ b/tests/baselines/reference/negateOperatorWithStringType.types @@ -0,0 +1,144 @@ +=== tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorWithStringType.ts === +// - operator on string type +var STRING: string; +>STRING : string + +var STRING1: string[] = ["", "abc"]; +>STRING1 : string[] +>["", "abc"] : string[] + +function foo(): string { return "abc"; } +>foo : () => string + +class A { +>A : A + + public a: string; +>a : string + + static foo() { return ""; } +>foo : () => string +} +module M { +>M : typeof M + + export var n: string; +>n : string +} + +var objA = new A(); +>objA : A +>new A() : A +>A : typeof A + +// string type var +var ResultIsNumber1 = -STRING; +>ResultIsNumber1 : number +>-STRING : number +>STRING : string + +var ResultIsNumber2 = -STRING1; +>ResultIsNumber2 : number +>-STRING1 : number +>STRING1 : string[] + +// string type literal +var ResultIsNumber3 = -""; +>ResultIsNumber3 : number +>-"" : number + +var ResultIsNumber4 = -{ x: "", y: "" }; +>ResultIsNumber4 : number +>-{ x: "", y: "" } : number +>{ x: "", y: "" } : { x: string; y: string; } +>x : string +>y : string + +var ResultIsNumber5 = -{ x: "", y: (s: string) => { return s; } }; +>ResultIsNumber5 : number +>-{ x: "", y: (s: string) => { return s; } } : number +>{ x: "", y: (s: string) => { return s; } } : { x: string; y: (s: string) => string; } +>x : string +>y : (s: string) => string +>(s: string) => { return s; } : (s: string) => string +>s : string +>s : string + +// string type expressions +var ResultIsNumber6 = -objA.a; +>ResultIsNumber6 : number +>-objA.a : number +>objA.a : string +>objA : A +>a : string + +var ResultIsNumber7 = -M.n; +>ResultIsNumber7 : number +>-M.n : number +>M.n : string +>M : typeof M +>n : string + +var ResultIsNumber8 = -STRING1[0]; +>ResultIsNumber8 : number +>-STRING1[0] : number +>STRING1[0] : string +>STRING1 : string[] + +var ResultIsNumber9 = -foo(); +>ResultIsNumber9 : number +>-foo() : number +>foo() : string +>foo : () => string + +var ResultIsNumber10 = -A.foo(); +>ResultIsNumber10 : number +>-A.foo() : number +>A.foo() : string +>A.foo : () => string +>A : typeof A +>foo : () => string + +var ResultIsNumber11 = -(STRING + STRING); +>ResultIsNumber11 : number +>-(STRING + STRING) : number +>(STRING + STRING) : string +>STRING + STRING : string +>STRING : string +>STRING : string + +var ResultIsNumber12 = -STRING.charAt(0); +>ResultIsNumber12 : number +>-STRING.charAt(0) : number +>STRING.charAt(0) : string +>STRING.charAt : (pos: number) => string +>STRING : string +>charAt : (pos: number) => string + +// miss assignment operators +-""; +>-"" : number + +-STRING; +>-STRING : number +>STRING : string + +-STRING1; +>-STRING1 : number +>STRING1 : string[] + +-foo(); +>-foo() : number +>foo() : string +>foo : () => string + +-objA.a,M.n; +>-objA.a,M.n : string +>-objA.a : number +>objA.a : string +>objA : A +>a : string +>M.n : string +>M : typeof M +>n : string + diff --git a/tests/baselines/reference/negativeZero.types b/tests/baselines/reference/negativeZero.types new file mode 100644 index 00000000000..97ba45a741a --- /dev/null +++ b/tests/baselines/reference/negativeZero.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/negativeZero.ts === +var x = -0 +>x : number +>-0 : number + diff --git a/tests/baselines/reference/nestedGenerics.types b/tests/baselines/reference/nestedGenerics.types new file mode 100644 index 00000000000..a7c58fc3c19 --- /dev/null +++ b/tests/baselines/reference/nestedGenerics.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/nestedGenerics.ts === +interface Foo { +>Foo : Foo +>T : T + + t: T; +>t : T +>T : T +} + +var f: Foo>; +>f : Foo> +>Foo : Foo +>Foo : Foo + diff --git a/tests/baselines/reference/nestedIfStatement.types b/tests/baselines/reference/nestedIfStatement.types new file mode 100644 index 00000000000..4dddcd75925 --- /dev/null +++ b/tests/baselines/reference/nestedIfStatement.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/nestedIfStatement.ts === +if (0) { +No type information for this code.} else if (1) { +No type information for this code.} else if (2) { +No type information for this code.} else if (3) { +No type information for this code.} else { +No type information for this code.} +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/nestedIndexer.types b/tests/baselines/reference/nestedIndexer.types new file mode 100644 index 00000000000..612f6a260b7 --- /dev/null +++ b/tests/baselines/reference/nestedIndexer.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/nestedIndexer.ts === +function then(x) { +>then : (x: any) => void +>x : any + +var match: { [index: number]: string; } +>match : { [x: number]: string; } +>index : number + +} + diff --git a/tests/baselines/reference/nestedInfinitelyExpandedRecursiveTypes.types b/tests/baselines/reference/nestedInfinitelyExpandedRecursiveTypes.types new file mode 100644 index 00000000000..5eab4d1eedb --- /dev/null +++ b/tests/baselines/reference/nestedInfinitelyExpandedRecursiveTypes.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/nestedInfinitelyExpandedRecursiveTypes.ts === +interface F { +>F : F +>T : T + + t: G T>>; +>t : G T>> +>G : G +>F : F +>T : T +} +interface G { +>G : G +>U : U + + t: G U>>; +>t : G U>> +>G : G +>G : G +>U : U +} + +var f: F; +>f : F +>F : F + +var g: G; +>g : G +>G : G + +f = g; +>f = g : G +>f : F +>g : G + +g = f; +>g = f : F +>g : G +>f : F + diff --git a/tests/baselines/reference/nestedModulePrivateAccess.types b/tests/baselines/reference/nestedModulePrivateAccess.types new file mode 100644 index 00000000000..7aae7449dcf --- /dev/null +++ b/tests/baselines/reference/nestedModulePrivateAccess.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/nestedModulePrivateAccess.ts === +module a{ +>a : typeof a + + var x:number; +>x : number + + module b{ +>b : typeof b + + var y = x; // should not be an error +>y : number +>x : number + } +} diff --git a/tests/baselines/reference/nestedModules.types b/tests/baselines/reference/nestedModules.types new file mode 100644 index 00000000000..36e9fc686b4 --- /dev/null +++ b/tests/baselines/reference/nestedModules.types @@ -0,0 +1,83 @@ +=== tests/cases/conformance/internalModules/moduleDeclarations/nestedModules.ts === +module A.B.C { +>A : typeof A +>B : typeof B +>C : C + + export interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } +} + +module A { +>A : typeof A + + export module B { +>B : typeof B + + var Point: C.Point = { x: 0, y: 0 }; // bug 832088: could not find module 'C' +>Point : Point +>C : C +>Point : Point +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number + } +} + +module M2.X { +>M2 : typeof M2 +>X : typeof X + + export interface Point { +>Point : Point + + x: number; y: number; +>x : number +>y : number + } +} + +module M2 { +>M2 : typeof M2 + + export module X { +>X : typeof X + + export var Point: number; +>Point : number + } +} + +var m = M2.X; +>m : typeof X +>M2.X : typeof X +>M2 : typeof M2 +>X : typeof X + +var point: number; +>point : number + +var point = m.Point; +>point : number +>m.Point : number +>m : typeof X +>Point : number + +var p: { x: number; y: number; } +>p : { x: number; y: number; } +>x : number +>y : number + +var p: M2.X.Point; +>p : { x: number; y: number; } +>M2 : M2 +>X : X +>Point : Point + diff --git a/tests/baselines/reference/nestedRecursiveLambda.types b/tests/baselines/reference/nestedRecursiveLambda.types new file mode 100644 index 00000000000..358ebda8abf --- /dev/null +++ b/tests/baselines/reference/nestedRecursiveLambda.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/nestedRecursiveLambda.ts === +function f(a:any) { +>f : (a: any) => void +>a : any + +void (r =>(r => r)); +>void (r =>(r => r)) : undefined +>(r =>(r => r)) : (r: any) => (r: any) => any +>r =>(r => r) : (r: any) => (r: any) => any +>r : any +>(r => r) : (r: any) => any +>r => r : (r: any) => any +>r : any +>r : any +} +f((r =>(r => r))); +>f((r =>(r => r))) : void +>f : (a: any) => void +>(r =>(r => r)) : (r: any) => (r: any) => any +>r =>(r => r) : (r: any) => (r: any) => any +>r : any +>(r => r) : (r: any) => any +>r => r : (r: any) => any +>r : any +>r : any + +void(r =>(r => r)); +>void(r =>(r => r)) : undefined +>(r =>(r => r)) : (r: any) => (r: any) => any +>r =>(r => r) : (r: any) => (r: any) => any +>r : any +>(r => r) : (r: any) => any +>r => r : (r: any) => any +>r : any +>r : any + +[(r =>(r => r))] +>[(r =>(r => r))] : { (r: any): (r: any) => any; }[] +>(r =>(r => r)) : (r: any) => (r: any) => any +>r =>(r => r) : (r: any) => (r: any) => any +>r : any +>(r => r) : (r: any) => any +>r => r : (r: any) => any +>r : any +>r : any + diff --git a/tests/baselines/reference/nestedSelf.types b/tests/baselines/reference/nestedSelf.types new file mode 100644 index 00000000000..56280bffb2f --- /dev/null +++ b/tests/baselines/reference/nestedSelf.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/nestedSelf.ts === +module M { +>M : typeof M + + export class C { +>C : C + + public n = 42; +>n : number + + public foo() { [1,2,3].map((x) => { return this.n * x; })} +>foo : () => void +>[1,2,3].map((x) => { return this.n * x; }) : number[] +>[1,2,3].map : (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[] +>[1,2,3] : number[] +>map : (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[] +>(x) => { return this.n * x; } : (x: number) => number +>x : number +>this.n * x : number +>this.n : number +>this : C +>n : number +>x : number + } +} + + diff --git a/tests/baselines/reference/newArrays.types b/tests/baselines/reference/newArrays.types new file mode 100644 index 00000000000..ab2d7165980 --- /dev/null +++ b/tests/baselines/reference/newArrays.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/newArrays.ts === +module M { +>M : typeof M + + class Foo {} +>Foo : Foo + + class Gar { +>Gar : Gar + + public fa: Foo[]; +>fa : Foo[] +>Foo : Foo + + public x = 10; +>x : number + + public y = 10; +>y : number + + public m () { +>m : () => void + + this.fa = new Array(this.x * this.y); +>this.fa = new Array(this.x * this.y) : Foo[] +>this.fa : Foo[] +>this : Gar +>fa : Foo[] +>new Array(this.x * this.y) : Foo[] +>Array : { (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; } +>Foo : Foo +>this.x * this.y : number +>this.x : number +>this : Gar +>x : number +>this.y : number +>this : Gar +>y : number + } + } +} diff --git a/tests/baselines/reference/newExpressionWithTypeParameterConstrainedToOuterTypeParameter.types b/tests/baselines/reference/newExpressionWithTypeParameterConstrainedToOuterTypeParameter.types new file mode 100644 index 00000000000..88e6f5c4572 --- /dev/null +++ b/tests/baselines/reference/newExpressionWithTypeParameterConstrainedToOuterTypeParameter.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/newExpressionWithTypeParameterConstrainedToOuterTypeParameter.ts === +interface I { +>I : I +>T : T + + new (u: U): U; +>U : U +>T : T +>u : U +>U : U +>U : U +} +var i: I; +>i : I +>I : I + +var y = new i(""); // y should be string +>y : string +>new i("") : string +>i : I + diff --git a/tests/baselines/reference/newOperatorConformance.types b/tests/baselines/reference/newOperatorConformance.types new file mode 100644 index 00000000000..f6cd80b1694 --- /dev/null +++ b/tests/baselines/reference/newOperatorConformance.types @@ -0,0 +1,149 @@ +=== tests/cases/conformance/expressions/newOperator/newOperatorConformance.ts === + +class C0 { +>C0 : C0 + +} +class C1 { +>C1 : C1 + + constructor(n: number, s: string) { } +>n : number +>s : string +} + +class T { +>T : T +>T : T + + constructor(n?: T) { } +>n : T +>T : T +} + +var anyCtor: { +>anyCtor : new () => any + + new (): any; +}; + +var anyCtor1: { +>anyCtor1 : new (n: any) => any + + new (n): any; +>n : any + +}; + +interface nestedCtor { +>nestedCtor : nestedCtor + + new (): nestedCtor; +>nestedCtor : nestedCtor +} +var nestedCtor: nestedCtor; +>nestedCtor : nestedCtor +>nestedCtor : nestedCtor + +// Construct expression with no parentheses for construct signature with 0 parameters +var a = new C0; +>a : C0 +>new C0 : C0 +>C0 : typeof C0 + +var a: C0; +>a : C0 +>C0 : C0 + + +// Generic construct expression with no parentheses +var c1 = new T; +>c1 : T<{}> +>new T : T<{}> +>T : typeof T + +var c1: T<{}>; +>c1 : T<{}> +>T : T + +// Construct expression where constructor is of type 'any' with no parentheses +var d = new anyCtor; +>d : any +>new anyCtor : any +>anyCtor : new () => any + +var d: any; +>d : any + +// Construct expression where constructor is of type 'any' with > 1 arg +var d = new anyCtor1(undefined); +>d : any +>new anyCtor1(undefined) : any +>anyCtor1 : new (n: any) => any +>undefined : undefined + +// Construct expression of type where apparent type has a construct signature with 0 arguments +function newFn1(s: T) { +>newFn1 : number>(s: T) => void +>T : T +>s : T +>T : T + + var p = new s; +>p : number +>new s : number +>s : T + + var p: number; +>p : number +} + +// Construct expression of type where apparent type has a construct signature with 1 arguments +function newFn2(s: T) { +>newFn2 : string>(s: T) => void +>T : T +>s : number +>s : T +>T : T + + var p = new s(32); +>p : string +>new s(32) : string +>s : T + + var p: string; +>p : string +} + +// Construct expression of void returning function +function fnVoid(): void { } +>fnVoid : () => void + +var t = new fnVoid(); +>t : any +>new fnVoid() : any +>fnVoid : () => void + +var t: any; +>t : any + +// Chained new expressions +var nested = new (new (new nestedCtor())())(); +>nested : nestedCtor +>new (new (new nestedCtor())())() : nestedCtor +>(new (new nestedCtor())()) : nestedCtor +>new (new nestedCtor())() : nestedCtor +>(new nestedCtor()) : nestedCtor +>new nestedCtor() : nestedCtor +>nestedCtor : nestedCtor + +var n = new nested(); +>n : nestedCtor +>new nested() : nestedCtor +>nested : nestedCtor + +var n = new nested(); +>n : nestedCtor +>new nested() : nestedCtor +>nested : nestedCtor + diff --git a/tests/baselines/reference/noCatchBlock.types b/tests/baselines/reference/noCatchBlock.types new file mode 100644 index 00000000000..cf7689660a3 --- /dev/null +++ b/tests/baselines/reference/noCatchBlock.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/noCatchBlock.ts === + +No type information for this code.try { +No type information for this code. // ... +No type information for this code.} finally { +No type information for this code. // N.B. No 'catch' block +No type information for this code.} +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/noCollisionThisExpressionAndClassInGlobal.types b/tests/baselines/reference/noCollisionThisExpressionAndClassInGlobal.types new file mode 100644 index 00000000000..44e7155854c --- /dev/null +++ b/tests/baselines/reference/noCollisionThisExpressionAndClassInGlobal.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/noCollisionThisExpressionAndClassInGlobal.ts === +class _this { +>_this : _this +} +var f = () => _this; +>f : () => typeof _this +>() => _this : () => typeof _this +>_this : typeof _this + diff --git a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInConstructor.types b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInConstructor.types new file mode 100644 index 00000000000..b41f5cd6074 --- /dev/null +++ b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInConstructor.types @@ -0,0 +1,71 @@ +=== tests/cases/compiler/noCollisionThisExpressionAndLocalVarInConstructor.ts === +class class1 { +>class1 : class1 + + constructor() { + var x2 = { +>x2 : { doStuff: (callback: any) => () => any; } +>{ + doStuff: (callback) => () => { + var _this = 2; + return callback(_this); + } + } : { doStuff: (callback: any) => () => any; } + + doStuff: (callback) => () => { +>doStuff : (callback: any) => () => any +>(callback) => () => { + var _this = 2; + return callback(_this); + } : (callback: any) => () => any +>callback : any +>() => { + var _this = 2; + return callback(_this); + } : () => any + + var _this = 2; +>_this : number + + return callback(_this); +>callback(_this) : any +>callback : any +>_this : number + } + } + } +} + +class class2 { +>class2 : class2 + + constructor() { + var _this = 2; +>_this : number + + var x2 = { +>x2 : { doStuff: (callback: any) => () => any; } +>{ + doStuff: (callback) => () => { + return callback(_this); + } + } : { doStuff: (callback: any) => () => any; } + + doStuff: (callback) => () => { +>doStuff : (callback: any) => () => any +>(callback) => () => { + return callback(_this); + } : (callback: any) => () => any +>callback : any +>() => { + return callback(_this); + } : () => any + + return callback(_this); +>callback(_this) : any +>callback : any +>_this : number + } + } + } +} diff --git a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.types b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.types new file mode 100644 index 00000000000..56f5701e912 --- /dev/null +++ b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/noCollisionThisExpressionAndLocalVarInFunction.ts === +var console: { +>console : { log(val: any): any; } + + log(val: any); +>log : (val: any) => any +>val : any +} +function x() { +>x : () => void + + var _this = 5; +>_this : number + + x => { console.log(_this); }; +>x => { console.log(_this); } : (x: any) => void +>x : any +>console.log(_this) : any +>console.log : (val: any) => any +>console : { log(val: any): any; } +>log : (val: any) => any +>_this : number +} diff --git a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInLambda.types b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInLambda.types new file mode 100644 index 00000000000..a8e7a622366 --- /dev/null +++ b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInLambda.types @@ -0,0 +1,48 @@ +=== tests/cases/compiler/noCollisionThisExpressionAndLocalVarInLambda.ts === +declare function alert(message?: any): void; +>alert : (message?: any) => void +>message : any + +var x = { +>x : { doStuff: (callback: any) => () => any; } +>{ + doStuff: (callback) => () => { + var _this = 2; + return callback(_this); + } +} : { doStuff: (callback: any) => () => any; } + + doStuff: (callback) => () => { +>doStuff : (callback: any) => () => any +>(callback) => () => { + var _this = 2; + return callback(_this); + } : (callback: any) => () => any +>callback : any +>() => { + var _this = 2; + return callback(_this); + } : () => any + + var _this = 2; +>_this : number + + return callback(_this); +>callback(_this) : any +>callback : any +>_this : number + } +} +alert(x.doStuff(x => alert(x))); +>alert(x.doStuff(x => alert(x))) : void +>alert : (message?: any) => void +>x.doStuff(x => alert(x)) : () => any +>x.doStuff : (callback: any) => () => any +>x : { doStuff: (callback: any) => () => any; } +>doStuff : (callback: any) => () => any +>x => alert(x) : (x: any) => void +>x : any +>alert(x) : void +>alert : (message?: any) => void +>x : any + diff --git a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInMethod.types b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInMethod.types new file mode 100644 index 00000000000..b08ce3e57c1 --- /dev/null +++ b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInMethod.types @@ -0,0 +1,71 @@ +=== tests/cases/compiler/noCollisionThisExpressionAndLocalVarInMethod.ts === +var _this = 2; +>_this : number + +class a { +>a : a + + method1() { +>method1 : () => { doStuff: (callback: any) => () => any; } + + return { +>{ + doStuff: (callback) => () => { + var _this = 2; + return callback(_this); + } + } : { doStuff: (callback: any) => () => any; } + + doStuff: (callback) => () => { +>doStuff : (callback: any) => () => any +>(callback) => () => { + var _this = 2; + return callback(_this); + } : (callback: any) => () => any +>callback : any +>() => { + var _this = 2; + return callback(_this); + } : () => any + + var _this = 2; +>_this : number + + return callback(_this); +>callback(_this) : any +>callback : any +>_this : number + } + } + } + method2() { +>method2 : () => { doStuff: (callback: any) => () => any; } + + var _this = 2; +>_this : number + + return { +>{ + doStuff: (callback) => () => { + return callback(_this); + } + } : { doStuff: (callback: any) => () => any; } + + doStuff: (callback) => () => { +>doStuff : (callback: any) => () => any +>(callback) => () => { + return callback(_this); + } : (callback: any) => () => any +>callback : any +>() => { + return callback(_this); + } : () => any + + return callback(_this); +>callback(_this) : any +>callback : any +>_this : number + } + } + } +} diff --git a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInProperty.types b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInProperty.types new file mode 100644 index 00000000000..3ab8c345887 --- /dev/null +++ b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInProperty.types @@ -0,0 +1,67 @@ +=== tests/cases/compiler/noCollisionThisExpressionAndLocalVarInProperty.ts === +class class1 { +>class1 : class1 + + public prop1 = { +>prop1 : { doStuff: (callback: any) => () => any; } +>{ + doStuff: (callback) => () => { + var _this = 2; + return callback(_this); + } + } : { doStuff: (callback: any) => () => any; } + + doStuff: (callback) => () => { +>doStuff : (callback: any) => () => any +>(callback) => () => { + var _this = 2; + return callback(_this); + } : (callback: any) => () => any +>callback : any +>() => { + var _this = 2; + return callback(_this); + } : () => any + + var _this = 2; +>_this : number + + return callback(_this); +>callback(_this) : any +>callback : any +>_this : number + } + } +} + +class class2 { +>class2 : class2 + + constructor() { + var _this = 2; +>_this : number + } + public prop1 = { +>prop1 : { doStuff: (callback: any) => () => any; } +>{ + doStuff: (callback) => () => { + return callback(10); + } + } : { doStuff: (callback: any) => () => any; } + + doStuff: (callback) => () => { +>doStuff : (callback: any) => () => any +>(callback) => () => { + return callback(10); + } : (callback: any) => () => any +>callback : any +>() => { + return callback(10); + } : () => any + + return callback(10); +>callback(10) : any +>callback : any + } + } +} diff --git a/tests/baselines/reference/noCollisionThisExpressionAndVarInGlobal.types b/tests/baselines/reference/noCollisionThisExpressionAndVarInGlobal.types new file mode 100644 index 00000000000..138062d58e5 --- /dev/null +++ b/tests/baselines/reference/noCollisionThisExpressionAndVarInGlobal.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/noCollisionThisExpressionAndVarInGlobal.ts === +var _this = 1; +>_this : number + +var f = () => _this; +>f : () => number +>() => _this : () => number +>_this : number + diff --git a/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.types b/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.types new file mode 100644 index 00000000000..35a62c6f671 --- /dev/null +++ b/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/noCollisionThisExpressionInFunctionAndVarInGlobal.ts === +var console: { +>console : { log(val: any): any; } + + log(val: any); +>log : (val: any) => any +>val : any +} +var _this = 5; +>_this : number + +function x() { +>x : () => void + + x => { console.log(this); }; +>x => { console.log(this); } : (x: any) => void +>x : any +>console.log(this) : any +>console.log : (val: any) => any +>console : { log(val: any): any; } +>log : (val: any) => any +>this : any +} diff --git a/tests/baselines/reference/noConstraintInReturnType1.types b/tests/baselines/reference/noConstraintInReturnType1.types new file mode 100644 index 00000000000..af290ccfabf --- /dev/null +++ b/tests/baselines/reference/noConstraintInReturnType1.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/noConstraintInReturnType1.ts === +class List { +>List : List +>T : T + + static empty(): List { return null; } +>empty : () => List +>T : T +>List : List +>T : T +} + diff --git a/tests/baselines/reference/noImplicitAnyAndPrivateMembersWithoutTypeAnnotations.types b/tests/baselines/reference/noImplicitAnyAndPrivateMembersWithoutTypeAnnotations.types new file mode 100644 index 00000000000..071d8a1aa88 --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyAndPrivateMembersWithoutTypeAnnotations.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/app.ts === +/// +var x = new Something(); +>x : Something +>new Something() : Something +>Something : typeof Something + +=== tests/cases/compiler/test.d.ts === +declare class Something +>Something : Something +{ + private static someStaticVar; +>someStaticVar : any + + private someVar; +>someVar : any +} + diff --git a/tests/baselines/reference/noImplicitAnyInContextuallyTypesFunctionParamter.types b/tests/baselines/reference/noImplicitAnyInContextuallyTypesFunctionParamter.types new file mode 100644 index 00000000000..9ac1bcbbe8d --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyInContextuallyTypesFunctionParamter.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/noImplicitAnyInContextuallyTypesFunctionParamter.ts === + +var regexMatchList = ['', '']; +>regexMatchList : string[] +>['', ''] : string[] + +regexMatchList.forEach(match => ''.replace(match, '')); +>regexMatchList.forEach(match => ''.replace(match, '')) : void +>regexMatchList.forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void +>regexMatchList : string[] +>forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void +>match => ''.replace(match, '') : (match: string) => string +>match : string +>''.replace(match, '') : string +>''.replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; } +>replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; } +>match : string + diff --git a/tests/baselines/reference/noSelfOnVars.types b/tests/baselines/reference/noSelfOnVars.types new file mode 100644 index 00000000000..8a059d8bc60 --- /dev/null +++ b/tests/baselines/reference/noSelfOnVars.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/noSelfOnVars.ts === +function foo() { +>foo : () => void + + function bar() { } +>bar : () => void + + var x = bar; +>x : () => void +>bar : () => void +} + + + diff --git a/tests/baselines/reference/nominalSubtypeCheckOfTypeParameter.types b/tests/baselines/reference/nominalSubtypeCheckOfTypeParameter.types new file mode 100644 index 00000000000..e0779ce91aa --- /dev/null +++ b/tests/baselines/reference/nominalSubtypeCheckOfTypeParameter.types @@ -0,0 +1,61 @@ +=== tests/cases/conformance/types/typeRelationships/recursiveTypes/nominalSubtypeCheckOfTypeParameter.ts === +interface Tuple { +>Tuple : Tuple +>T : T +>S : S + + first: T +>first : T +>T : T + + second: S +>second : S +>S : S +} + +interface Sequence { +>Sequence : Sequence +>T : T + + hasNext(): boolean +>hasNext : () => boolean + + pop(): T +>pop : () => T +>T : T + + zip(seq: Sequence): Sequence> +>zip : (seq: Sequence) => Sequence> +>S : S +>seq : Sequence +>Sequence : Sequence +>S : S +>Sequence : Sequence +>Tuple : Tuple +>T : T +>S : S +} + +// error, despite the fact that the code explicitly says List extends Sequence, the current rules for infinitely expanding type references +// perform nominal subtyping checks that allow variance for type arguments, but not nominal subtyping for the generic type itself +interface List extends Sequence { +>List : List +>T : T +>Sequence : Sequence +>T : T + + getLength(): number +>getLength : () => number + + zip(seq: Sequence): List> +>zip : (seq: Sequence) => List> +>S : S +>seq : Sequence +>Sequence : Sequence +>S : S +>List : List +>Tuple : Tuple +>T : T +>S : S +} + diff --git a/tests/baselines/reference/nominalSubtypeCheckOfTypeParameter2.types b/tests/baselines/reference/nominalSubtypeCheckOfTypeParameter2.types new file mode 100644 index 00000000000..213bf673e66 --- /dev/null +++ b/tests/baselines/reference/nominalSubtypeCheckOfTypeParameter2.types @@ -0,0 +1,55 @@ +=== tests/cases/conformance/types/typeRelationships/recursiveTypes/nominalSubtypeCheckOfTypeParameter2.ts === +interface B { +>B : B +>T : T + + bar: T; +>bar : T +>T : T +} + +// ok +interface A extends B { +>A : A +>T : T +>B : B +>T : T + + foo: T; +>foo : T +>T : T +} + +// ok +interface A2 extends B> { +>A2 : A2 +>T : T +>B : B +>B : B + + baz: T; +>baz : T +>T : T +} + +interface C { +>C : C +>T : T + + bam: T; +>bam : T +>T : T +} + +// ok +interface A3 extends B> { +>A3 : A3 +>T : T +>B : B +>C : C +>T : T + + bing: T; +>bing : T +>T : T +} diff --git a/tests/baselines/reference/nonConflictingRecursiveBaseTypeMembers.types b/tests/baselines/reference/nonConflictingRecursiveBaseTypeMembers.types new file mode 100644 index 00000000000..dd73f02036b --- /dev/null +++ b/tests/baselines/reference/nonConflictingRecursiveBaseTypeMembers.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/nonConflictingRecursiveBaseTypeMembers.ts === +interface A { +>A : A +>T : T + + x: C +>x : C +>C : C +>T : T +} + +interface B { +>B : B +>T : T + + x: C +>x : C +>C : C +>T : T +} + +interface C extends A, B { } // Should not be an error +>C : C +>T : T +>A : A +>T : T +>B : B +>T : T + diff --git a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.types b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.types new file mode 100644 index 00000000000..12c1418ad2a --- /dev/null +++ b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/nonGenericClassExtendingGenericClassWithAny.ts === +class Foo { +>Foo : Foo +>T : T + + t: T; +>t : T +>T : T +} + +class Bar extends Foo { } // Valid +>Bar : Bar +>Foo : Foo + diff --git a/tests/baselines/reference/nonInstantiatedModule.types b/tests/baselines/reference/nonInstantiatedModule.types new file mode 100644 index 00000000000..64ca01d029d --- /dev/null +++ b/tests/baselines/reference/nonInstantiatedModule.types @@ -0,0 +1,111 @@ +=== tests/cases/conformance/internalModules/moduleDeclarations/nonInstantiatedModule.ts === +module M { +>M : typeof M + + export interface Point { x: number; y: number } +>Point : Point +>x : number +>y : number + + export var a = 1; +>a : number +} + +// primary expression +var m : typeof M; +>m : typeof M +>M : typeof M + +var m = M; +>m : typeof M +>M : typeof M + +var a1: number; +>a1 : number + +var a1 = M.a; +>a1 : number +>M.a : number +>M : typeof M +>a : number + +var a2: number; +>a2 : number + +var a2 = m.a; +>a2 : number +>m.a : number +>m : typeof M +>a : number + +module M2 { +>M2 : typeof M2 + + export module Point { +>Point : typeof Point + + export function Origin(): Point { +>Origin : () => Point +>Point : Point + + return { x: 0, y: 0 }; +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>y : number + } + } + + export interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number + } +} + +var p: { x: number; y: number; }; +>p : { x: number; y: number; } +>x : number +>y : number + +var p: M2.Point; +>p : { x: number; y: number; } +>M2 : M2 +>Point : Point + +var p2: { Origin() : { x: number; y: number; } }; +>p2 : { Origin(): { x: number; y: number; }; } +>Origin : () => { x: number; y: number; } +>x : number +>y : number + +var p2: typeof M2.Point; +>p2 : { Origin(): { x: number; y: number; }; } +>M2 : typeof M2 +>Point : typeof Point + +module M3 { +>M3 : typeof M3 + + export module Utils { +>Utils : typeof Utils + + export interface Point { +>Point : Point + + x: number; y: number; +>x : number +>y : number + } + } + + export class Utils { +>Utils : Utils + + name: string; +>name : string + } +} diff --git a/tests/baselines/reference/null.types b/tests/baselines/reference/null.types new file mode 100644 index 00000000000..0614b5efec4 --- /dev/null +++ b/tests/baselines/reference/null.types @@ -0,0 +1,48 @@ +=== tests/cases/compiler/null.ts === +var x=null; +>x : any + +var y=3+x; +>y : any +>3+x : any +>x : any + +var z=3+null; +>z : number +>3+null : number + +class C { +>C : C +} +function f() { +>f : () => C + + return null; + return new C(); +>new C() : C +>C : typeof C +} +function g() { +>g : () => number + + return null; + return 3; +} +interface I { +>I : I + + x:any; +>x : any + + y:number; +>y : number +} +var w:I={x:null,y:3}; +>w : I +>I : I +>{x:null,y:3} : { x: null; y: number; } +>x : any +>y : number + + + diff --git a/tests/baselines/reference/nullAssignableToEveryType.types b/tests/baselines/reference/nullAssignableToEveryType.types new file mode 100644 index 00000000000..aaf3b3bd8c5 --- /dev/null +++ b/tests/baselines/reference/nullAssignableToEveryType.types @@ -0,0 +1,131 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType.ts === +class C { +>C : C + + foo: string; +>foo : string +} +var ac: C; +>ac : C +>C : C + +interface I { +>I : I + + foo: string; +>foo : string +} +var ai: I; +>ai : I +>I : I + +enum E { A } +>E : E +>A : E + +var ae: E; +>ae : E +>E : E + +var b: number = null; +>b : number + +var c: string = null; +>c : string + +var d: boolean = null; +>d : boolean + +var e: Date = null; +>e : Date +>Date : Date + +var f: any = null; +>f : any + +var g: void = null; +>g : void + +var h: Object = null; +>h : Object +>Object : Object + +var i: {} = null; +>i : {} + +var j: () => {} = null; +>j : () => {} + +var k: Function = null; +>k : Function +>Function : Function + +var l: (x: number) => string = null; +>l : (x: number) => string +>x : number + +ac = null; +>ac = null : null +>ac : C + +ai = null; +>ai = null : null +>ai : I + +ae = null; +>ae = null : null +>ae : E + +var m: number[] = null; +>m : number[] + +var n: { foo: string } = null; +>n : { foo: string; } +>foo : string + +var o: (x: T) => T = null; +>o : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +var p: Number = null; +>p : Number +>Number : Number + +var q: String = null; +>q : String +>String : String + +function foo(x: T, y: U, z: V) { +>foo : (x: T, y: U, z: V) => void +>T : T +>U : U +>V : V +>Date : Date +>x : T +>T : T +>y : U +>U : U +>z : V +>V : V + + x = null; +>x = null : null +>x : T + + y = null; +>y = null : null +>y : U + + z = null; +>z = null : null +>z : V +} + +//function foo(x: T, y: U, z: V) { +// x = null; +// y = null; +// z = null; +//} diff --git a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.types b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.types new file mode 100644 index 00000000000..ed47a8a4ba6 --- /dev/null +++ b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.types @@ -0,0 +1,303 @@ +=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined.ts === +// null is a subtype of any other types except undefined + +var r0 = true ? null : null; +>r0 : any +>true ? null : null : null + +var r0 = true ? null : null; +>r0 : any +>true ? null : null : null + +var u: typeof undefined; +>u : any +>undefined : undefined + +var r0b = true ? u : null; +>r0b : any +>true ? u : null : any +>u : any + +var r0b = true ? null : u; +>r0b : any +>true ? null : u : any +>u : any + +var r1 = true ? 1 : null; +>r1 : number +>true ? 1 : null : number + +var r1 = true ? null : 1; +>r1 : number +>true ? null : 1 : number + +var r2 = true ? '' : null; +>r2 : string +>true ? '' : null : string + +var r2 = true ? null : ''; +>r2 : string +>true ? null : '' : string + +var r3 = true ? true : null; +>r3 : boolean +>true ? true : null : boolean + +var r3 = true ? null : true; +>r3 : boolean +>true ? null : true : boolean + +var r4 = true ? new Date() : null; +>r4 : Date +>true ? new Date() : null : Date +>new Date() : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } + +var r4 = true ? null : new Date(); +>r4 : Date +>true ? null : new Date() : Date +>new Date() : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } + +var r5 = true ? /1/ : null; +>r5 : RegExp +>true ? /1/ : null : RegExp +>/1/ : RegExp + +var r5 = true ? null : /1/; +>r5 : RegExp +>true ? null : /1/ : RegExp +>/1/ : RegExp + +var r6 = true ? { foo: 1 } : null; +>r6 : { foo: number; } +>true ? { foo: 1 } : null : { foo: number; } +>{ foo: 1 } : { foo: number; } +>foo : number + +var r6 = true ? null : { foo: 1 }; +>r6 : { foo: number; } +>true ? null : { foo: 1 } : { foo: number; } +>{ foo: 1 } : { foo: number; } +>foo : number + +var r7 = true ? () => { } : null; +>r7 : () => void +>true ? () => { } : null : () => void +>() => { } : () => void + +var r7 = true ? null : () => { }; +>r7 : () => void +>true ? null : () => { } : () => void +>() => { } : () => void + +var r8 = true ? (x: T) => { return x } : null; +>r8 : (x: T) => T +>true ? (x: T) => { return x } : null : (x: T) => T +>(x: T) => { return x } : (x: T) => T +>T : T +>x : T +>T : T +>x : T + +var r8b = true ? null : (x: T) => { return x }; // type parameters not identical across declarations +>r8b : (x: T) => T +>true ? null : (x: T) => { return x } : (x: T) => T +>(x: T) => { return x } : (x: T) => T +>T : T +>x : T +>T : T +>x : T + +interface I1 { foo: number; } +>I1 : I1 +>foo : number + +var i1: I1; +>i1 : I1 +>I1 : I1 + +var r9 = true ? i1 : null; +>r9 : I1 +>true ? i1 : null : I1 +>i1 : I1 + +var r9 = true ? null : i1; +>r9 : I1 +>true ? null : i1 : I1 +>i1 : I1 + +class C1 { foo: number; } +>C1 : C1 +>foo : number + +var c1: C1; +>c1 : C1 +>C1 : C1 + +var r10 = true ? c1 : null; +>r10 : C1 +>true ? c1 : null : C1 +>c1 : C1 + +var r10 = true ? null : c1; +>r10 : C1 +>true ? null : c1 : C1 +>c1 : C1 + +class C2 { foo: T; } +>C2 : C2 +>T : T +>foo : T +>T : T + +var c2: C2; +>c2 : C2 +>C2 : C2 + +var r12 = true ? c2 : null; +>r12 : C2 +>true ? c2 : null : C2 +>c2 : C2 + +var r12 = true ? null : c2; +>r12 : C2 +>true ? null : c2 : C2 +>c2 : C2 + +enum E { A } +>E : E +>A : E + +var r13 = true ? E : null; +>r13 : typeof E +>true ? E : null : typeof E +>E : typeof E + +var r13 = true ? null : E; +>r13 : typeof E +>true ? null : E : typeof E +>E : typeof E + +var r14 = true ? E.A : null; +>r14 : E +>true ? E.A : null : E +>E.A : E +>E : typeof E +>A : E + +var r14 = true ? null : E.A; +>r14 : E +>true ? null : E.A : E +>E.A : E +>E : typeof E +>A : E + +function f() { } +>f : typeof f + +module f { +>f : typeof f + + export var bar = 1; +>bar : number +} +var af: typeof f; +>af : typeof f +>f : typeof f + +var r15 = true ? af : null; +>r15 : typeof f +>true ? af : null : typeof f +>af : typeof f + +var r15 = true ? null : af; +>r15 : typeof f +>true ? null : af : typeof f +>af : typeof f + +class c { baz: string } +>c : c +>baz : string + +module c { +>c : typeof c + + export var bar = 1; +>bar : number +} +var ac: typeof c; +>ac : typeof c +>c : typeof c + +var r16 = true ? ac : null; +>r16 : typeof c +>true ? ac : null : typeof c +>ac : typeof c + +var r16 = true ? null : ac; +>r16 : typeof c +>true ? null : ac : typeof c +>ac : typeof c + +function f17(x: T) { +>f17 : (x: T) => void +>T : T +>x : T +>T : T + + var r17 = true ? x : null; +>r17 : T +>true ? x : null : T +>x : T + + var r17 = true ? null : x; +>r17 : T +>true ? null : x : T +>x : T +} + +function f18(x: U) { +>f18 : (x: U) => void +>T : T +>U : U +>x : U +>U : U + + var r18 = true ? x : null; +>r18 : U +>true ? x : null : U +>x : U + + var r18 = true ? null : x; +>r18 : U +>true ? null : x : U +>x : U +} +//function f18(x: U) { +// var r18 = true ? x : null; +// var r18 = true ? null : x; +//} + +var r19 = true ? new Object() : null; +>r19 : Object +>true ? new Object() : null : Object +>new Object() : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } + +var r19 = true ? null : new Object(); +>r19 : Object +>true ? null : new Object() : Object +>new Object() : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } + +var r20 = true ? {} : null; +>r20 : {} +>true ? {} : null : {} +>{} : {} + +var r20 = true ? null : {}; +>r20 : {} +>true ? null : {} : {} +>{} : {} + diff --git a/tests/baselines/reference/numberAsInLHS.types b/tests/baselines/reference/numberAsInLHS.types new file mode 100644 index 00000000000..823e3e0354d --- /dev/null +++ b/tests/baselines/reference/numberAsInLHS.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/numberAsInLHS.ts === +3 in [0, 1] +>3 in [0, 1] : boolean +>[0, 1] : number[] + diff --git a/tests/baselines/reference/numberAssignableToEnum.types b/tests/baselines/reference/numberAssignableToEnum.types new file mode 100644 index 00000000000..b7b75b5dc5c --- /dev/null +++ b/tests/baselines/reference/numberAssignableToEnum.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum.ts === +enum E { A } +>E : E +>A : E + +var n: number; +>n : number + +var e: E; +>e : E +>E : E + +e = n; +>e = n : number +>e : E +>n : number + +n = e; +>n = e : E +>n : number +>e : E + diff --git a/tests/baselines/reference/numberOnLeftSideOfInExpression.types b/tests/baselines/reference/numberOnLeftSideOfInExpression.types new file mode 100644 index 00000000000..0b15c0aefee --- /dev/null +++ b/tests/baselines/reference/numberOnLeftSideOfInExpression.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/numberOnLeftSideOfInExpression.ts === +var left: number; +>left : number + +var right: any; +>right : any + +left in right; +>left in right : boolean +>left : number +>right : any + diff --git a/tests/baselines/reference/numberPropertyAccess.types b/tests/baselines/reference/numberPropertyAccess.types new file mode 100644 index 00000000000..fd554e95ace --- /dev/null +++ b/tests/baselines/reference/numberPropertyAccess.types @@ -0,0 +1,30 @@ +=== tests/cases/conformance/types/primitives/number/numberPropertyAccess.ts === +var x = 1; +>x : number + +var a = x.toExponential(); +>a : string +>x.toExponential() : string +>x.toExponential : (fractionDigits?: number) => string +>x : number +>toExponential : (fractionDigits?: number) => string + +var b = x.hasOwnProperty('toFixed'); +>b : boolean +>x.hasOwnProperty('toFixed') : boolean +>x.hasOwnProperty : (v: string) => boolean +>x : number +>hasOwnProperty : (v: string) => boolean + +var c = x['toExponential'](); +>c : string +>x['toExponential']() : string +>x['toExponential'] : (fractionDigits?: number) => string +>x : number + +var d = x['hasOwnProperty']('toFixed'); +>d : boolean +>x['hasOwnProperty']('toFixed') : boolean +>x['hasOwnProperty'] : (v: string) => boolean +>x : number + diff --git a/tests/baselines/reference/numericIndexerConstraint3.types b/tests/baselines/reference/numericIndexerConstraint3.types new file mode 100644 index 00000000000..2e249c89b8c --- /dev/null +++ b/tests/baselines/reference/numericIndexerConstraint3.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/numericIndexerConstraint3.ts === +class A { +>A : A + + foo: number; +>foo : number +} + +class B extends A { +>B : B +>A : A + + bar: string; +>bar : string +} + +class C { +>C : C + + 0: B; +>B : B + + [x: number]: A; +>x : number +>A : A +} diff --git a/tests/baselines/reference/numericIndexerConstraint4.types b/tests/baselines/reference/numericIndexerConstraint4.types new file mode 100644 index 00000000000..f0004e52b45 --- /dev/null +++ b/tests/baselines/reference/numericIndexerConstraint4.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/numericIndexerConstraint4.ts === +class A { +>A : A + + foo: number; +>foo : number +} + +class B extends A { +>B : B +>A : A + + bar: string; +>bar : string +} + +var x: { +>x : { [x: number]: A; } + + [idx: number]: A; +>idx : number +>A : A + +} = { data: new B() } +>{ data: new B() } : { [x: number]: A; data: B; } +>data : B +>new B() : B +>B : typeof B + diff --git a/tests/baselines/reference/numericIndexingResults.types b/tests/baselines/reference/numericIndexingResults.types new file mode 100644 index 00000000000..e68a083bb74 --- /dev/null +++ b/tests/baselines/reference/numericIndexingResults.types @@ -0,0 +1,199 @@ +=== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexingResults.ts === +class C { +>C : C + + [x: number]: string; +>x : number + + 1 = ''; + "2" = '' +} + +var c: C; +>c : C +>C : C + +var r1 = c['1']; +>r1 : string +>c['1'] : string +>c : C + +var r2 = c['2']; +>r2 : string +>c['2'] : string +>c : C + +var r3 = c['3']; +>r3 : any +>c['3'] : any +>c : C + +var r4 = c[1]; +>r4 : string +>c[1] : string +>c : C + +var r5 = c[2]; +>r5 : string +>c[2] : string +>c : C + +var r6 = c[3]; +>r6 : string +>c[3] : string +>c : C + +interface I { +>I : I + + [x: number]: string; +>x : number + + 1: string; + "2": string; +} + +var i: I +>i : I +>I : I + +var r1 = i['1']; +>r1 : string +>i['1'] : string +>i : I + +var r2 = i['2']; +>r2 : string +>i['2'] : string +>i : I + +var r3 = i['3']; +>r3 : any +>i['3'] : any +>i : I + +var r4 = i[1]; +>r4 : string +>i[1] : string +>i : I + +var r5 = i[2]; +>r5 : string +>i[2] : string +>i : I + +var r6 = i[3]; +>r6 : string +>i[3] : string +>i : I + +var a: { +>a : { [x: number]: string; 1: string; "2": string; } + + [x: number]: string; +>x : number + + 1: string; + "2": string; +} + +var r1 = a['1']; +>r1 : string +>a['1'] : string +>a : { [x: number]: string; 1: string; "2": string; } + +var r2 = a['2']; +>r2 : string +>a['2'] : string +>a : { [x: number]: string; 1: string; "2": string; } + +var r3 = a['3']; +>r3 : any +>a['3'] : any +>a : { [x: number]: string; 1: string; "2": string; } + +var r4 = a[1]; +>r4 : string +>a[1] : string +>a : { [x: number]: string; 1: string; "2": string; } + +var r5 = a[2]; +>r5 : string +>a[2] : string +>a : { [x: number]: string; 1: string; "2": string; } + +var r6 = a[3]; +>r6 : string +>a[3] : string +>a : { [x: number]: string; 1: string; "2": string; } + +var b: { [x: number]: string } = { 1: '', "2": '' } +>b : { [x: number]: string; } +>x : number +>{ 1: '', "2": '' } : { [x: number]: string; 1: string; "2": string; } + +var r1a = b['1']; +>r1a : any +>b['1'] : any +>b : { [x: number]: string; } + +var r2a = b['2']; +>r2a : any +>b['2'] : any +>b : { [x: number]: string; } + +var r3 = b['3']; +>r3 : any +>b['3'] : any +>b : { [x: number]: string; } + +var r4 = b[1]; +>r4 : string +>b[1] : string +>b : { [x: number]: string; } + +var r5 = b[2]; +>r5 : string +>b[2] : string +>b : { [x: number]: string; } + +var r6 = b[3]; +>r6 : string +>b[3] : string +>b : { [x: number]: string; } + +var b2: { [x: number]: string; 1: string; "2": string; } = { 1: '', "2": '' } +>b2 : { [x: number]: string; 1: string; "2": string; } +>x : number +>{ 1: '', "2": '' } : { [x: number]: string; 1: string; "2": string; } + +var r1b = b2['1']; +>r1b : string +>b2['1'] : string +>b2 : { [x: number]: string; 1: string; "2": string; } + +var r2b = b2['2']; +>r2b : string +>b2['2'] : string +>b2 : { [x: number]: string; 1: string; "2": string; } + +var r3 = b2['3']; +>r3 : any +>b2['3'] : any +>b2 : { [x: number]: string; 1: string; "2": string; } + +var r4 = b2[1]; +>r4 : string +>b2[1] : string +>b2 : { [x: number]: string; 1: string; "2": string; } + +var r5 = b2[2]; +>r5 : string +>b2[2] : string +>b2 : { [x: number]: string; 1: string; "2": string; } + +var r6 = b2[3]; +>r6 : string +>b2[3] : string +>b2 : { [x: number]: string; 1: string; "2": string; } + diff --git a/tests/baselines/reference/numericMethodName1.types b/tests/baselines/reference/numericMethodName1.types new file mode 100644 index 00000000000..09d63f04e13 --- /dev/null +++ b/tests/baselines/reference/numericMethodName1.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/numericMethodName1.ts === +class C { +>C : C + + 1 = 2; +} + diff --git a/tests/baselines/reference/objectIndexer.types b/tests/baselines/reference/objectIndexer.types new file mode 100644 index 00000000000..a2a7f99cf5d --- /dev/null +++ b/tests/baselines/reference/objectIndexer.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/objectIndexer.ts === +export interface Callback { +>Callback : Callback + + (value: any): void; +>value : any +} + +interface IMap { +>IMap : IMap + + [s: string]: Callback; +>s : string +>Callback : Callback +} + +class Emitter { +>Emitter : Emitter + + private listeners: IMap; +>listeners : IMap +>IMap : IMap + + constructor () { + this.listeners = {}; +>this.listeners = {} : { [x: string]: Callback; } +>this.listeners : IMap +>this : Emitter +>listeners : IMap +>{} : { [x: string]: Callback; } + } +} + diff --git a/tests/baselines/reference/objectLitGetterSetter.types b/tests/baselines/reference/objectLitGetterSetter.types new file mode 100644 index 00000000000..271b3bf4e74 --- /dev/null +++ b/tests/baselines/reference/objectLitGetterSetter.types @@ -0,0 +1,65 @@ +=== tests/cases/compiler/objectLitGetterSetter.ts === + var obj = {}; +>obj : {} +>{} : {} + + Object.defineProperty(obj, "accProperty", ({ +>Object.defineProperty(obj, "accProperty", ({ + get: function () { + eval("public = 1;"); + return 11; + }, + set: function (v) { + } + })) : any +>Object.defineProperty : (o: any, p: string, attributes: PropertyDescriptor) => any +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } +>defineProperty : (o: any, p: string, attributes: PropertyDescriptor) => any +>obj : {} +>({ + get: function () { + eval("public = 1;"); + return 11; + }, + set: function (v) { + } + }) : PropertyDescriptor +>PropertyDescriptor : PropertyDescriptor +>({ + get: function () { + eval("public = 1;"); + return 11; + }, + set: function (v) { + } + }) : { get: () => number; set: (v: any) => void; } +>{ + get: function () { + eval("public = 1;"); + return 11; + }, + set: function (v) { + } + } : { get: () => number; set: (v: any) => void; } + + get: function () { +>get : () => number +>function () { + eval("public = 1;"); + return 11; + } : () => number + + eval("public = 1;"); +>eval("public = 1;") : any +>eval : (x: string) => any + + return 11; + }, + set: function (v) { +>set : (v: any) => void +>function (v) { + } : (v: any) => void +>v : any + } + })) + diff --git a/tests/baselines/reference/objectLiteral1.types b/tests/baselines/reference/objectLiteral1.types new file mode 100644 index 00000000000..6371d285f63 --- /dev/null +++ b/tests/baselines/reference/objectLiteral1.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/objectLiteral1.ts === +var v30 = {a:1, b:2}; +>v30 : { a: number; b: number; } +>{a:1, b:2} : { a: number; b: number; } +>a : number +>b : number + diff --git a/tests/baselines/reference/objectLiteral2.types b/tests/baselines/reference/objectLiteral2.types new file mode 100644 index 00000000000..c6853bdbd88 --- /dev/null +++ b/tests/baselines/reference/objectLiteral2.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/objectLiteral2.ts === +var v30 = {a:1, b:2}, v31; +>v30 : { a: number; b: number; } +>{a:1, b:2} : { a: number; b: number; } +>a : number +>b : number +>v31 : any + diff --git a/tests/baselines/reference/objectLiteralArraySpecialization.types b/tests/baselines/reference/objectLiteralArraySpecialization.types new file mode 100644 index 00000000000..bb1a8f16f29 --- /dev/null +++ b/tests/baselines/reference/objectLiteralArraySpecialization.types @@ -0,0 +1,51 @@ +=== tests/cases/compiler/objectLiteralArraySpecialization.ts === +declare function create(initialValues?: T[]): MyArrayWrapper; +>create : (initialValues?: T[]) => MyArrayWrapper +>T : T +>initialValues : T[] +>T : T +>MyArrayWrapper : MyArrayWrapper +>T : T + +interface MyArrayWrapper { +>MyArrayWrapper : MyArrayWrapper +>T : T + + constructor(initialItems?: T[]); +>constructor : (initialItems?: T[]) => any +>initialItems : T[] +>T : T + + doSomething(predicate: (x: T, y: T) => boolean): void; +>doSomething : (predicate: (x: T, y: T) => boolean) => void +>predicate : (x: T, y: T) => boolean +>x : T +>T : T +>y : T +>T : T +} +var thing = create([ { name: "bob", id: 24 }, { name: "doug", id: 32 } ]); // should not error +>thing : MyArrayWrapper<{ name: string; id: number; }> +>create([ { name: "bob", id: 24 }, { name: "doug", id: 32 } ]) : MyArrayWrapper<{ name: string; id: number; }> +>create : (initialValues?: T[]) => MyArrayWrapper +>[ { name: "bob", id: 24 }, { name: "doug", id: 32 } ] : { name: string; id: number; }[] +>{ name: "bob", id: 24 } : { name: string; id: number; } +>name : string +>id : number +>{ name: "doug", id: 32 } : { name: string; id: number; } +>name : string +>id : number + +thing.doSomething((x, y) => x.name === "bob"); // should not error +>thing.doSomething((x, y) => x.name === "bob") : void +>thing.doSomething : (predicate: (x: { name: string; id: number; }, y: { name: string; id: number; }) => boolean) => void +>thing : MyArrayWrapper<{ name: string; id: number; }> +>doSomething : (predicate: (x: { name: string; id: number; }, y: { name: string; id: number; }) => boolean) => void +>(x, y) => x.name === "bob" : (x: { name: string; id: number; }, y: { name: string; id: number; }) => boolean +>x : { name: string; id: number; } +>y : { name: string; id: number; } +>x.name === "bob" : boolean +>x.name : string +>x : { name: string; id: number; } +>name : string + diff --git a/tests/baselines/reference/objectLiteralDeclarationGeneration1.types b/tests/baselines/reference/objectLiteralDeclarationGeneration1.types new file mode 100644 index 00000000000..a7406d72ab4 --- /dev/null +++ b/tests/baselines/reference/objectLiteralDeclarationGeneration1.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/objectLiteralDeclarationGeneration1.ts === +class y{ } +>y : y +>T : T + diff --git a/tests/baselines/reference/objectLiteralIndexers.types b/tests/baselines/reference/objectLiteralIndexers.types new file mode 100644 index 00000000000..90107784324 --- /dev/null +++ b/tests/baselines/reference/objectLiteralIndexers.types @@ -0,0 +1,54 @@ +=== tests/cases/compiler/objectLiteralIndexers.ts === +interface A { +>A : A + + x: number; +>x : number +} + +interface B extends A { +>B : B +>A : A + + y: string; +>y : string +} + +var a: A; +>a : A +>A : A + +var b: B; +>b : B +>B : B + +var c: any; +>c : any + +var o1: { [s: string]: A;[n: number]: B; } = { x: a, 0: b }; // string indexer is A, number indexer is B +>o1 : { [x: string]: A; [x: number]: B; } +>s : string +>A : A +>n : number +>B : B +>{ x: a, 0: b } : { [x: string]: A; [x: number]: B; 0: B; x: A; } +>x : A +>a : a +>b : b + +o1 = { x: b, 0: c }; // both indexers are any +>o1 = { x: b, 0: c } : { [x: string]: any; [x: number]: any; 0: any; x: B; } +>o1 : { [x: string]: A; [x: number]: B; } +>{ x: b, 0: c } : { [x: string]: any; [x: number]: any; 0: any; x: B; } +>x : B +>b : b +>c : c + +o1 = { x: c, 0: b }; // string indexer is any, number indexer is B +>o1 = { x: c, 0: b } : { [x: string]: any; [x: number]: B; 0: B; x: any; } +>o1 : { [x: string]: A; [x: number]: B; } +>{ x: c, 0: b } : { [x: string]: any; [x: number]: B; 0: B; x: any; } +>x : any +>c : c +>b : b + diff --git a/tests/baselines/reference/objectLiteralWidened.types b/tests/baselines/reference/objectLiteralWidened.types new file mode 100644 index 00000000000..cd62d194f23 --- /dev/null +++ b/tests/baselines/reference/objectLiteralWidened.types @@ -0,0 +1,46 @@ +=== tests/cases/conformance/types/typeRelationships/widenedTypes/objectLiteralWidened.ts === +// object literal properties are widened to any + +var x = { +>x : { foo: any; bar: any; } +>{ + foo: null, + bar: undefined +} : { foo: null; bar: undefined; } + + foo: null, +>foo : any + + bar: undefined +>bar : any +>undefined : undefined +} + +var y = { +>y : { foo: any; bar: { baz: any; boo: any; }; } +>{ + foo: null, + bar: { + baz: null, + boo: undefined + } +} : { foo: null; bar: { baz: null; boo: undefined; }; } + + foo: null, +>foo : any + + bar: { +>bar : { baz: any; boo: any; } +>{ + baz: null, + boo: undefined + } : { baz: null; boo: undefined; } + + baz: null, +>baz : any + + boo: undefined +>boo : any +>undefined : undefined + } +} diff --git a/tests/baselines/reference/objectMembersOnTypes.types b/tests/baselines/reference/objectMembersOnTypes.types new file mode 100644 index 00000000000..f634f0bce06 --- /dev/null +++ b/tests/baselines/reference/objectMembersOnTypes.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/objectMembersOnTypes.ts === +interface I {} +>I : I + +class AAA implements I { } +>AAA : AAA +>I : I + +var x: number; +>x : number + +x.toString(); +>x.toString() : string +>x.toString : (radix?: number) => string +>x : number +>toString : (radix?: number) => string + +var i: I; +>i : I +>I : I + +i.toString(); // used to be an error +>i.toString() : string +>i.toString : () => string +>i : I +>toString : () => string + +var c: AAA; +>c : AAA +>AAA : AAA + +c.toString(); // used to be an error +>c.toString() : string +>c.toString : () => string +>c : AAA +>toString : () => string + diff --git a/tests/baselines/reference/objectTypeHidingMembersOfObject.types b/tests/baselines/reference/objectTypeHidingMembersOfObject.types new file mode 100644 index 00000000000..1926969b8bb --- /dev/null +++ b/tests/baselines/reference/objectTypeHidingMembersOfObject.types @@ -0,0 +1,71 @@ +=== tests/cases/conformance/types/members/objectTypeHidingMembersOfObject.ts === +// all of these valueOf calls should return the type shown in the overriding signatures here + +class C { +>C : C + + valueOf() { } +>valueOf : () => void +} + +var c: C; +>c : C +>C : C + +var r1: void = c.valueOf(); +>r1 : void +>c.valueOf() : void +>c.valueOf : () => void +>c : C +>valueOf : () => void + +interface I { +>I : I + + valueOf(): void; +>valueOf : () => void +} + +var i: I; +>i : I +>I : I + +var r2: void = i.valueOf(); +>r2 : void +>i.valueOf() : void +>i.valueOf : () => void +>i : I +>valueOf : () => void + +var a = { +>a : { valueOf: () => void; } +>{ + valueOf: () => { } +} : { valueOf: () => void; } + + valueOf: () => { } +>valueOf : () => void +>() => { } : () => void +} + +var r3: void = a.valueOf(); +>r3 : void +>a.valueOf() : void +>a.valueOf : () => void +>a : { valueOf: () => void; } +>valueOf : () => void + +var b: { +>b : { valueOf(): void; } + + valueOf(): void; +>valueOf : () => void +} + +var r4: void = b.valueOf(); +>r4 : void +>b.valueOf() : void +>b.valueOf : () => void +>b : { valueOf(): void; } +>valueOf : () => void + diff --git a/tests/baselines/reference/objectTypeLiteralSyntax.types b/tests/baselines/reference/objectTypeLiteralSyntax.types new file mode 100644 index 00000000000..43f01ea19a9 --- /dev/null +++ b/tests/baselines/reference/objectTypeLiteralSyntax.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/types/objectTypeLiteral/objectTypeLiteralSyntax.ts === +var x: { +>x : { foo: string; bar: string; } + + foo: string; +>foo : string + + bar: string; +>bar : string +} + +var y: { +>y : { foo: string; bar: string; } + + foo: string; +>foo : string + + bar: string +>bar : string +} diff --git a/tests/baselines/reference/objectTypePropertyAccess.types b/tests/baselines/reference/objectTypePropertyAccess.types new file mode 100644 index 00000000000..2ad370fd7aa --- /dev/null +++ b/tests/baselines/reference/objectTypePropertyAccess.types @@ -0,0 +1,105 @@ +=== tests/cases/conformance/types/members/objectTypePropertyAccess.ts === +// Index notation should resolve to the type of a declared property with that same name +class C { +>C : C + + foo: string; +>foo : string +} + +var c: C; +>c : C +>C : C + +var r1 = c.toString(); +>r1 : string +>c.toString() : string +>c.toString : () => string +>c : C +>toString : () => string + +var r2 = c['toString'](); +>r2 : string +>c['toString']() : string +>c['toString'] : () => string +>c : C + +var r3 = c.foo; +>r3 : string +>c.foo : string +>c : C +>foo : string + +var r4 = c['foo']; +>r4 : string +>c['foo'] : string +>c : C + +interface I { +>I : I + + bar: string; +>bar : string +} +var i: I; +>i : I +>I : I + +var r4 = i.toString(); +>r4 : string +>i.toString() : string +>i.toString : () => string +>i : I +>toString : () => string + +var r5 = i['toString'](); +>r5 : string +>i['toString']() : string +>i['toString'] : () => string +>i : I + +var r6 = i.bar; +>r6 : string +>i.bar : string +>i : I +>bar : string + +var r7 = i['bar']; +>r7 : string +>i['bar'] : string +>i : I + +var a = { +>a : { foo: string; } +>{ + foo: '' +} : { foo: string; } + + foo: '' +>foo : string +} + +var r8 = a.toString(); +>r8 : string +>a.toString() : string +>a.toString : () => string +>a : { foo: string; } +>toString : () => string + +var r9 = a['toString'](); +>r9 : string +>a['toString']() : string +>a['toString'] : () => string +>a : { foo: string; } + +var r10 = a.foo; +>r10 : string +>a.foo : string +>a : { foo: string; } +>foo : string + +var r11 = a['foo']; +>r11 : string +>a['foo'] : string +>a : { foo: string; } + diff --git a/tests/baselines/reference/objectTypeWithCallSignatureAppearsToBeFunctionType.types b/tests/baselines/reference/objectTypeWithCallSignatureAppearsToBeFunctionType.types new file mode 100644 index 00000000000..74d8ef57d67 --- /dev/null +++ b/tests/baselines/reference/objectTypeWithCallSignatureAppearsToBeFunctionType.types @@ -0,0 +1,46 @@ +=== tests/cases/conformance/types/members/objectTypeWithCallSignatureAppearsToBeFunctionType.ts === +// objects with call signatures should be permitted where function types are expected +// no errors expected below + +interface I { +>I : I + + (): void; +} + +var i: I; +>i : I +>I : I + +var r2: void = i(); +>r2 : void +>i() : void +>i : I + +var r2b: (x: any, y?: any) => any = i.apply; +>r2b : (x: any, y?: any) => any +>x : any +>y : any +>i.apply : (thisArg: any, argArray?: any) => any +>i : I +>apply : (thisArg: any, argArray?: any) => any + +var b: { +>b : () => void + + (): void; +} + +var r4: void = b(); +>r4 : void +>b() : void +>b : () => void + +var rb4: (x: any, y?: any) => any = b.apply; +>rb4 : (x: any, y?: any) => any +>x : any +>y : any +>b.apply : (thisArg: any, argArray?: any) => any +>b : () => void +>apply : (thisArg: any, argArray?: any) => any + diff --git a/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfExtendedFunction.types b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfExtendedFunction.types new file mode 100644 index 00000000000..56635a8e399 --- /dev/null +++ b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfExtendedFunction.types @@ -0,0 +1,115 @@ +=== tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfExtendedFunction.ts === +// object types with call signatures can override members of Function +// no errors expected below + +interface Function { +>Function : Function + + data: number; +>data : number + + [x: string]: Object; +>x : string +>Object : Object +} + +interface I { +>I : I + + (): void; + apply(a: any, b?: any): void; +>apply : (a: any, b?: any) => void +>a : any +>b : any + + call(thisArg: number, ...argArray: number[]): any; +>call : (thisArg: number, ...argArray: number[]) => any +>thisArg : number +>argArray : number[] +} + +var i: I; +>i : I +>I : I + +var r1: (a: any, b?: any) => void = i.apply; +>r1 : (a: any, b?: any) => void +>a : any +>b : any +>i.apply : (a: any, b?: any) => void +>i : I +>apply : (a: any, b?: any) => void + +var r1b: (thisArg: number, ...argArray: number[]) => void = i.call; +>r1b : (thisArg: number, ...argArray: number[]) => void +>thisArg : number +>argArray : number[] +>i.call : (thisArg: number, ...argArray: number[]) => any +>i : I +>call : (thisArg: number, ...argArray: number[]) => any + +var r1c = i.arguments; +>r1c : any +>i.arguments : any +>i : I +>arguments : any + +var r1d = i.data; +>r1d : number +>i.data : number +>i : I +>data : number + +var r1e = i['hm']; // should be Object +>r1e : any +>i['hm'] : any +>i : I + +var x: { +>x : { (): void; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } + + (): void; + apply(a: any, b?: any): void; +>apply : (a: any, b?: any) => void +>a : any +>b : any + + call(thisArg: number, ...argArray: number[]): any; +>call : (thisArg: number, ...argArray: number[]) => any +>thisArg : number +>argArray : number[] +} + +var r2: (a: any, b?: any) => void = x.apply; +>r2 : (a: any, b?: any) => void +>a : any +>b : any +>x.apply : (a: any, b?: any) => void +>x : { (): void; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } +>apply : (a: any, b?: any) => void + +var r2b: (thisArg: number, ...argArray: number[]) => void = x.call; +>r2b : (thisArg: number, ...argArray: number[]) => void +>thisArg : number +>argArray : number[] +>x.call : (thisArg: number, ...argArray: number[]) => any +>x : { (): void; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } +>call : (thisArg: number, ...argArray: number[]) => any + +var r2c = x.arguments; +>r2c : any +>x.arguments : any +>x : { (): void; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } +>arguments : any + +var r2d = x.data; +>r2d : number +>x.data : number +>x : { (): void; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } +>data : number + +var r2e = x['hm']; // should be Object +>r2e : any +>x['hm'] : any +>x : { (): void; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } + diff --git a/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunction.types b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunction.types new file mode 100644 index 00000000000..8f2f3d4a2b7 --- /dev/null +++ b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunction.types @@ -0,0 +1,82 @@ +=== tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunction.ts === +// object types with call signatures can override members of Function +// no errors expected below + +interface I { +>I : I + + (): void; + apply(a: any, b?: any): void; +>apply : (a: any, b?: any) => void +>a : any +>b : any + + call(thisArg: number, ...argArray: number[]): any; +>call : (thisArg: number, ...argArray: number[]) => any +>thisArg : number +>argArray : number[] +} + +var i: I; +>i : I +>I : I + +var r1: (a: any, b?: any) => void = i.apply; +>r1 : (a: any, b?: any) => void +>a : any +>b : any +>i.apply : (a: any, b?: any) => void +>i : I +>apply : (a: any, b?: any) => void + +var r1b: (thisArg: number, ...argArray: number[]) => void = i.call; +>r1b : (thisArg: number, ...argArray: number[]) => void +>thisArg : number +>argArray : number[] +>i.call : (thisArg: number, ...argArray: number[]) => any +>i : I +>call : (thisArg: number, ...argArray: number[]) => any + +var r1c = i.arguments; +>r1c : any +>i.arguments : any +>i : I +>arguments : any + +var x: { +>x : { (): void; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } + + (): void; + apply(a: any, b?: any): void; +>apply : (a: any, b?: any) => void +>a : any +>b : any + + call(thisArg: number, ...argArray: number[]): any; +>call : (thisArg: number, ...argArray: number[]) => any +>thisArg : number +>argArray : number[] +} + +var r2: (a: any, b?: any) => void = x.apply; +>r2 : (a: any, b?: any) => void +>a : any +>b : any +>x.apply : (a: any, b?: any) => void +>x : { (): void; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } +>apply : (a: any, b?: any) => void + +var r2b: (thisArg: number, ...argArray: number[]) => void = x.call; +>r2b : (thisArg: number, ...argArray: number[]) => void +>thisArg : number +>argArray : number[] +>x.call : (thisArg: number, ...argArray: number[]) => any +>x : { (): void; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } +>call : (thisArg: number, ...argArray: number[]) => any + +var r2c = x.arguments; +>r2c : any +>x.arguments : any +>x : { (): void; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } +>arguments : any + diff --git a/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.types b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.types new file mode 100644 index 00000000000..b7d8294dd96 --- /dev/null +++ b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.types @@ -0,0 +1,112 @@ +=== tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfExtendedFunction.ts === +interface Function { +>Function : Function + + data: number; +>data : number + + [x: string]: Object; +>x : string +>Object : Object +} + +interface I { +>I : I + + new(): number; + apply(a: any, b?: any): void; +>apply : (a: any, b?: any) => void +>a : any +>b : any + + call(thisArg: number, ...argArray: number[]): any; +>call : (thisArg: number, ...argArray: number[]) => any +>thisArg : number +>argArray : number[] +} + +var i: I; +>i : I +>I : I + +var r1: (a: any, b?: any) => void = i.apply; +>r1 : (a: any, b?: any) => void +>a : any +>b : any +>i.apply : (a: any, b?: any) => void +>i : I +>apply : (a: any, b?: any) => void + +var r1b: (thisArg: number, ...argArray: number[]) => void = i.call; +>r1b : (thisArg: number, ...argArray: number[]) => void +>thisArg : number +>argArray : number[] +>i.call : (thisArg: number, ...argArray: number[]) => any +>i : I +>call : (thisArg: number, ...argArray: number[]) => any + +var r1c = i.arguments; +>r1c : any +>i.arguments : any +>i : I +>arguments : any + +var r1d = i.data; +>r1d : number +>i.data : number +>i : I +>data : number + +var r1e = i['hm']; // should be Object +>r1e : any +>i['hm'] : any +>i : I + +var x: { +>x : { new (): number; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } + + new(): number; + apply(a: any, b?: any): void; +>apply : (a: any, b?: any) => void +>a : any +>b : any + + call(thisArg: number, ...argArray: number[]): any; +>call : (thisArg: number, ...argArray: number[]) => any +>thisArg : number +>argArray : number[] +} + +var r2: (a: any, b?: any) => void = x.apply; +>r2 : (a: any, b?: any) => void +>a : any +>b : any +>x.apply : (a: any, b?: any) => void +>x : { new (): number; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } +>apply : (a: any, b?: any) => void + +var r2b: (thisArg: number, ...argArray: number[]) => void = x.call; +>r2b : (thisArg: number, ...argArray: number[]) => void +>thisArg : number +>argArray : number[] +>x.call : (thisArg: number, ...argArray: number[]) => any +>x : { new (): number; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } +>call : (thisArg: number, ...argArray: number[]) => any + +var r2c = x.arguments; +>r2c : any +>x.arguments : any +>x : { new (): number; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } +>arguments : any + +var r2d = x.data; +>r2d : number +>x.data : number +>x : { new (): number; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } +>data : number + +var r2e = x['hm']; // should be Object +>r2e : any +>x['hm'] : any +>x : { new (): number; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } + diff --git a/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunction.types b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunction.types new file mode 100644 index 00000000000..d8d8a96823c --- /dev/null +++ b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunction.types @@ -0,0 +1,79 @@ +=== tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunction.ts === +interface I { +>I : I + + new(): number; + apply(a: any, b?: any): void; +>apply : (a: any, b?: any) => void +>a : any +>b : any + + call(thisArg: number, ...argArray: number[]): any; +>call : (thisArg: number, ...argArray: number[]) => any +>thisArg : number +>argArray : number[] +} + +var i: I; +>i : I +>I : I + +var r1: (a: any, b?: any) => void = i.apply; +>r1 : (a: any, b?: any) => void +>a : any +>b : any +>i.apply : (a: any, b?: any) => void +>i : I +>apply : (a: any, b?: any) => void + +var r1b: (thisArg: number, ...argArray: number[]) => void = i.call; +>r1b : (thisArg: number, ...argArray: number[]) => void +>thisArg : number +>argArray : number[] +>i.call : (thisArg: number, ...argArray: number[]) => any +>i : I +>call : (thisArg: number, ...argArray: number[]) => any + +var r1c = i.arguments; +>r1c : any +>i.arguments : any +>i : I +>arguments : any + +var x: { +>x : { new (): number; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } + + new(): number; + apply(a: any, b?: any): void; +>apply : (a: any, b?: any) => void +>a : any +>b : any + + call(thisArg: number, ...argArray: number[]): any; +>call : (thisArg: number, ...argArray: number[]) => any +>thisArg : number +>argArray : number[] +} + +var r2: (a: any, b?: any) => void = x.apply; +>r2 : (a: any, b?: any) => void +>a : any +>b : any +>x.apply : (a: any, b?: any) => void +>x : { new (): number; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } +>apply : (a: any, b?: any) => void + +var r2b: (thisArg: number, ...argArray: number[]) => void = x.call; +>r2b : (thisArg: number, ...argArray: number[]) => void +>thisArg : number +>argArray : number[] +>x.call : (thisArg: number, ...argArray: number[]) => any +>x : { new (): number; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } +>call : (thisArg: number, ...argArray: number[]) => any + +var r2c = x.arguments; +>r2c : any +>x.arguments : any +>x : { new (): number; apply(a: any, b?: any): void; call(thisArg: number, ...argArray: number[]): any; } +>arguments : any + diff --git a/tests/baselines/reference/objectTypeWithNumericProperty.types b/tests/baselines/reference/objectTypeWithNumericProperty.types new file mode 100644 index 00000000000..fb9e20f94a0 --- /dev/null +++ b/tests/baselines/reference/objectTypeWithNumericProperty.types @@ -0,0 +1,123 @@ +=== tests/cases/conformance/types/members/objectTypeWithNumericProperty.ts === +// no errors here + +class C { +>C : C + + 1: number; + 1.1: string; +} + +var c: C; +>c : C +>C : C + +var r1 = c[1]; +>r1 : number +>c[1] : number +>c : C + +var r2 = c[1.1]; +>r2 : string +>c[1.1] : string +>c : C + +var r3 = c['1']; +>r3 : number +>c['1'] : number +>c : C + +var r4 = c['1.1']; +>r4 : string +>c['1.1'] : string +>c : C + +interface I { +>I : I + + 1: number; + 1.1: string; +} + +var i: I; +>i : I +>I : I + +var r1 = i[1]; +>r1 : number +>i[1] : number +>i : I + +var r2 = i[1.1]; +>r2 : string +>i[1.1] : string +>i : I + +var r3 = i['1']; +>r3 : number +>i['1'] : number +>i : I + +var r4 = i['1.1']; +>r4 : string +>i['1.1'] : string +>i : I + +var a: { +>a : { 1: number; 1.1: string; } + + 1: number; + 1.1: string; +} + +var r1 = a[1]; +>r1 : number +>a[1] : number +>a : { 1: number; 1.1: string; } + +var r2 = a[1.1]; +>r2 : string +>a[1.1] : string +>a : { 1: number; 1.1: string; } + +var r3 = a['1']; +>r3 : number +>a['1'] : number +>a : { 1: number; 1.1: string; } + +var r4 = a['1.1']; +>r4 : string +>a['1.1'] : string +>a : { 1: number; 1.1: string; } + +var b = { +>b : { 1: number; 1.1: string; } +>{ + 1: 1, + 1.1: "" +} : { 1: number; 1.1: string; } + + 1: 1, + 1.1: "" +} + +var r1 = b[1]; +>r1 : number +>b[1] : number +>b : { 1: number; 1.1: string; } + +var r2 = b[1.1]; +>r2 : string +>b[1.1] : string +>b : { 1: number; 1.1: string; } + +var r3 = b['1']; +>r3 : number +>b['1'] : number +>b : { 1: number; 1.1: string; } + +var r4 = b['1.1']; +>r4 : string +>b['1.1'] : string +>b : { 1: number; 1.1: string; } + diff --git a/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.types b/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.types new file mode 100644 index 00000000000..8f445923024 --- /dev/null +++ b/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.types @@ -0,0 +1,469 @@ +=== tests/cases/conformance/types/members/objectTypeWithStringNamedNumericProperty.ts === + +// string named numeric properties are legal and distinct when indexed by string values +// indexed numerically the value is converted to a number +// no errors expected below + +class C { +>C : C + + "0.1": void; + ".1": Object; +>Object : Object + + "1": number; + "1.": string; + "1..": boolean; + "1.0": Date; +>Date : Date + + "-1.0": RegExp; +>RegExp : RegExp + + "-1": Date; +>Date : Date +} + +var c: C; +>c : C +>C : C + +var r1 = c['0.1']; +>r1 : void +>c['0.1'] : void +>c : C + +var r2 = c['.1']; +>r2 : Object +>c['.1'] : Object +>c : C + +var r3 = c['1']; +>r3 : number +>c['1'] : number +>c : C + +var r3 = c[1]; +>r3 : number +>c[1] : number +>c : C + +var r4 = c['1.']; +>r4 : string +>c['1.'] : string +>c : C + +var r3 = c[1.]; // same as indexing by 1 when done numerically +>r3 : number +>c[1.] : number +>c : C + +var r5 = c['1..']; +>r5 : boolean +>c['1..'] : boolean +>c : C + +var r6 = c['1.0']; +>r6 : Date +>c['1.0'] : Date +>c : C + +var r3 = c[1.0]; // same as indexing by 1 when done numerically +>r3 : number +>c[1.0] : number +>c : C + +// BUG 823822 +var r7 = i[-1]; +>r7 : any +>i[-1] : any +>i : I +>-1 : number + +var r7 = i[-1.0]; +>r7 : any +>i[-1.0] : any +>i : I +>-1.0 : number + +var r8 = i["-1.0"]; +>r8 : RegExp +>i["-1.0"] : RegExp +>i : I + +var r9 = i["-1"]; +>r9 : Date +>i["-1"] : Date +>i : I + +var r10 = i[0x1] +>r10 : number +>i[0x1] : number +>i : I + +var r11 = i[-0x1] +>r11 : any +>i[-0x1] : any +>i : I +>-0x1 : number + +var r12 = i[01] +>r12 : number +>i[01] : number +>i : I + +var r13 = i[-01] +>r13 : any +>i[-01] : any +>i : I +>-01 : number + +interface I { +>I : I + + "0.1": void; + ".1": Object; +>Object : Object + + "1": number; + "1.": string; + "1..": boolean; + "1.0": Date; +>Date : Date + + "-1.0": RegExp; +>RegExp : RegExp + + "-1": Date; +>Date : Date +} + +var i: I; +>i : I +>I : I + +var r1 = i['0.1']; +>r1 : void +>i['0.1'] : void +>i : I + +var r2 = i['.1']; +>r2 : Object +>i['.1'] : Object +>i : I + +var r3 = i['1']; +>r3 : number +>i['1'] : number +>i : I + +var r3 = c[1]; +>r3 : number +>c[1] : number +>c : C + +var r4 = i['1.']; +>r4 : string +>i['1.'] : string +>i : I + +var r3 = c[1.]; // same as indexing by 1 when done numerically +>r3 : number +>c[1.] : number +>c : C + +var r5 = i['1..']; +>r5 : boolean +>i['1..'] : boolean +>i : I + +var r6 = i['1.0']; +>r6 : Date +>i['1.0'] : Date +>i : I + +var r3 = c[1.0]; // same as indexing by 1 when done numerically +>r3 : number +>c[1.0] : number +>c : C + +// BUG 823822 +var r7 = i[-1]; +>r7 : any +>i[-1] : any +>i : I +>-1 : number + +var r7 = i[-1.0]; +>r7 : any +>i[-1.0] : any +>i : I +>-1.0 : number + +var r8 = i["-1.0"]; +>r8 : RegExp +>i["-1.0"] : RegExp +>i : I + +var r9 = i["-1"]; +>r9 : Date +>i["-1"] : Date +>i : I + +var r10 = i[0x1] +>r10 : number +>i[0x1] : number +>i : I + +var r11 = i[-0x1] +>r11 : any +>i[-0x1] : any +>i : I +>-0x1 : number + +var r12 = i[01] +>r12 : number +>i[01] : number +>i : I + +var r13 = i[-01] +>r13 : any +>i[-01] : any +>i : I +>-01 : number + +var a: { +>a : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } + + "0.1": void; + ".1": Object; +>Object : Object + + "1": number; + "1.": string; + "1..": boolean; + "1.0": Date; +>Date : Date + + "-1.0": RegExp; +>RegExp : RegExp + + "-1": Date; +>Date : Date +} + +var r1 = a['0.1']; +>r1 : void +>a['0.1'] : void +>a : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } + +var r2 = a['.1']; +>r2 : Object +>a['.1'] : Object +>a : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } + +var r3 = a['1']; +>r3 : number +>a['1'] : number +>a : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } + +var r3 = c[1]; +>r3 : number +>c[1] : number +>c : C + +var r4 = a['1.']; +>r4 : string +>a['1.'] : string +>a : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } + +var r3 = c[1.]; // same as indexing by 1 when done numerically +>r3 : number +>c[1.] : number +>c : C + +var r5 = a['1..']; +>r5 : boolean +>a['1..'] : boolean +>a : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } + +var r6 = a['1.0']; +>r6 : Date +>a['1.0'] : Date +>a : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } + +var r3 = c[1.0]; // same as indexing by 1 when done numerically +>r3 : number +>c[1.0] : number +>c : C + +// BUG 823822 +var r7 = i[-1]; +>r7 : any +>i[-1] : any +>i : I +>-1 : number + +var r7 = i[-1.0]; +>r7 : any +>i[-1.0] : any +>i : I +>-1.0 : number + +var r8 = i["-1.0"]; +>r8 : RegExp +>i["-1.0"] : RegExp +>i : I + +var r9 = i["-1"]; +>r9 : Date +>i["-1"] : Date +>i : I + +var r10 = i[0x1] +>r10 : number +>i[0x1] : number +>i : I + +var r11 = i[-0x1] +>r11 : any +>i[-0x1] : any +>i : I +>-0x1 : number + +var r12 = i[01] +>r12 : number +>i[01] : number +>i : I + +var r13 = i[-01] +>r13 : any +>i[-01] : any +>i : I +>-01 : number + +var b = { +>b : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; }; } +>{ + "0.1": null, + ".1": new Object(), + "1": 1, + "1.": "", + "1..": true, + "1.0": new Date(), + "-1.0": /123/, + "-1": Date +} : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; }; } + + "0.1": null, +>null : void + + ".1": new Object(), +>new Object() : Object +>Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } + + "1": 1, + "1.": "", + "1..": true, + "1.0": new Date(), +>new Date() : Date +>Date : { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } + + "-1.0": /123/, +>/123/ : RegExp + + "-1": Date +>Date : Date + +}; + +var r1 = b['0.1']; +>r1 : void +>b['0.1'] : void +>b : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; }; } + +var r2 = b['.1']; +>r2 : Object +>b['.1'] : Object +>b : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; }; } + +var r3 = b['1']; +>r3 : number +>b['1'] : number +>b : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; }; } + +var r3 = c[1]; +>r3 : number +>c[1] : number +>c : C + +var r4 = b['1.']; +>r4 : string +>b['1.'] : string +>b : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; }; } + +var r3 = c[1.]; // same as indexing by 1 when done numerically +>r3 : number +>c[1.] : number +>c : C + +var r5 = b['1..']; +>r5 : boolean +>b['1..'] : boolean +>b : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; }; } + +var r6 = b['1.0']; +>r6 : Date +>b['1.0'] : Date +>b : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": { (): string; new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; prototype: Date; parse(s: string): number; UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; }; } + +var r3 = c[1.0]; // same as indexing by 1 when done numerically +>r3 : number +>c[1.0] : number +>c : C + +// BUG 823822 +var r7 = i[-1]; +>r7 : any +>i[-1] : any +>i : I +>-1 : number + +var r7 = i[-1.0]; +>r7 : any +>i[-1.0] : any +>i : I +>-1.0 : number + +var r8 = i["-1.0"]; +>r8 : RegExp +>i["-1.0"] : RegExp +>i : I + +var r9 = i["-1"]; +>r9 : Date +>i["-1"] : Date +>i : I + +var r10 = i[0x1] +>r10 : number +>i[0x1] : number +>i : I + +var r11 = i[-0x1] +>r11 : any +>i[-0x1] : any +>i : I +>-0x1 : number + +var r12 = i[01] +>r12 : number +>i[01] : number +>i : I + +var r13 = i[-01] +>r13 : any +>i[-01] : any +>i : I +>-01 : number + diff --git a/tests/baselines/reference/objectTypeWithStringNamedPropertyOfIllegalCharacters.types b/tests/baselines/reference/objectTypeWithStringNamedPropertyOfIllegalCharacters.types new file mode 100644 index 00000000000..032f54a8565 --- /dev/null +++ b/tests/baselines/reference/objectTypeWithStringNamedPropertyOfIllegalCharacters.types @@ -0,0 +1,133 @@ +=== tests/cases/conformance/types/members/objectTypeWithStringNamedPropertyOfIllegalCharacters.ts === +class C { +>C : C + + " ": number; + "a b": string; + "~!@#$%^&*()_+{}|:'<>?\/.,`": number; + "a\a": number; + static "a ": number +} + +var c: C; +>c : C +>C : C + +var r = c[" "]; +>r : number +>c[" "] : number +>c : C + +var r2 = c[" "]; +>r2 : any +>c[" "] : any +>c : C + +var r3 = c["a b"]; +>r3 : string +>c["a b"] : string +>c : C + +// BUG 817263 +var r4 = c["~!@#$%^&*()_+{}|:'<>?\/.,`"]; +>r4 : number +>c["~!@#$%^&*()_+{}|:'<>?\/.,`"] : number +>c : C + +interface I { +>I : I + + " ": number; + "a b": string; + "~!@#$%^&*()_+{}|:'<>?\/.,`": number; +} + +var i: I; +>i : I +>I : I + +var r = i[" "]; +>r : number +>i[" "] : number +>i : I + +var r2 = i[" "]; +>r2 : any +>i[" "] : any +>i : I + +var r3 = i["a b"]; +>r3 : string +>i["a b"] : string +>i : I + +// BUG 817263 +var r4 = i["~!@#$%^&*()_+{}|:'<>?\/.,`"]; +>r4 : number +>i["~!@#$%^&*()_+{}|:'<>?\/.,`"] : number +>i : I + + +var a: { +>a : { " ": number; "a b": string; "~!@#$%^&*()_+{}|:'<>?\/.,`": number; } + + " ": number; + "a b": string; + "~!@#$%^&*()_+{}|:'<>?\/.,`": number; +} + +var r = a[" "]; +>r : number +>a[" "] : number +>a : { " ": number; "a b": string; "~!@#$%^&*()_+{}|:'<>?\/.,`": number; } + +var r2 = a[" "]; +>r2 : any +>a[" "] : any +>a : { " ": number; "a b": string; "~!@#$%^&*()_+{}|:'<>?\/.,`": number; } + +var r3 = a["a b"]; +>r3 : string +>a["a b"] : string +>a : { " ": number; "a b": string; "~!@#$%^&*()_+{}|:'<>?\/.,`": number; } + +// BUG 817263 +var r4 = a["~!@#$%^&*()_+{}|:'<>?\/.,`"]; +>r4 : number +>a["~!@#$%^&*()_+{}|:'<>?\/.,`"] : number +>a : { " ": number; "a b": string; "~!@#$%^&*()_+{}|:'<>?\/.,`": number; } + +var b = { +>b : { " ": number; "a b": string; "~!@#$%^&*()_+{}|:'<>?\/.,`": number; } +>{ + " ": 1, + "a b": "", + "~!@#$%^&*()_+{}|:'<>?\/.,`": 1, +} : { " ": number; "a b": string; "~!@#$%^&*()_+{}|:'<>?\/.,`": number; } + + " ": 1, + "a b": "", + "~!@#$%^&*()_+{}|:'<>?\/.,`": 1, +} + +var r = b[" "]; +>r : number +>b[" "] : number +>b : { " ": number; "a b": string; "~!@#$%^&*()_+{}|:'<>?\/.,`": number; } + +var r2 = b[" "]; +>r2 : any +>b[" "] : any +>b : { " ": number; "a b": string; "~!@#$%^&*()_+{}|:'<>?\/.,`": number; } + +var r3 = b["a b"]; +>r3 : string +>b["a b"] : string +>b : { " ": number; "a b": string; "~!@#$%^&*()_+{}|:'<>?\/.,`": number; } + +// BUG 817263 +var r4 = b["~!@#$%^&*()_+{}|:'<>?\/.,`"]; +>r4 : number +>b["~!@#$%^&*()_+{}|:'<>?\/.,`"] : number +>b : { " ": number; "a b": string; "~!@#$%^&*()_+{}|:'<>?\/.,`": number; } + diff --git a/tests/baselines/reference/objectTypesIdentity.types b/tests/baselines/reference/objectTypesIdentity.types new file mode 100644 index 00000000000..03e0c6ff0b3 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentity.types @@ -0,0 +1,280 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity.ts === +// object types are identical structurally + +class A { +>A : A + + foo: string; +>foo : string +} + +class B { +>B : B + + foo: string; +>foo : string +} + +class C { +>C : C +>T : T + + foo: T; +>foo : T +>T : T +} + +interface I { +>I : I + + foo: string; +>foo : string +} + +var a: { foo: string; } +>a : { foo: string; } +>foo : string + +var b = { foo: '' }; +>b : { foo: string; } +>{ foo: '' } : { foo: string; } +>foo : string + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>a : { foo: string; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>a : { foo: string; } + +function foo3(x: any) { } +>foo3 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>b : { foo: string; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>b : { foo: string; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // error +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // error +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // error +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo: string; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // error +>foo7 : { (x: A): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>a : { foo: string; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo: string; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // error +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo: string; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // error +>foo10 : { (x: B): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>a : { foo: string; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo: string; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: string; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // error +>foo11 : { (x: B): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>b : { foo: string; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: string; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // error +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo: string; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // error +>foo13 : { (x: I): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>a : { foo: string; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo: string; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: string; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // error +>foo14 : { (x: I): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>b : { foo: string; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: string; }): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentity2.types b/tests/baselines/reference/objectTypesIdentity2.types new file mode 100644 index 00000000000..13a19f0c268 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentity2.types @@ -0,0 +1,205 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2.ts === +// object types are identical structurally + +class A { +>A : A + + foo: number; +>foo : number +} + +class B { +>B : B + + foo: boolean; +>foo : boolean +} + +class C { +>C : C +>T : T + + foo: T; +>foo : T +>T : T +} + +interface I { +>I : I + + foo: Date; +>foo : Date +>Date : Date +} + +var a: { foo: RegExp; } +>a : { foo: RegExp; } +>foo : RegExp +>RegExp : RegExp + +enum E { A } +>E : E +>A : E + +var b = { foo: E.A }; +>b : { foo: E; } +>{ foo: E.A } : { foo: E; } +>foo : E +>E.A : E +>E : typeof E +>A : E + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // ok +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // ok +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo: RegExp; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // ok +>foo7 : { (x: A): any; (x: { foo: RegExp; }): any; } +>x : { foo: RegExp; } +>a : { foo: RegExp; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo: RegExp; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // ok +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // ok +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo: RegExp; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: { foo: RegExp; }): any; } +>x : { foo: RegExp; } +>a : { foo: RegExp; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo: RegExp; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: E; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { foo: E; }): any; } +>x : { foo: E; } +>b : { foo: E; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: E; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo: RegExp; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: { foo: RegExp; }): any; } +>x : { foo: RegExp; } +>a : { foo: RegExp; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo: RegExp; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: E; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { foo: E; }): any; } +>x : { foo: E; } +>b : { foo: E; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: E; }): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignatures.types b/tests/baselines/reference/objectTypesIdentityWithCallSignatures.types new file mode 100644 index 00000000000..36354b4e064 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignatures.types @@ -0,0 +1,327 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures.ts === +// object types are identical structurally + +class A { +>A : A + + foo(x: string): string { return null; } +>foo : (x: string) => string +>x : string +} + +class B { +>B : B + + foo(x: string): string { return null; } +>foo : (x: string) => string +>x : string +} + +class C { +>C : C +>T : T + + foo(x: T): T { return null; } +>foo : (x: T) => T +>x : T +>T : T +>T : T +} + +interface I { +>I : I + + foo(x: string): string; +>foo : (x: string) => string +>x : string +} + +interface I2 { +>I2 : I2 +>T : T + + foo(x: T): T; +>foo : (x: T) => T +>x : T +>T : T +>T : T +} + +var a: { foo(x: string): string } +>a : { foo(x: string): string; } +>foo : (x: string) => string +>x : string + +var b = { foo(x: string) { return ''; } }; +>b : { foo: (x: string) => string; } +>{ foo(x: string) { return ''; } } : { foo: (x: string) => string; } +>foo : (x: string) => string +>foo(x: string) { return ''; } : (x: string) => string +>x : string + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo(x: string): string; }): any; (x: { foo(x: string): string; }): any; } +>x : { foo(x: string): string; } +>a : { foo(x: string): string; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo(x: string): string; }): any; (x: { foo(x: string): string; }): any; } +>x : { foo(x: string): string; } +>a : { foo(x: string): string; } + +function foo3(x: any) { } +>foo3 : { (x: { foo(x: string): string; }): any; (x: { foo(x: string): string; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; } +>x : { foo: (x: string) => string; } +>b : { foo: (x: string) => string; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; } +>x : { foo: (x: string) => string; } +>b : { foo: (x: string) => string; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // error +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // error +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // error +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo(x: string): string; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // error +>foo7 : { (x: A): any; (x: { foo(x: string): string; }): any; } +>x : { foo(x: string): string; } +>a : { foo(x: string): string; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo(x: string): string; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // error +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo(x: string): string; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // error +>foo10 : { (x: B): any; (x: { foo(x: string): string; }): any; } +>x : { foo(x: string): string; } +>a : { foo(x: string): string; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo(x: string): string; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // error +>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; } +>x : { foo: (x: string) => string; } +>b : { foo: (x: string) => string; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // error +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // error +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo(x: string): string; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // error +>foo13 : { (x: I): any; (x: { foo(x: string): string; }): any; } +>x : { foo(x: string): string; } +>a : { foo(x: string): string; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo(x: string): string; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // error +>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; } +>x : { foo: (x: string) => string; } +>b : { foo: (x: string) => string; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.types b/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.types new file mode 100644 index 00000000000..b8ff76d8d6b --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.types @@ -0,0 +1,329 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures2.ts === +// object types are identical structurally + +class A { +>A : A + + foo(x: string): string { return null; } +>foo : (x: string) => string +>x : string +} + +class B { +>B : B + + foo(x: number): string { return null; } +>foo : (x: number) => string +>x : number +} + +class C { +>C : C +>T : T + + foo(x: T): T { return null; } +>foo : (x: T) => T +>x : T +>T : T +>T : T +} + +interface I { +>I : I + + foo(x: boolean): string; +>foo : (x: boolean) => string +>x : boolean +} + +interface I2 { +>I2 : I2 +>T : T + + foo(x: T): T; +>foo : (x: T) => T +>x : T +>T : T +>T : T +} + +var a: { foo(x: Date): string } +>a : { foo(x: Date): string; } +>foo : (x: Date) => string +>x : Date +>Date : Date + +var b = { foo(x: RegExp) { return ''; } }; +>b : { foo: (x: RegExp) => string; } +>{ foo(x: RegExp) { return ''; } } : { foo: (x: RegExp) => string; } +>foo : (x: RegExp) => string +>foo(x: RegExp) { return ''; } : (x: RegExp) => string +>x : RegExp +>RegExp : RegExp + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo(x: Date): string; }): any; (x: { foo(x: Date): string; }): any; } +>x : { foo(x: Date): string; } +>a : { foo(x: Date): string; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo(x: Date): string; }): any; (x: { foo(x: Date): string; }): any; } +>x : { foo(x: Date): string; } +>a : { foo(x: Date): string; } + +function foo3(x: any) { } +>foo3 : { (x: { foo(x: Date): string; }): any; (x: { foo(x: Date): string; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: (x: RegExp) => string; }): any; (x: { foo: (x: RegExp) => string; }): any; } +>x : { foo: (x: RegExp) => string; } +>b : { foo: (x: RegExp) => string; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: (x: RegExp) => string; }): any; (x: { foo: (x: RegExp) => string; }): any; } +>x : { foo: (x: RegExp) => string; } +>b : { foo: (x: RegExp) => string; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: (x: RegExp) => string; }): any; (x: { foo: (x: RegExp) => string; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // ok +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // error +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo(x: Date): string; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // ok +>foo7 : { (x: A): any; (x: { foo(x: Date): string; }): any; } +>x : { foo(x: Date): string; } +>a : { foo(x: Date): string; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo(x: Date): string; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // ok +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // ok +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo(x: Date): string; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: { foo(x: Date): string; }): any; } +>x : { foo(x: Date): string; } +>a : { foo(x: Date): string; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo(x: Date): string; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: (x: RegExp) => string; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { foo: (x: RegExp) => string; }): any; } +>x : { foo: (x: RegExp) => string; } +>b : { foo: (x: RegExp) => string; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: (x: RegExp) => string; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // error +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo(x: Date): string; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: { foo(x: Date): string; }): any; } +>x : { foo(x: Date): string; } +>a : { foo(x: Date): string; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo(x: Date): string; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: (x: RegExp) => string; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { foo: (x: RegExp) => string; }): any; } +>x : { foo: (x: RegExp) => string; } +>b : { foo: (x: RegExp) => string; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: (x: RegExp) => string; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.types b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.types new file mode 100644 index 00000000000..781bb66a44f --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.types @@ -0,0 +1,331 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts === +// object types are identical structurally + +class A { +>A : A + + foo(x: string): string { return null; } +>foo : (x: string) => string +>x : string +} + +class B { +>B : B + + foo(x: string, y: string): string { return null; } +>foo : (x: string, y: string) => string +>x : string +>y : string +} + +class C { +>C : C +>T : T + + foo(x: T, y: T): T { return null; } +>foo : (x: T, y: T) => T +>x : T +>T : T +>y : T +>T : T +>T : T +} + +interface I { +>I : I + + foo(x: string): string; +>foo : (x: string) => string +>x : string +} + +interface I2 { +>I2 : I2 +>T : T + + foo(x: T): T; +>foo : (x: T) => T +>x : T +>T : T +>T : T +} + +var a: { foo(x: string, y: string): string } +>a : { foo(x: string, y: string): string; } +>foo : (x: string, y: string) => string +>x : string +>y : string + +var b = { foo(x: string) { return ''; } }; +>b : { foo: (x: string) => string; } +>{ foo(x: string) { return ''; } } : { foo: (x: string) => string; } +>foo : (x: string) => string +>foo(x: string) { return ''; } : (x: string) => string +>x : string + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo(x: string, y: string): string; }): any; (x: { foo(x: string, y: string): string; }): any; } +>x : { foo(x: string, y: string): string; } +>a : { foo(x: string, y: string): string; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo(x: string, y: string): string; }): any; (x: { foo(x: string, y: string): string; }): any; } +>x : { foo(x: string, y: string): string; } +>a : { foo(x: string, y: string): string; } + +function foo3(x: any) { } +>foo3 : { (x: { foo(x: string, y: string): string; }): any; (x: { foo(x: string, y: string): string; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; } +>x : { foo: (x: string) => string; } +>b : { foo: (x: string) => string; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; } +>x : { foo: (x: string) => string; } +>b : { foo: (x: string) => string; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // ok +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // ok +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // error +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo(x: string, y: string): string; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // ok +>foo7 : { (x: A): any; (x: { foo(x: string, y: string): string; }): any; } +>x : { foo(x: string, y: string): string; } +>a : { foo(x: string, y: string): string; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo(x: string, y: string): string; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // ok +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // ok +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo(x: string, y: string): string; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // error +>foo10 : { (x: B): any; (x: { foo(x: string, y: string): string; }): any; } +>x : { foo(x: string, y: string): string; } +>a : { foo(x: string, y: string): string; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo(x: string, y: string): string; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; } +>x : { foo: (x: string) => string; } +>b : { foo: (x: string) => string; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo(x: string, y: string): string; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: { foo(x: string, y: string): string; }): any; } +>x : { foo(x: string, y: string): string; } +>a : { foo(x: string, y: string): string; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo(x: string, y: string): string; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // error +>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; } +>x : { foo: (x: string) => string; } +>b : { foo: (x: string) => string; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts2.types b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts2.types new file mode 100644 index 00000000000..4d2b02481ee --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts2.types @@ -0,0 +1,137 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesDifferingParamCounts2.ts === +// object types are identical structurally + +interface I { +>I : I + + (x: string): string; +>x : string +} + +interface I2 { +>I2 : I2 +>T : T + + (x: T): T; +>x : T +>T : T +>T : T +} + +var a: { (x: string, y: string): string } +>a : (x: string, y: string) => string +>x : string +>y : string + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: (x: string, y: string) => string): any; (x: (x: string, y: string) => string): any; } +>x : (x: string, y: string) => string +>a : (x: string, y: string) => string + +function foo3(x: typeof a); // error +>foo3 : { (x: (x: string, y: string) => string): any; (x: (x: string, y: string) => string): any; } +>x : (x: string, y: string) => string +>a : (x: string, y: string) => string + +function foo3(x: any) { } +>foo3 : { (x: (x: string, y: string) => string): any; (x: (x: string, y: string) => string): any; } +>x : any + +function foo4(x: I2); +>foo4 : { (x: I2): any; (x: I2): any; } +>x : I2 +>I2 : I2 + +function foo4(x: I2); // error +>foo4 : { (x: I2): any; (x: I2): any; } +>x : I2 +>I2 : I2 + +function foo4(x: any) { } +>foo4 : { (x: I2): any; (x: I2): any; } +>x : any + +function foo5(x: I2); +>foo5 : { (x: I2): any; (x: I2): any; } +>x : I2 +>I2 : I2 + +function foo5(x: I2); // ok +>foo5 : { (x: I2): any; (x: I2): any; } +>x : I2 +>I2 : I2 + +function foo5(x: any) { } +>foo5 : { (x: I2): any; (x: I2): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: (x: string, y: string) => string): any; } +>x : I +>I : I + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: (x: string, y: string) => string): any; } +>x : (x: string, y: string) => string +>a : (x: string, y: string) => string + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: (x: string, y: string) => string): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: I2): any; } +>x : I +>I : I + +function foo14(x: I2); // error +>foo14 : { (x: I): any; (x: I2): any; } +>x : I2 +>I2 : I2 + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: I2): any; } +>x : any + +function foo14b(x: typeof a); +>foo14b : { (x: (x: string, y: string) => string): any; (x: I2): any; } +>x : (x: string, y: string) => string +>a : (x: string, y: string) => string + +function foo14b(x: I2); // ok +>foo14b : { (x: (x: string, y: string) => string): any; (x: I2): any; } +>x : I2 +>I2 : I2 + +function foo14b(x: any) { } +>foo14b : { (x: (x: string, y: string) => string): any; (x: I2): any; } +>x : any + +function foo15(x: I); +>foo15 : { (x: I): any; (x: I2): any; } +>x : I +>I : I + +function foo15(x: I2); // ok +>foo15 : { (x: I): any; (x: I2): any; } +>x : I2 +>I2 : I2 + +function foo15(x: any) { } +>foo15 : { (x: I): any; (x: I2): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.types b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.types new file mode 100644 index 00000000000..a57aa38b5fe --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.types @@ -0,0 +1,381 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesWithOverloads.ts === +// object types are identical structurally + +class A { +>A : A + + foo(x: number): number; +>foo : { (x: number): number; (x: string): string; } +>x : number + + foo(x: string): string; +>foo : { (x: number): number; (x: string): string; } +>x : string + + foo(x: any): any { return null; } +>foo : { (x: number): number; (x: string): string; } +>x : any +} + +class B { +>B : B + + foo(x: number): number; +>foo : { (x: number): number; (x: string): string; } +>x : number + + foo(x: string): string; +>foo : { (x: number): number; (x: string): string; } +>x : string + + foo(x: any): any { return null; } +>foo : { (x: number): number; (x: string): string; } +>x : any +} + +class C { +>C : C +>T : T + + foo(x: number): number; +>foo : { (x: number): number; (x: string): string; (x: T): T; } +>x : number + + foo(x: string): string; +>foo : { (x: number): number; (x: string): string; (x: T): T; } +>x : string + + foo(x: T): T; +>foo : { (x: number): number; (x: string): string; (x: T): T; } +>x : T +>T : T +>T : T + + foo(x: any): any { return null; } +>foo : { (x: number): number; (x: string): string; (x: T): T; } +>x : any +} + +interface I { +>I : I + + foo(x: number): number; +>foo : { (x: number): number; (x: string): string; } +>x : number + + foo(x: string): string; +>foo : { (x: number): number; (x: string): string; } +>x : string +} + +interface I2 { +>I2 : I2 +>T : T + + foo(x: number): number; +>foo : { (x: number): number; (x: string): string; (x: T): T; } +>x : number + + foo(x: string): string; +>foo : { (x: number): number; (x: string): string; (x: T): T; } +>x : string + + foo(x: T): T; +>foo : { (x: number): number; (x: string): string; (x: T): T; } +>x : T +>T : T +>T : T +} + +var a: { +>a : { foo(x: number): number; foo(x: string): string; } + + foo(x: number): number +>foo : { (x: number): number; (x: string): string; } +>x : number + + foo(x: string): string +>foo : { (x: number): number; (x: string): string; } +>x : string +} + +var b = { +>b : { foo: (x: any) => any; } +>{ + foo(x: any) { return ''; } +} : { foo: (x: any) => any; } + + foo(x: any) { return ''; } +>foo : (x: any) => any +>foo(x: any) { return ''; } : (x: any) => any +>x : any +>'' : any + +}; + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo(x: number): number; foo(x: string): string; }): any; (x: { foo(x: number): number; foo(x: string): string; }): any; } +>x : { foo(x: number): number; foo(x: string): string; } +>a : { foo(x: number): number; foo(x: string): string; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo(x: number): number; foo(x: string): string; }): any; (x: { foo(x: number): number; foo(x: string): string; }): any; } +>x : { foo(x: number): number; foo(x: string): string; } +>a : { foo(x: number): number; foo(x: string): string; } + +function foo3(x: any) { } +>foo3 : { (x: { foo(x: number): number; foo(x: string): string; }): any; (x: { foo(x: number): number; foo(x: string): string; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: (x: any) => any; }): any; (x: { foo: (x: any) => any; }): any; } +>x : { foo: (x: any) => any; } +>b : { foo: (x: any) => any; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: (x: any) => any; }): any; (x: { foo: (x: any) => any; }): any; } +>x : { foo: (x: any) => any; } +>b : { foo: (x: any) => any; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: (x: any) => any; }): any; (x: { foo: (x: any) => any; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // error +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // ok +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // BUG 831930 +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo(x: number): number; foo(x: string): string; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // BUG 831930 +>foo7 : { (x: A): any; (x: { foo(x: number): number; foo(x: string): string; }): any; } +>x : { foo(x: number): number; foo(x: string): string; } +>a : { foo(x: number): number; foo(x: string): string; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo(x: number): number; foo(x: string): string; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // BUG 831930 +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // ok +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo(x: number): number; foo(x: string): string; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // BUG 831930 +>foo10 : { (x: B): any; (x: { foo(x: number): number; foo(x: string): string; }): any; } +>x : { foo(x: number): number; foo(x: string): string; } +>a : { foo(x: number): number; foo(x: string): string; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo(x: number): number; foo(x: string): string; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: (x: any) => any; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { foo: (x: any) => any; }): any; } +>x : { foo: (x: any) => any; } +>b : { foo: (x: any) => any; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: (x: any) => any; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo(x: number): number; foo(x: string): string; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // error +>foo13 : { (x: I): any; (x: { foo(x: number): number; foo(x: string): string; }): any; } +>x : { foo(x: number): number; foo(x: string): string; } +>a : { foo(x: number): number; foo(x: string): string; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo(x: number): number; foo(x: string): string; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: (x: any) => any; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { foo: (x: any) => any; }): any; } +>x : { foo: (x: any) => any; } +>b : { foo: (x: any) => any; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: (x: any) => any; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithConstructSignatures.types b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures.types new file mode 100644 index 00000000000..45e89698d41 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures.types @@ -0,0 +1,271 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignatures.ts === +// object types are identical structurally + +class A { +>A : A + + constructor(x: string) { } +>x : string +} + +class B { +>B : B + + constructor(x: string) { } +>x : string +} + +class C { +>C : C +>T : T + + constructor(x: T) { } +>x : T +>T : T +} + +interface I { +>I : I + + new(x: string); +>x : string +} + +interface I2 { +>I2 : I2 +>T : T + + new(x: T): T; +>x : T +>T : T +>T : T +} + +var a: { new(x: string) } +>a : new (x: string) => any +>x : string + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: new (x: string) => any): any; (x: new (x: string) => any): any; } +>x : new (x: string) => any +>a : new (x: string) => any + +function foo3(x: typeof a); // error +>foo3 : { (x: new (x: string) => any): any; (x: new (x: string) => any): any; } +>x : new (x: string) => any +>a : new (x: string) => any + +function foo3(x: any) { } +>foo3 : { (x: new (x: string) => any): any; (x: new (x: string) => any): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // error +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // error +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: new (x: string) => any): any; } +>x : A +>A : A + +function foo7(x: typeof a); // ok +>foo7 : { (x: A): any; (x: new (x: string) => any): any; } +>x : new (x: string) => any +>a : new (x: string) => any + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: new (x: string) => any): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // ok +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: new (x: string) => any): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: new (x: string) => any): any; } +>x : new (x: string) => any +>a : new (x: string) => any + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: new (x: string) => any): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: new (x: string) => any): any; } +>x : I +>I : I + +function foo13(x: typeof a); // error +>foo13 : { (x: I): any; (x: new (x: string) => any): any; } +>x : new (x: string) => any +>a : new (x: string) => any + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: new (x: string) => any): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.types b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.types new file mode 100644 index 00000000000..cd94be2f367 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.types @@ -0,0 +1,245 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignatures2.ts === +// object types are identical structurally + +class B { +>B : B + + constructor(x: number) { return null; } +>x : number +} + +class C { +>C : C +>T : T + + constructor(x: T) { return null; } +>x : T +>T : T +} + +interface I { +>I : I + + new(x: boolean): string; +>x : boolean +} + +interface I2 { +>I2 : I2 +>T : T + + new(x: T): T; +>x : T +>T : T +>T : T +} + +var a: { new(x: Date): string } +>a : new (x: Date) => string +>x : Date +>Date : Date + +var b = { new(x: RegExp) { return ''; } }; // not a construct signature, function called new +>b : { new: (x: RegExp) => string; } +>{ new(x: RegExp) { return ''; } } : { new: (x: RegExp) => string; } +>new : (x: RegExp) => string +>new(x: RegExp) { return ''; } : (x: RegExp) => string +>x : RegExp +>RegExp : RegExp + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: new (x: Date) => string): any; (x: new (x: Date) => string): any; } +>x : new (x: Date) => string +>a : new (x: Date) => string + +function foo3(x: typeof a); // error +>foo3 : { (x: new (x: Date) => string): any; (x: new (x: Date) => string): any; } +>x : new (x: Date) => string +>a : new (x: Date) => string + +function foo3(x: any) { } +>foo3 : { (x: new (x: Date) => string): any; (x: new (x: Date) => string): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { new: (x: RegExp) => string; }): any; (x: { new: (x: RegExp) => string; }): any; } +>x : { new: (x: RegExp) => string; } +>b : { new: (x: RegExp) => string; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { new: (x: RegExp) => string; }): any; (x: { new: (x: RegExp) => string; }): any; } +>x : { new: (x: RegExp) => string; } +>b : { new: (x: RegExp) => string; } + +function foo4(x: any) { } +>foo4 : { (x: { new: (x: RegExp) => string; }): any; (x: { new: (x: RegExp) => string; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // ok +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error, types are structurally equal +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: new (x: Date) => string): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: new (x: Date) => string): any; } +>x : new (x: Date) => string +>a : new (x: Date) => string + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: new (x: Date) => string): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { new: (x: RegExp) => string; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { new: (x: RegExp) => string; }): any; } +>x : { new: (x: RegExp) => string; } +>b : { new: (x: RegExp) => string; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { new: (x: RegExp) => string; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: new (x: Date) => string): any; } +>x : I +>I : I + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: new (x: Date) => string): any; } +>x : new (x: Date) => string +>a : new (x: Date) => string + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: new (x: Date) => string): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { new: (x: RegExp) => string; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { new: (x: RegExp) => string; }): any; } +>x : { new: (x: RegExp) => string; } +>b : { new: (x: RegExp) => string; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { new: (x: RegExp) => string; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.types b/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.types new file mode 100644 index 00000000000..763e154bb57 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.types @@ -0,0 +1,247 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.ts === +// object types are identical structurally + +class B { +>B : B + + constructor(x: string, y: string) { return null; } +>x : string +>y : string +} + +class C { +>C : C +>T : T + + constructor(x: T, y: T) { return null; } +>x : T +>T : T +>y : T +>T : T +} + +interface I { +>I : I + + new(x: string): string; +>x : string +} + +interface I2 { +>I2 : I2 +>T : T + + new(x: T): T; +>x : T +>T : T +>T : T +} + +var a: { new(x: string, y: string): string } +>a : new (x: string, y: string) => string +>x : string +>y : string + +var b = { new(x: string) { return ''; } }; // not a construct signature, function called new +>b : { new: (x: string) => string; } +>{ new(x: string) { return ''; } } : { new: (x: string) => string; } +>new : (x: string) => string +>new(x: string) { return ''; } : (x: string) => string +>x : string + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: new (x: string, y: string) => string): any; (x: new (x: string, y: string) => string): any; } +>x : new (x: string, y: string) => string +>a : new (x: string, y: string) => string + +function foo3(x: typeof a); // error +>foo3 : { (x: new (x: string, y: string) => string): any; (x: new (x: string, y: string) => string): any; } +>x : new (x: string, y: string) => string +>a : new (x: string, y: string) => string + +function foo3(x: any) { } +>foo3 : { (x: new (x: string, y: string) => string): any; (x: new (x: string, y: string) => string): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { new: (x: string) => string; }): any; (x: { new: (x: string) => string; }): any; } +>x : { new: (x: string) => string; } +>b : { new: (x: string) => string; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { new: (x: string) => string; }): any; (x: { new: (x: string) => string; }): any; } +>x : { new: (x: string) => string; } +>b : { new: (x: string) => string; } + +function foo4(x: any) { } +>foo4 : { (x: { new: (x: string) => string; }): any; (x: { new: (x: string) => string; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // ok +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error, types are structurally equal +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: new (x: string, y: string) => string): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: new (x: string, y: string) => string): any; } +>x : new (x: string, y: string) => string +>a : new (x: string, y: string) => string + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: new (x: string, y: string) => string): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { new: (x: string) => string; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { new: (x: string) => string; }): any; } +>x : { new: (x: string) => string; } +>b : { new: (x: string) => string; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { new: (x: string) => string; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: new (x: string, y: string) => string): any; } +>x : I +>I : I + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: new (x: string, y: string) => string): any; } +>x : new (x: string, y: string) => string +>a : new (x: string, y: string) => string + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: new (x: string, y: string) => string): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { new: (x: string) => string; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { new: (x: string) => string; }): any; } +>x : { new: (x: string) => string; } +>b : { new: (x: string) => string; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { new: (x: string) => string; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.types new file mode 100644 index 00000000000..da3e99870d0 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.types @@ -0,0 +1,342 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignatures.ts === +// object types are identical structurally + +class A { +>A : A + + foo(x: T): T { return null; } +>foo : (x: T) => T +>T : T +>x : T +>T : T +>T : T +} + +class B { +>B : B +>T : T + + foo(x: T): T { return null; } +>foo : (x: T) => T +>x : T +>T : T +>T : T +} + +class C { +>C : C +>T : T + + foo(x: T): T { return null; } +>foo : (x: T) => T +>x : T +>T : T +>T : T +} + +interface I { +>I : I +>T : T + + foo(x: T): T; +>foo : (x: T) => T +>x : T +>T : T +>T : T +} + +interface I2 { +>I2 : I2 + + foo(x: T): T; +>foo : (x: T) => T +>T : T +>x : T +>T : T +>T : T +} + +var a: { foo(x: T): T } +>a : { foo(x: T): T; } +>foo : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +var b = { foo(x: T) { return x; } }; +>b : { foo: (x: T) => T; } +>{ foo(x: T) { return x; } } : { foo: (x: T) => T; } +>foo : (x: T) => T +>foo(x: T) { return x; } : (x: T) => T +>T : T +>x : T +>T : T +>x : T + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo(x: T): T; }): any; (x: { foo(x: T): T; }): any; } +>x : { foo(x: T): T; } +>a : { foo(x: T): T; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo(x: T): T; }): any; (x: { foo(x: T): T; }): any; } +>x : { foo(x: T): T; } +>a : { foo(x: T): T; } + +function foo3(x: any) { } +>foo3 : { (x: { foo(x: T): T; }): any; (x: { foo(x: T): T; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: (x: T) => T; }): any; (x: { foo: (x: T) => T; }): any; } +>x : { foo: (x: T) => T; } +>b : { foo: (x: T) => T; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: (x: T) => T; }): any; (x: { foo: (x: T) => T; }): any; } +>x : { foo: (x: T) => T; } +>b : { foo: (x: T) => T; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: (x: T) => T; }): any; (x: { foo: (x: T) => T; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // ok +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // ok +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo(x: T): T; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // error +>foo7 : { (x: A): any; (x: { foo(x: T): T; }): any; } +>x : { foo(x: T): T; } +>a : { foo(x: T): T; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo(x: T): T; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // error +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo(x: T): T; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: { foo(x: T): T; }): any; } +>x : { foo(x: T): T; } +>a : { foo(x: T): T; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo(x: T): T; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: (x: T) => T; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { foo: (x: T) => T; }): any; } +>x : { foo: (x: T) => T; } +>b : { foo: (x: T) => T; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: (x: T) => T; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // error +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo(x: T): T; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: { foo(x: T): T; }): any; } +>x : { foo(x: T): T; } +>a : { foo(x: T): T; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo(x: T): T; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: (x: T) => T; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { foo: (x: T) => T; }): any; } +>x : { foo: (x: T) => T; } +>b : { foo: (x: T) => T; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: (x: T) => T; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.types new file mode 100644 index 00000000000..cdbec140acd --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.types @@ -0,0 +1,363 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignatures2.ts === +// object types are identical structurally + +class A { +>A : A + + foo(x: T, y: U): T { return null; } +>foo : (x: T, y: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T +} + +class B { +>B : B +>T : T +>U : U + + foo(x: T, y: U): T { return null; } +>foo : (x: T, y: U) => T +>x : T +>T : T +>y : U +>U : U +>T : T +} + +class C { +>C : C +>T : T +>U : U + + foo(x: T, y: U): T { return null; } +>foo : (x: T, y: U) => T +>x : T +>T : T +>y : U +>U : U +>T : T +} + +interface I { +>I : I +>T : T +>U : U + + foo(x: T, y: U): T; +>foo : (x: T, y: U) => T +>x : T +>T : T +>y : U +>U : U +>T : T +} + +interface I2 { +>I2 : I2 + + foo(x: T, y: U): T; +>foo : (x: T, y: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T +} + +var a: { foo(x: T, y: U): T } +>a : { foo(x: T, y: U): T; } +>foo : (x: T, y: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T + +var b = { foo(x: T, y: U) { return x; } }; +>b : { foo: (x: T, y: U) => T; } +>{ foo(x: T, y: U) { return x; } } : { foo: (x: T, y: U) => T; } +>foo : (x: T, y: U) => T +>foo(x: T, y: U) { return x; } : (x: T, y: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>x : T + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo(x: T, y: U): T; }): any; (x: { foo(x: T, y: U): T; }): any; } +>x : { foo(x: T, y: U): T; } +>a : { foo(x: T, y: U): T; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo(x: T, y: U): T; }): any; (x: { foo(x: T, y: U): T; }): any; } +>x : { foo(x: T, y: U): T; } +>a : { foo(x: T, y: U): T; } + +function foo3(x: any) { } +>foo3 : { (x: { foo(x: T, y: U): T; }): any; (x: { foo(x: T, y: U): T; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: (x: T, y: U) => T; }): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : { foo: (x: T, y: U) => T; } +>b : { foo: (x: T, y: U) => T; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: (x: T, y: U) => T; }): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : { foo: (x: T, y: U) => T; } +>b : { foo: (x: T, y: U) => T; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: (x: T, y: U) => T; }): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // ok +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // ok +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo(x: T, y: U): T; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // no error, bug? +>foo7 : { (x: A): any; (x: { foo(x: T, y: U): T; }): any; } +>x : { foo(x: T, y: U): T; } +>a : { foo(x: T, y: U): T; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo(x: T, y: U): T; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // error +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo(x: T, y: U): T; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: { foo(x: T, y: U): T; }): any; } +>x : { foo(x: T, y: U): T; } +>a : { foo(x: T, y: U): T; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo(x: T, y: U): T; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : { foo: (x: T, y: U) => T; } +>b : { foo: (x: T, y: U) => T; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // error +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo(x: T, y: U): T; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: { foo(x: T, y: U): T; }): any; } +>x : { foo(x: T, y: U): T; } +>a : { foo(x: T, y: U): T; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo(x: T, y: U): T; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : { foo: (x: T, y: U) => T; } +>b : { foo: (x: T, y: U) => T; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.types new file mode 100644 index 00000000000..30533d64909 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.types @@ -0,0 +1,365 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts === +// Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those +// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, +// optional or rest) and types, and identical return types. + +class A { +>A : A + + foo(x: T): string { return null; } +>foo : (x: T) => string +>T : T +>Date : Date +>x : T +>T : T +} + +class B> { +>B : B +>T : T +>Array : Array + + foo(x: T): string { return null; } +>foo : (x: T) => string +>x : T +>T : T +} + +class C { +>C : C +>T : T +>String : String + + foo(x: T): string { return null; } +>foo : (x: T) => string +>x : T +>T : T +} + +interface I { +>I : I +>T : T +>Number : Number + + foo(x: T): string; +>foo : (x: T) => string +>x : T +>T : T +} + +interface I2 { +>I2 : I2 + + foo(x: T): string; +>foo : (x: T) => string +>T : T +>Boolean : Boolean +>x : T +>T : T +} + +var a: { foo>(x: T): string } +>a : { foo(x: T): string; } +>foo : (x: T) => string +>T : T +>Array : Array +>x : T +>T : T + +var b = { foo(x: T) { return ''; } }; +>b : { foo: (x: T) => string; } +>{ foo(x: T) { return ''; } } : { foo: (x: T) => string; } +>foo : (x: T) => string +>foo(x: T) { return ''; } : (x: T) => string +>T : T +>RegExp : RegExp +>x : T +>T : T + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B>); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B +>Array : Array + +function foo1b(x: B>); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B +>Array : Array + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C +>String : String + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C +>String : String + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I +>Number : Number + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I +>Number : Number + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo(x: T): string; }): any; (x: { foo(x: T): string; }): any; } +>x : { foo(x: T): string; } +>a : { foo(x: T): string; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo(x: T): string; }): any; (x: { foo(x: T): string; }): any; } +>x : { foo(x: T): string; } +>a : { foo(x: T): string; } + +function foo3(x: any) { } +>foo3 : { (x: { foo(x: T): string; }): any; (x: { foo(x: T): string; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: (x: T) => string; }): any; (x: { foo: (x: T) => string; }): any; } +>x : { foo: (x: T) => string; } +>b : { foo: (x: T) => string; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: (x: T) => string; }): any; (x: { foo: (x: T) => string; }): any; } +>x : { foo: (x: T) => string; } +>b : { foo: (x: T) => string; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: (x: T) => string; }): any; (x: { foo: (x: T) => string; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B>); // ok +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B +>Array : Array + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // ok +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C +>String : String + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I +>Number : Number + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo(x: T): string; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // ok +>foo7 : { (x: A): any; (x: { foo(x: T): string; }): any; } +>x : { foo(x: T): string; } +>a : { foo(x: T): string; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo(x: T): string; }): any; } +>x : any + +function foo8(x: B>); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B +>Array : Array + +function foo8(x: I); // ok +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I +>Number : Number + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B>); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B +>Array : Array + +function foo9(x: C); // ok +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C +>String : String + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B>); +>foo10 : { (x: B): any; (x: { foo(x: T): string; }): any; } +>x : B +>B : B +>Array : Array + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: { foo(x: T): string; }): any; } +>x : { foo(x: T): string; } +>a : { foo(x: T): string; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo(x: T): string; }): any; } +>x : any + +function foo11(x: B>); +>foo11 : { (x: B): any; (x: { foo: (x: T) => string; }): any; } +>x : B +>B : B +>Array : Array + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { foo: (x: T) => string; }): any; } +>x : { foo: (x: T) => string; } +>b : { foo: (x: T) => string; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: (x: T) => string; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I +>Number : Number + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C +>String : String + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C +>String : String + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo(x: T): string; }): any; } +>x : I +>I : I +>Number : Number + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: { foo(x: T): string; }): any; } +>x : { foo(x: T): string; } +>a : { foo(x: T): string; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo(x: T): string; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: (x: T) => string; }): any; } +>x : I +>I : I +>Number : Number + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { foo: (x: T) => string; }): any; } +>x : { foo: (x: T) => string; } +>b : { foo: (x: T) => string; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: (x: T) => string; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C +>String : String + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.types new file mode 100644 index 00000000000..5da4a078018 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.types @@ -0,0 +1,340 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts === +// Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those +// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, +// optional or rest) and types, and identical return types. + +class A { +>A : A + + foo(x: T): string { return null; } +>foo : (x: T) => string +>T : T +>x : T +>T : T +} + +class B { +>B : B +>T : T + + foo(x: T): number { return null; } +>foo : (x: T) => number +>x : T +>T : T +} + +class C { +>C : C +>T : T + + foo(x: T): boolean { return null; } +>foo : (x: T) => boolean +>x : T +>T : T +} + +interface I { +>I : I +>T : T + + foo(x: T): Date; +>foo : (x: T) => Date +>x : T +>T : T +>Date : Date +} + +interface I2 { +>I2 : I2 + + foo(x: T): RegExp; +>foo : (x: T) => RegExp +>T : T +>x : T +>T : T +>RegExp : RegExp +} + +var a: { foo(x: T): T } +>a : { foo(x: T): T; } +>foo : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +var b = { foo(x: T) { return null; } }; +>b : { foo: (x: T) => any; } +>{ foo(x: T) { return null; } } : { foo: (x: T) => any; } +>foo : (x: T) => any +>foo(x: T) { return null; } : (x: T) => any +>T : T +>x : T +>T : T + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo(x: T): T; }): any; (x: { foo(x: T): T; }): any; } +>x : { foo(x: T): T; } +>a : { foo(x: T): T; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo(x: T): T; }): any; (x: { foo(x: T): T; }): any; } +>x : { foo(x: T): T; } +>a : { foo(x: T): T; } + +function foo3(x: any) { } +>foo3 : { (x: { foo(x: T): T; }): any; (x: { foo(x: T): T; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: (x: T) => any; }): any; (x: { foo: (x: T) => any; }): any; } +>x : { foo: (x: T) => any; } +>b : { foo: (x: T) => any; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: (x: T) => any; }): any; (x: { foo: (x: T) => any; }): any; } +>x : { foo: (x: T) => any; } +>b : { foo: (x: T) => any; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: (x: T) => any; }): any; (x: { foo: (x: T) => any; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // ok +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // ok +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo(x: T): T; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // ok +>foo7 : { (x: A): any; (x: { foo(x: T): T; }): any; } +>x : { foo(x: T): T; } +>a : { foo(x: T): T; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo(x: T): T; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // ok +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // ok +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo(x: T): T; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: { foo(x: T): T; }): any; } +>x : { foo(x: T): T; } +>a : { foo(x: T): T; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo(x: T): T; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: (x: T) => any; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { foo: (x: T) => any; }): any; } +>x : { foo: (x: T) => any; } +>b : { foo: (x: T) => any; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: (x: T) => any; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo(x: T): T; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: { foo(x: T): T; }): any; } +>x : { foo(x: T): T; } +>a : { foo(x: T): T; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo(x: T): T; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: (x: T) => any; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { foo: (x: T) => any; }): any; } +>x : { foo: (x: T) => any; } +>b : { foo: (x: T) => any; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: (x: T) => any; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.types new file mode 100644 index 00000000000..eb3160f5083 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.types @@ -0,0 +1,368 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts === +// Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those +// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, +// optional or rest) and types, and identical return types. + +class A { +>A : A + + foo(x: T): string { return null; } +>foo : (x: T) => string +>T : T +>Date : Date +>x : T +>T : T +} + +class B { +>B : B +>T : T +>Date : Date + + foo(x: T): number { return null; } +>foo : (x: T) => number +>x : T +>T : T +} + +class C { +>C : C +>T : T +>Date : Date + + foo(x: T): boolean { return null; } +>foo : (x: T) => boolean +>x : T +>T : T +} + +interface I { +>I : I +>T : T +>Date : Date + + foo(x: T): Date; +>foo : (x: T) => Date +>x : T +>T : T +>Date : Date +} + +interface I2 { +>I2 : I2 + + foo(x: T): RegExp; +>foo : (x: T) => RegExp +>T : T +>Date : Date +>x : T +>T : T +>RegExp : RegExp +} + +var a: { foo(x: T): T } +>a : { foo(x: T): T; } +>foo : (x: T) => T +>T : T +>Date : Date +>x : T +>T : T +>T : T + +var b = { foo(x: T) { return null; } }; +>b : { foo: (x: T) => any; } +>{ foo(x: T) { return null; } } : { foo: (x: T) => any; } +>foo : (x: T) => any +>foo(x: T) { return null; } : (x: T) => any +>T : T +>Date : Date +>x : T +>T : T + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B +>Date : Date + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B +>Date : Date + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C +>Date : Date + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C +>Date : Date + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I +>Date : Date + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I +>Date : Date + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo(x: T): T; }): any; (x: { foo(x: T): T; }): any; } +>x : { foo(x: T): T; } +>a : { foo(x: T): T; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo(x: T): T; }): any; (x: { foo(x: T): T; }): any; } +>x : { foo(x: T): T; } +>a : { foo(x: T): T; } + +function foo3(x: any) { } +>foo3 : { (x: { foo(x: T): T; }): any; (x: { foo(x: T): T; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: (x: T) => any; }): any; (x: { foo: (x: T) => any; }): any; } +>x : { foo: (x: T) => any; } +>b : { foo: (x: T) => any; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: (x: T) => any; }): any; (x: { foo: (x: T) => any; }): any; } +>x : { foo: (x: T) => any; } +>b : { foo: (x: T) => any; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: (x: T) => any; }): any; (x: { foo: (x: T) => any; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // ok +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B +>Date : Date + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // ok +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C +>Date : Date + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I +>Date : Date + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo(x: T): T; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // ok +>foo7 : { (x: A): any; (x: { foo(x: T): T; }): any; } +>x : { foo(x: T): T; } +>a : { foo(x: T): T; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo(x: T): T; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B +>Date : Date + +function foo8(x: I); // ok +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I +>Date : Date + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B +>Date : Date + +function foo9(x: C); // ok +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C +>Date : Date + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo(x: T): T; }): any; } +>x : B +>B : B +>Date : Date + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: { foo(x: T): T; }): any; } +>x : { foo(x: T): T; } +>a : { foo(x: T): T; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo(x: T): T; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: (x: T) => any; }): any; } +>x : B +>B : B +>Date : Date + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { foo: (x: T) => any; }): any; } +>x : { foo: (x: T) => any; } +>b : { foo: (x: T) => any; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: (x: T) => any; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I +>Date : Date + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C +>Date : Date + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C +>Date : Date + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo(x: T): T; }): any; } +>x : I +>I : I +>Date : Date + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: { foo(x: T): T; }): any; } +>x : { foo(x: T): T; } +>a : { foo(x: T): T; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo(x: T): T; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: (x: T) => any; }): any; } +>x : I +>I : I +>Date : Date + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { foo: (x: T) => any; }): any; } +>x : { foo: (x: T) => any; } +>b : { foo: (x: T) => any; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: (x: T) => any; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C +>Date : Date + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.types new file mode 100644 index 00000000000..025abacda6f --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.types @@ -0,0 +1,374 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts === +// object types are identical structurally + +class A { +>A : A + + foo(x: T): T { return null; } +>foo : (x: T) => T +>T : T +>x : T +>T : T +>T : T +} + +class B { +>B : B +>U : U +>V : V + + foo(x: U): U { return null; } +>foo : (x: U) => U +>x : U +>U : U +>U : U +} + +class C { +>C : C +>V : V +>W : W +>X : X + + foo(x: V): V { return null; } +>foo : (x: V) => V +>x : V +>V : V +>V : V +} + +interface I { +>I : I +>X : X +>Y : Y +>Z : Z +>A : A + + foo(x: X): X; +>foo : (x: X) => X +>x : X +>X : X +>X : X +} + +interface I2 { +>I2 : I2 + + foo(x: Y): Y; +>foo : (x: Y) => Y +>Y : Y +>Z : Z +>A : A +>B : B +>x : Y +>Y : Y +>Y : Y +} + +var a: { foo(x: Z): Z } +>a : { foo(x: Z): Z; } +>foo : (x: Z) => Z +>Z : Z +>A : A +>B : B +>C : C +>D : D +>x : Z +>Z : Z +>Z : Z + +var b = { foo(x: A) { return x; } }; +>b : { foo: (x: A) => A; } +>{ foo(x: A) { return x; } } : { foo: (x: A) => A; } +>foo : (x: A) => A +>foo(x: A) { return x; } : (x: A) => A +>A : A +>B : B +>C : C +>D : D +>E : E +>F : F +>x : A +>A : A +>x : A + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo(x: Z): Z; }): any; (x: { foo(x: Z): Z; }): any; } +>x : { foo(x: Z): Z; } +>a : { foo(x: Z): Z; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo(x: Z): Z; }): any; (x: { foo(x: Z): Z; }): any; } +>x : { foo(x: Z): Z; } +>a : { foo(x: Z): Z; } + +function foo3(x: any) { } +>foo3 : { (x: { foo(x: Z): Z; }): any; (x: { foo(x: Z): Z; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: (x: A) => A; }): any; (x: { foo: (x: A) => A; }): any; } +>x : { foo: (x: A) => A; } +>b : { foo: (x: A) => A; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: (x: A) => A; }): any; (x: { foo: (x: A) => A; }): any; } +>x : { foo: (x: A) => A; } +>b : { foo: (x: A) => A; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: (x: A) => A; }): any; (x: { foo: (x: A) => A; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // ok +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // ok +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I +>Date : Date + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo(x: Z): Z; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // no error, bug? +>foo7 : { (x: A): any; (x: { foo(x: Z): Z; }): any; } +>x : { foo(x: Z): Z; } +>a : { foo(x: Z): Z; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo(x: Z): Z; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // error +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I +>Date : Date + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C>): any; } +>x : B +>B : B + +function foo9(x: C>); // error +>foo9 : { (x: B): any; (x: C>): any; } +>x : C> +>C : C +>B : B + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C>): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo(x: Z): Z; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: { foo(x: Z): Z; }): any; } +>x : { foo(x: Z): Z; } +>a : { foo(x: Z): Z; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo(x: Z): Z; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: (x: A) => A; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { foo: (x: A) => A; }): any; } +>x : { foo: (x: A) => A; } +>b : { foo: (x: A) => A; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: (x: A) => A; }): any; } +>x : any + +function foo12(x: I, number, Date, string>); +>foo12 : { (x: I, number, Date, string>): any; (x: C, number, Date>): any; } +>x : I, number, Date, string> +>I : I +>B : B +>Date : Date + +function foo12(x: C, number, Date>); // error +>foo12 : { (x: I, number, Date, string>): any; (x: C, number, Date>): any; } +>x : C, number, Date> +>C : C +>B : B +>Date : Date + +function foo12(x: any) { } +>foo12 : { (x: I, number, Date, string>): any; (x: C, number, Date>): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo(x: Z): Z; }): any; } +>x : I +>I : I +>Date : Date +>RegExp : RegExp +>Date : Date + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: { foo(x: Z): Z; }): any; } +>x : { foo(x: Z): Z; } +>a : { foo(x: Z): Z; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo(x: Z): Z; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: (x: A) => A; }): any; } +>x : I +>I : I +>Date : Date +>RegExp : RegExp + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { foo: (x: A) => A; }): any; } +>x : { foo: (x: A) => A; } +>b : { foo: (x: A) => A; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: (x: A) => A; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C, B>): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C, B>); // ok +>foo15 : { (x: I2): any; (x: C, B>): any; } +>x : C, B> +>C : C +>B : B +>B : B + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C, B>): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.types new file mode 100644 index 00000000000..713af12dfff --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.types @@ -0,0 +1,142 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts === +// object types are identical structurally + + +interface I { +>I : I +>X : X +>Y : Y +>Z : Z +>A : A + + (x: X): X; +>x : X +>X : X +>X : X +} + +interface I2 { +>I2 : I2 + + (x: Y): Y; +>Y : Y +>Z : Z +>A : A +>B : B +>x : Y +>Y : Y +>Y : Y +} + +var a: { (x: Z): Z } +>a : (x: Z) => Z +>Z : Z +>A : A +>B : B +>C : C +>D : D +>x : Z +>Z : Z +>Z : Z + +function foo1(x: I); +>foo1 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo1(x: I); // error +>foo1 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo1(x: any) { } +>foo1 : { (x: I): any; (x: I): any; } +>x : any + +function foo2(x: I2); +>foo2 : { (x: I2): any; (x: I2): any; } +>x : I2 +>I2 : I2 + +function foo2(x: I2); // error +>foo2 : { (x: I2): any; (x: I2): any; } +>x : I2 +>I2 : I2 + +function foo2(x: any) { } +>foo2 : { (x: I2): any; (x: I2): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: (x: Z) => Z): any; (x: (x: Z) => Z): any; } +>x : (x: Z) => Z +>a : (x: Z) => Z + +function foo3(x: typeof a); // error +>foo3 : { (x: (x: Z) => Z): any; (x: (x: Z) => Z): any; } +>x : (x: Z) => Z +>a : (x: Z) => Z + +function foo3(x: any) { } +>foo3 : { (x: (x: Z) => Z): any; (x: (x: Z) => Z): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: (x: Z) => Z): any; } +>x : I +>I : I +>Date : Date + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: (x: Z) => Z): any; } +>x : (x: Z) => Z +>a : (x: Z) => Z + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: (x: Z) => Z): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: I2): any; } +>x : I +>I : I +>Date : Date + +function foo14(x: I2); // error +>foo14 : { (x: I): any; (x: I2): any; } +>x : I2 +>I2 : I2 + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: I2): any; } +>x : any + +function foo14b(x: typeof a); +>foo14b : { (x: (x: Z) => Z): any; (x: I2): any; } +>x : (x: Z) => Z +>a : (x: Z) => Z + +function foo14b(x: I2); // ok +>foo14b : { (x: (x: Z) => Z): any; (x: I2): any; } +>x : I2 +>I2 : I2 + +function foo14b(x: any) { } +>foo14b : { (x: (x: Z) => Z): any; (x: I2): any; } +>x : any + +function foo15(x: I); +>foo15 : { (x: I): any; (x: I2): any; } +>x : I +>I : I +>Date : Date + +function foo15(x: I2); // ok +>foo15 : { (x: I): any; (x: I2): any; } +>x : I2 +>I2 : I2 + +function foo15(x: any) { } +>foo15 : { (x: I): any; (x: I2): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.types new file mode 100644 index 00000000000..6888b9f08e3 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.types @@ -0,0 +1,342 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts === +// object types are identical structurally + +class A { +>A : A + + foo(x: T): T { return null; } +>foo : (x: T) => T +>T : T +>x : T +>T : T +>T : T +} + +class B { +>B : B +>U : U + + foo(x: U): U { return null; } +>foo : (x: U) => U +>x : U +>U : U +>U : U +} + +class C { +>C : C +>V : V + + foo(x: V): V { return null; } +>foo : (x: V) => V +>x : V +>V : V +>V : V +} + +interface I { +>I : I +>X : X + + foo(x: X): X; +>foo : (x: X) => X +>x : X +>X : X +>X : X +} + +interface I2 { +>I2 : I2 + + foo(x: Y): Y; +>foo : (x: Y) => Y +>Y : Y +>x : Y +>Y : Y +>Y : Y +} + +var a: { foo(x: Z): Z } +>a : { foo(x: Z): Z; } +>foo : (x: Z) => Z +>Z : Z +>x : Z +>Z : Z +>Z : Z + +var b = { foo(x: A) { return x; } }; +>b : { foo: (x: A) => A; } +>{ foo(x: A) { return x; } } : { foo: (x: A) => A; } +>foo : (x: A) => A +>foo(x: A) { return x; } : (x: A) => A +>A : A +>x : A +>A : A +>x : A + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo(x: Z): Z; }): any; (x: { foo(x: Z): Z; }): any; } +>x : { foo(x: Z): Z; } +>a : { foo(x: Z): Z; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo(x: Z): Z; }): any; (x: { foo(x: Z): Z; }): any; } +>x : { foo(x: Z): Z; } +>a : { foo(x: Z): Z; } + +function foo3(x: any) { } +>foo3 : { (x: { foo(x: Z): Z; }): any; (x: { foo(x: Z): Z; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: (x: A) => A; }): any; (x: { foo: (x: A) => A; }): any; } +>x : { foo: (x: A) => A; } +>b : { foo: (x: A) => A; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: (x: A) => A; }): any; (x: { foo: (x: A) => A; }): any; } +>x : { foo: (x: A) => A; } +>b : { foo: (x: A) => A; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: (x: A) => A; }): any; (x: { foo: (x: A) => A; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // ok +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // ok +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo(x: Z): Z; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // error +>foo7 : { (x: A): any; (x: { foo(x: Z): Z; }): any; } +>x : { foo(x: Z): Z; } +>a : { foo(x: Z): Z; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo(x: Z): Z; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // error +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo(x: Z): Z; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: { foo(x: Z): Z; }): any; } +>x : { foo(x: Z): Z; } +>a : { foo(x: Z): Z; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo(x: Z): Z; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: (x: A) => A; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { foo: (x: A) => A; }): any; } +>x : { foo: (x: A) => A; } +>b : { foo: (x: A) => A; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: (x: A) => A; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // error +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo(x: Z): Z; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: { foo(x: Z): Z; }): any; } +>x : { foo(x: Z): Z; } +>a : { foo(x: Z): Z; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo(x: Z): Z; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: (x: A) => A; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { foo: (x: A) => A; }): any; } +>x : { foo: (x: A) => A; } +>b : { foo: (x: A) => A; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: (x: A) => A; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.types new file mode 100644 index 00000000000..1caabc6216b --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.types @@ -0,0 +1,358 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts === +// Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those +// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, +// optional or rest) and types, and identical return types. + +class A { +>A : A + + foo(x: T, y?: T): T { return null; } +>foo : (x: T, y?: T) => T +>T : T +>x : T +>T : T +>y : T +>T : T +>T : T +} + +class B { +>B : B +>T : T + + foo(x: T, y?: T): T { return null; } +>foo : (x: T, y?: T) => T +>x : T +>T : T +>y : T +>T : T +>T : T +} + +class C { +>C : C +>T : T + + foo(x: T, y?: T): T { return null; } +>foo : (x: T, y?: T) => T +>x : T +>T : T +>y : T +>T : T +>T : T +} + +interface I { +>I : I +>T : T + + foo(x: T, y?: T): T; +>foo : (x: T, y?: T) => T +>x : T +>T : T +>y : T +>T : T +>T : T +} + +interface I2 { +>I2 : I2 + + foo(x: T, y?: T): T; +>foo : (x: T, y?: T) => T +>T : T +>x : T +>T : T +>y : T +>T : T +>T : T +} + +var a: { foo(x: T, y?: T): T } +>a : { foo(x: T, y?: T): T; } +>foo : (x: T, y?: T) => T +>T : T +>x : T +>T : T +>y : T +>T : T +>T : T + +var b = { foo(x: T, y?: T) { return x; } }; +>b : { foo: (x: T, y?: T) => T; } +>{ foo(x: T, y?: T) { return x; } } : { foo: (x: T, y?: T) => T; } +>foo : (x: T, y?: T) => T +>foo(x: T, y?: T) { return x; } : (x: T, y?: T) => T +>T : T +>x : T +>T : T +>y : T +>T : T +>x : T + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo(x: T, y?: T): T; }): any; (x: { foo(x: T, y?: T): T; }): any; } +>x : { foo(x: T, y?: T): T; } +>a : { foo(x: T, y?: T): T; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo(x: T, y?: T): T; }): any; (x: { foo(x: T, y?: T): T; }): any; } +>x : { foo(x: T, y?: T): T; } +>a : { foo(x: T, y?: T): T; } + +function foo3(x: any) { } +>foo3 : { (x: { foo(x: T, y?: T): T; }): any; (x: { foo(x: T, y?: T): T; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: (x: T, y?: T) => T; }): any; (x: { foo: (x: T, y?: T) => T; }): any; } +>x : { foo: (x: T, y?: T) => T; } +>b : { foo: (x: T, y?: T) => T; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: (x: T, y?: T) => T; }): any; (x: { foo: (x: T, y?: T) => T; }): any; } +>x : { foo: (x: T, y?: T) => T; } +>b : { foo: (x: T, y?: T) => T; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: (x: T, y?: T) => T; }): any; (x: { foo: (x: T, y?: T) => T; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // ok +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // ok +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo(x: T, y?: T): T; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // no error, bug? +>foo7 : { (x: A): any; (x: { foo(x: T, y?: T): T; }): any; } +>x : { foo(x: T, y?: T): T; } +>a : { foo(x: T, y?: T): T; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo(x: T, y?: T): T; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // error +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo(x: T, y?: T): T; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: { foo(x: T, y?: T): T; }): any; } +>x : { foo(x: T, y?: T): T; } +>a : { foo(x: T, y?: T): T; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo(x: T, y?: T): T; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: (x: T, y?: T) => T; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { foo: (x: T, y?: T) => T; }): any; } +>x : { foo: (x: T, y?: T) => T; } +>b : { foo: (x: T, y?: T) => T; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: (x: T, y?: T) => T; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // error +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo(x: T, y?: T): T; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: { foo(x: T, y?: T): T; }): any; } +>x : { foo(x: T, y?: T): T; } +>a : { foo(x: T, y?: T): T; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo(x: T, y?: T): T; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: (x: T, y?: T) => T; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { foo: (x: T, y?: T) => T; }): any; } +>x : { foo: (x: T, y?: T) => T; } +>b : { foo: (x: T, y?: T) => T; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: (x: T, y?: T) => T; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.types new file mode 100644 index 00000000000..4df74d1bd13 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.types @@ -0,0 +1,365 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts === +// Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those +// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, +// optional or rest) and types, and identical return types. + +class A { +>A : A + + foo(x: T, y?: U): T { return null; } +>foo : (x: T, y?: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T +} + +class B { +>B : B +>T : T +>U : U + + foo(x: T, y?: U): T { return null; } +>foo : (x: T, y?: U) => T +>x : T +>T : T +>y : U +>U : U +>T : T +} + +class C { +>C : C +>T : T +>U : U + + foo(x: T, y?: U): T { return null; } +>foo : (x: T, y?: U) => T +>x : T +>T : T +>y : U +>U : U +>T : T +} + +interface I { +>I : I +>T : T +>U : U + + foo(x: T, y?: U): T; +>foo : (x: T, y?: U) => T +>x : T +>T : T +>y : U +>U : U +>T : T +} + +interface I2 { +>I2 : I2 + + foo(x: T, y?: U): T; +>foo : (x: T, y?: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T +} + +var a: { foo(x: T, y?: U): T } +>a : { foo(x: T, y?: U): T; } +>foo : (x: T, y?: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T + +var b = { foo(x: T, y?: U) { return x; } }; +>b : { foo: (x: T, y?: U) => T; } +>{ foo(x: T, y?: U) { return x; } } : { foo: (x: T, y?: U) => T; } +>foo : (x: T, y?: U) => T +>foo(x: T, y?: U) { return x; } : (x: T, y?: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>x : T + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo(x: T, y?: U): T; }): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : { foo(x: T, y?: U): T; } +>a : { foo(x: T, y?: U): T; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo(x: T, y?: U): T; }): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : { foo(x: T, y?: U): T; } +>a : { foo(x: T, y?: U): T; } + +function foo3(x: any) { } +>foo3 : { (x: { foo(x: T, y?: U): T; }): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: (x: T, y?: U) => T; }): any; (x: { foo: (x: T, y?: U) => T; }): any; } +>x : { foo: (x: T, y?: U) => T; } +>b : { foo: (x: T, y?: U) => T; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: (x: T, y?: U) => T; }): any; (x: { foo: (x: T, y?: U) => T; }): any; } +>x : { foo: (x: T, y?: U) => T; } +>b : { foo: (x: T, y?: U) => T; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: (x: T, y?: U) => T; }): any; (x: { foo: (x: T, y?: U) => T; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // ok +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // ok +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // no error, bug? +>foo7 : { (x: A): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : { foo(x: T, y?: U): T; } +>a : { foo(x: T, y?: U): T; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // error +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : { foo(x: T, y?: U): T; } +>a : { foo(x: T, y?: U): T; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: (x: T, y?: U) => T; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { foo: (x: T, y?: U) => T; }): any; } +>x : { foo: (x: T, y?: U) => T; } +>b : { foo: (x: T, y?: U) => T; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: (x: T, y?: U) => T; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // error +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : { foo(x: T, y?: U): T; } +>a : { foo(x: T, y?: U): T; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: (x: T, y?: U) => T; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { foo: (x: T, y?: U) => T; }): any; } +>x : { foo: (x: T, y?: U) => T; } +>b : { foo: (x: T, y?: U) => T; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: (x: T, y?: U) => T; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.types new file mode 100644 index 00000000000..dd6a97b32ed --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.types @@ -0,0 +1,365 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts === +// Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those +// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, +// optional or rest) and types, and identical return types. + +class A { +>A : A + + foo(x: T, y?: U): T { return null; } +>foo : (x: T, y?: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T +} + +class B { +>B : B +>T : T +>U : U + + foo(x: T, y: U): T { return null; } +>foo : (x: T, y: U) => T +>x : T +>T : T +>y : U +>U : U +>T : T +} + +class C { +>C : C +>T : T +>U : U + + foo(x: T, y?: U): T { return null; } +>foo : (x: T, y?: U) => T +>x : T +>T : T +>y : U +>U : U +>T : T +} + +interface I { +>I : I +>T : T +>U : U + + foo(x: T, y?: U): T; +>foo : (x: T, y?: U) => T +>x : T +>T : T +>y : U +>U : U +>T : T +} + +interface I2 { +>I2 : I2 + + foo(x: T, y: U): T; +>foo : (x: T, y: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T +} + +var a: { foo(x: T, y?: U): T } +>a : { foo(x: T, y?: U): T; } +>foo : (x: T, y?: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T + +var b = { foo(x: T, y: U) { return x; } }; +>b : { foo: (x: T, y: U) => T; } +>{ foo(x: T, y: U) { return x; } } : { foo: (x: T, y: U) => T; } +>foo : (x: T, y: U) => T +>foo(x: T, y: U) { return x; } : (x: T, y: U) => T +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>x : T + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo(x: T, y?: U): T; }): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : { foo(x: T, y?: U): T; } +>a : { foo(x: T, y?: U): T; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo(x: T, y?: U): T; }): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : { foo(x: T, y?: U): T; } +>a : { foo(x: T, y?: U): T; } + +function foo3(x: any) { } +>foo3 : { (x: { foo(x: T, y?: U): T; }): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: (x: T, y: U) => T; }): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : { foo: (x: T, y: U) => T; } +>b : { foo: (x: T, y: U) => T; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: (x: T, y: U) => T; }): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : { foo: (x: T, y: U) => T; } +>b : { foo: (x: T, y: U) => T; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: (x: T, y: U) => T; }): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // ok +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // ok +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // no error, bug? +>foo7 : { (x: A): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : { foo(x: T, y?: U): T; } +>a : { foo(x: T, y?: U): T; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // ok +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // ok +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : { foo(x: T, y?: U): T; } +>a : { foo(x: T, y?: U): T; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : { foo: (x: T, y: U) => T; } +>b : { foo: (x: T, y: U) => T; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // error +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : { foo(x: T, y?: U): T; } +>a : { foo(x: T, y?: U): T; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo(x: T, y?: U): T; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : { foo: (x: T, y: U) => T; } +>b : { foo: (x: T, y: U) => T; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: (x: T, y: U) => T; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.types new file mode 100644 index 00000000000..bafb2a09e09 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.types @@ -0,0 +1,261 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts === +// Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those +// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, +// optional or rest) and types, and identical return types. + +class B> { +>B : B +>T : T +>Array : Array + + constructor(x: T) { return null; } +>x : T +>T : T +} + +class C { +>C : C +>T : T +>String : String + + constructor(x: T) { return null; } +>x : T +>T : T +} + +interface I { +>I : I +>T : T +>Number : Number + + new(x: T): string; +>x : T +>T : T +} + +interface I2 { +>I2 : I2 + + new(x: T): string; +>T : T +>Boolean : Boolean +>x : T +>T : T +} + +var a: { new>(x: T): string } +>a : new (x: T) => string +>T : T +>Array : Array +>x : T +>T : T + +var b = { new(x: T) { return ''; } }; // not a construct signature, function called new +>b : { new: (x: T) => string; } +>{ new(x: T) { return ''; } } : { new: (x: T) => string; } +>new : (x: T) => string +>new(x: T) { return ''; } : (x: T) => string +>T : T +>RegExp : RegExp +>x : T +>T : T + +function foo1b(x: B>); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B +>Array : Array + +function foo1b(x: B>); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B +>Array : Array + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C +>String : String + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C +>String : String + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I +>Number : Number + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I +>Number : Number + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: new (x: T) => string): any; (x: new (x: T) => string): any; } +>x : new (x: T) => string +>a : new (x: T) => string + +function foo3(x: typeof a); // error +>foo3 : { (x: new (x: T) => string): any; (x: new (x: T) => string): any; } +>x : new (x: T) => string +>a : new (x: T) => string + +function foo3(x: any) { } +>foo3 : { (x: new (x: T) => string): any; (x: new (x: T) => string): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { new: (x: T) => string; }): any; (x: { new: (x: T) => string; }): any; } +>x : { new: (x: T) => string; } +>b : { new: (x: T) => string; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { new: (x: T) => string; }): any; (x: { new: (x: T) => string; }): any; } +>x : { new: (x: T) => string; } +>b : { new: (x: T) => string; } + +function foo4(x: any) { } +>foo4 : { (x: { new: (x: T) => string; }): any; (x: { new: (x: T) => string; }): any; } +>x : any + +function foo8(x: B>); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B +>Array : Array + +function foo8(x: I); // ok +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I +>Number : Number + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B>); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B +>Array : Array + +function foo9(x: C); // error, types are structurally equal +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C +>String : String + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B>); +>foo10 : { (x: B): any; (x: new (x: T) => string): any; } +>x : B +>B : B +>Array : Array + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: new (x: T) => string): any; } +>x : new (x: T) => string +>a : new (x: T) => string + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: new (x: T) => string): any; } +>x : any + +function foo11(x: B>); +>foo11 : { (x: B): any; (x: { new: (x: T) => string; }): any; } +>x : B +>B : B +>Array : Array + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { new: (x: T) => string; }): any; } +>x : { new: (x: T) => string; } +>b : { new: (x: T) => string; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { new: (x: T) => string; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I +>Number : Number + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C +>String : String + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C +>String : String + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: new (x: T) => string): any; } +>x : I +>I : I +>Number : Number + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: new (x: T) => string): any; } +>x : new (x: T) => string +>a : new (x: T) => string + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: new (x: T) => string): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { new: (x: T) => string; }): any; } +>x : I +>I : I +>Number : Number + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { new: (x: T) => string; }): any; } +>x : { new: (x: T) => string; } +>b : { new: (x: T) => string; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { new: (x: T) => string; }): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.types new file mode 100644 index 00000000000..cbbad7716dc --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.types @@ -0,0 +1,270 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.ts === +// Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those +// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, +// optional or rest) and types, and identical return types. + +class B { +>B : B +>T : T + + constructor(x: T) { return null; } +>x : T +>T : T +} + +class C { +>C : C +>T : T + + constructor(x: T) { return null; } +>x : T +>T : T +} + +interface I { +>I : I +>T : T + + new(x: T): Date; +>x : T +>T : T +>Date : Date +} + +interface I2 { +>I2 : I2 + + new(x: T): RegExp; +>T : T +>x : T +>T : T +>RegExp : RegExp +} + +var a: { new(x: T): T } +>a : new (x: T) => T +>T : T +>x : T +>T : T +>T : T + +var b = { new(x: T): T { return null; } }; // not a construct signature, function called new +>b : { new: (x: T) => T; } +>{ new(x: T): T { return null; } } : { new: (x: T) => T; } +>new : (x: T) => T +>new(x: T): T { return null; } : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: new (x: T) => T): any; (x: new (x: T) => T): any; } +>x : new (x: T) => T +>a : new (x: T) => T + +function foo3(x: typeof a); // error +>foo3 : { (x: new (x: T) => T): any; (x: new (x: T) => T): any; } +>x : new (x: T) => T +>a : new (x: T) => T + +function foo3(x: any) { } +>foo3 : { (x: new (x: T) => T): any; (x: new (x: T) => T): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { new: (x: T) => T; }): any; (x: { new: (x: T) => T; }): any; } +>x : { new: (x: T) => T; } +>b : { new: (x: T) => T; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { new: (x: T) => T; }): any; (x: { new: (x: T) => T; }): any; } +>x : { new: (x: T) => T; } +>b : { new: (x: T) => T; } + +function foo4(x: any) { } +>foo4 : { (x: { new: (x: T) => T; }): any; (x: { new: (x: T) => T; }): any; } +>x : any + +function foo5(x: typeof a): number; +>foo5 : { (x: new (x: T) => T): number; (x: { new: (x: T) => T; }): string; } +>x : new (x: T) => T +>a : new (x: T) => T + +function foo5(x: typeof b): string; // ok +>foo5 : { (x: new (x: T) => T): number; (x: { new: (x: T) => T; }): string; } +>x : { new: (x: T) => T; } +>b : { new: (x: T) => T; } + +function foo5(x: any): any { } +>foo5 : { (x: new (x: T) => T): number; (x: { new: (x: T) => T; }): string; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // ok +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error since types are structurally equal +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: new (x: T) => T): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: new (x: T) => T): any; } +>x : new (x: T) => T +>a : new (x: T) => T + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: new (x: T) => T): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { new: (x: T) => T; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { new: (x: T) => T; }): any; } +>x : { new: (x: T) => T; } +>b : { new: (x: T) => T; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { new: (x: T) => T; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: new (x: T) => T): any; } +>x : I +>I : I + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: new (x: T) => T): any; } +>x : new (x: T) => T +>a : new (x: T) => T + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: new (x: T) => T): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { new: (x: T) => T; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { new: (x: T) => T; }): any; } +>x : { new: (x: T) => T; } +>b : { new: (x: T) => T; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { new: (x: T) => T; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.types new file mode 100644 index 00000000000..94e8657a63a --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.types @@ -0,0 +1,279 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts === +// Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those +// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, +// optional or rest) and types, and identical return types. + +class B { +>B : B +>T : T +>Date : Date + + constructor(x: T) { return null; } +>x : T +>T : T +} + +class C { +>C : C +>T : T +>Date : Date + + constructor(x: T) { return null; } +>x : T +>T : T +} + +interface I { +>I : I +>T : T +>Date : Date + + new(x: T): Date; +>x : T +>T : T +>Date : Date +} + +interface I2 { +>I2 : I2 + + new(x: T): RegExp; +>T : T +>Date : Date +>x : T +>T : T +>RegExp : RegExp +} + +var a: { new(x: T): T } +>a : new (x: T) => T +>T : T +>Date : Date +>x : T +>T : T +>T : T + +var b = { new(x: T) { return null; } }; // not a construct signature, function called new +>b : { new: (x: T) => any; } +>{ new(x: T) { return null; } } : { new: (x: T) => any; } +>new : (x: T) => any +>new(x: T) { return null; } : (x: T) => any +>T : T +>Date : Date +>x : T +>T : T + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B +>Date : Date + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B +>Date : Date + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C +>Date : Date + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C +>Date : Date + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I +>Date : Date + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I +>Date : Date + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: new (x: T) => T): any; (x: new (x: T) => T): any; } +>x : new (x: T) => T +>a : new (x: T) => T + +function foo3(x: typeof a); // error +>foo3 : { (x: new (x: T) => T): any; (x: new (x: T) => T): any; } +>x : new (x: T) => T +>a : new (x: T) => T + +function foo3(x: any) { } +>foo3 : { (x: new (x: T) => T): any; (x: new (x: T) => T): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { new: (x: T) => any; }): any; (x: { new: (x: T) => any; }): any; } +>x : { new: (x: T) => any; } +>b : { new: (x: T) => any; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { new: (x: T) => any; }): any; (x: { new: (x: T) => any; }): any; } +>x : { new: (x: T) => any; } +>b : { new: (x: T) => any; } + +function foo4(x: any) { } +>foo4 : { (x: { new: (x: T) => any; }): any; (x: { new: (x: T) => any; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B +>Date : Date + +function foo8(x: I); // ok +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I +>Date : Date + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B +>Date : Date + +function foo9(x: C); // error since types are structurally equal +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C +>Date : Date + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: new (x: T) => T): any; } +>x : B +>B : B +>Date : Date + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: new (x: T) => T): any; } +>x : new (x: T) => T +>a : new (x: T) => T + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: new (x: T) => T): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { new: (x: T) => any; }): any; } +>x : B +>B : B +>Date : Date + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { new: (x: T) => any; }): any; } +>x : { new: (x: T) => any; } +>b : { new: (x: T) => any; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { new: (x: T) => any; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I +>Date : Date + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C +>Date : Date + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C +>Date : Date + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: new (x: T) => T): any; } +>x : I +>I : I +>Date : Date + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: new (x: T) => T): any; } +>x : new (x: T) => T +>a : new (x: T) => T + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: new (x: T) => T): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { new: (x: T) => any; }): any; } +>x : I +>I : I +>Date : Date + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { new: (x: T) => any; }): any; } +>x : { new: (x: T) => any; } +>b : { new: (x: T) => any; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { new: (x: T) => any; }): any; } +>x : any + +function foo15(x: I2); +>foo15 : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo15(x: C); // ok +>foo15 : { (x: I2): any; (x: C): any; } +>x : C +>C : C +>Date : Date + +function foo15(x: any) { } +>foo15 : { (x: I2): any; (x: C): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.types new file mode 100644 index 00000000000..b4259c24a52 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.types @@ -0,0 +1,277 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts === +// object types are identical structurally + +class B { +>B : B +>U : U +>V : V + + constructor(x: U) { return null; } +>x : U +>U : U +} + +class C { +>C : C +>V : V +>W : W +>X : X + + constructor(x: V) { return null; } +>x : V +>V : V +} + +interface I { +>I : I +>X : X +>Y : Y +>Z : Z +>A : A + + new(x: X): B; +>x : X +>X : X +>B : B +>X : X +>Y : Y +} + +interface I2 { +>I2 : I2 + + new (x: Y): C; +>Y : Y +>Z : Z +>A : A +>B : B +>x : Y +>Y : Y +>C : C +>Y : Y +>Z : Z +>A : A +} + +var a: { new (x: Z): C; } +>a : new (x: Z) => C +>Z : Z +>A : A +>B : B +>CC : CC +>D : D +>x : Z +>Z : Z +>C : C +>Z : Z +>A : A +>B : B + +var b = { new(x: A) { return x; } }; +>b : { new: (x: A) => A; } +>{ new(x: A) { return x; } } : { new: (x: A) => A; } +>new : (x: A) => A +>new(x: A) { return x; } : (x: A) => A +>A : A +>B : B +>C : C +>D : D +>E : E +>F : F +>x : A +>A : A +>x : A + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: new (x: Z) => C): any; (x: new (x: Z) => C): any; } +>x : new (x: Z) => C +>a : new (x: Z) => C + +function foo3(x: typeof a); // error +>foo3 : { (x: new (x: Z) => C): any; (x: new (x: Z) => C): any; } +>x : new (x: Z) => C +>a : new (x: Z) => C + +function foo3(x: any) { } +>foo3 : { (x: new (x: Z) => C): any; (x: new (x: Z) => C): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { new: (x: A) => A; }): any; (x: { new: (x: A) => A; }): any; } +>x : { new: (x: A) => A; } +>b : { new: (x: A) => A; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { new: (x: A) => A; }): any; (x: { new: (x: A) => A; }): any; } +>x : { new: (x: A) => A; } +>b : { new: (x: A) => A; } + +function foo4(x: any) { } +>foo4 : { (x: { new: (x: A) => A; }): any; (x: { new: (x: A) => A; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // BUG 832086 +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I +>Date : Date + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C>): any; } +>x : B +>B : B + +function foo9(x: C>); // error +>foo9 : { (x: B): any; (x: C>): any; } +>x : C> +>C : C +>B : B + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C>): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: new (x: Z) => C): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: new (x: Z) => C): any; } +>x : new (x: Z) => C +>a : new (x: Z) => C + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: new (x: Z) => C): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { new: (x: A) => A; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { new: (x: A) => A; }): any; } +>x : { new: (x: A) => A; } +>b : { new: (x: A) => A; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { new: (x: A) => A; }): any; } +>x : any + +function foo12(x: I, number, Date, string>); +>foo12 : { (x: I, number, Date, string>): any; (x: C, number, Date>): any; } +>x : I, number, Date, string> +>I : I +>B : B +>Date : Date + +function foo12(x: C, number, Date>); // ok +>foo12 : { (x: I, number, Date, string>): any; (x: C, number, Date>): any; } +>x : C, number, Date> +>C : C +>B : B +>Date : Date + +function foo12(x: any) { } +>foo12 : { (x: I, number, Date, string>): any; (x: C, number, Date>): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // BUG 832086 +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: new (x: Z) => C): any; } +>x : I +>I : I +>Date : Date +>RegExp : RegExp +>Date : Date + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: new (x: Z) => C): any; } +>x : new (x: Z) => C +>a : new (x: Z) => C + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: new (x: Z) => C): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { new: (x: A) => A; }): any; } +>x : I +>I : I +>Date : Date +>RegExp : RegExp + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { new: (x: A) => A; }): any; } +>x : { new: (x: A) => A; } +>b : { new: (x: A) => A; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { new: (x: A) => A; }): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.types new file mode 100644 index 00000000000..39b6f8e3a9f --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.types @@ -0,0 +1,246 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.ts === +// object types are identical structurally + +class B { +>B : B +>U : U + + constructor(x: U) { return null; } +>x : U +>U : U +} + +class C { +>C : C +>V : V + + constructor(x: V) { return null; } +>x : V +>V : V +} + +interface I { +>I : I +>X : X + + new(x: X): B; +>x : X +>X : X +>B : B +>X : X +} + +interface I2 { +>I2 : I2 + + new(x: Y): C; +>Y : Y +>x : Y +>Y : Y +>C : C +>Y : Y +} + +var a: { new(x: Z): B } +>a : new (x: Z) => B +>Z : Z +>x : Z +>Z : Z +>B : B +>Z : Z + +var b = { new(x: A) { return new C(x); } }; +>b : { new: (x: A) => C; } +>{ new(x: A) { return new C(x); } } : { new: (x: A) => C; } +>new : (x: A) => C +>new(x: A) { return new C(x); } : (x: A) => C +>A : A +>x : A +>A : A +>new C(x) : C +>C : typeof C +>A : A +>x : A + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: new (x: Z) => B): any; (x: new (x: Z) => B): any; } +>x : new (x: Z) => B +>a : new (x: Z) => B + +function foo3(x: typeof a); // error +>foo3 : { (x: new (x: Z) => B): any; (x: new (x: Z) => B): any; } +>x : new (x: Z) => B +>a : new (x: Z) => B + +function foo3(x: any) { } +>foo3 : { (x: new (x: Z) => B): any; (x: new (x: Z) => B): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { new: (x: A) => C; }): any; (x: { new: (x: A) => C; }): any; } +>x : { new: (x: A) => C; } +>b : { new: (x: A) => C; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { new: (x: A) => C; }): any; (x: { new: (x: A) => C; }): any; } +>x : { new: (x: A) => C; } +>b : { new: (x: A) => C; } + +function foo4(x: any) { } +>foo4 : { (x: { new: (x: A) => C; }): any; (x: { new: (x: A) => C; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // BUG 832086 +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: new (x: Z) => B): any; } +>x : B +>B : B + +function foo10(x: typeof a); // BUG 832086 +>foo10 : { (x: B): any; (x: new (x: Z) => B): any; } +>x : new (x: Z) => B +>a : new (x: Z) => B + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: new (x: Z) => B): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { new: (x: A) => C; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { new: (x: A) => C; }): any; } +>x : { new: (x: A) => C; } +>b : { new: (x: A) => C; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { new: (x: A) => C; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // error +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // BUG 832086 +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: new (x: Z) => B): any; } +>x : I +>I : I + +function foo13(x: typeof a); // BUG 832086 +>foo13 : { (x: I): any; (x: new (x: Z) => B): any; } +>x : new (x: Z) => B +>a : new (x: Z) => B + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: new (x: Z) => B): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { new: (x: A) => C; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { new: (x: A) => C; }): any; } +>x : { new: (x: A) => C; } +>b : { new: (x: A) => C; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { new: (x: A) => C; }): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.types new file mode 100644 index 00000000000..532a9e9c8a8 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.types @@ -0,0 +1,261 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.ts === +// Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those +// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, +// optional or rest) and types, and identical return types. + +class B { +>B : B +>T : T + + constructor(x: T, y?: T) { return null; } +>x : T +>T : T +>y : T +>T : T +} + +class C { +>C : C +>T : T + + constructor(x: T, y?: T) { return null; } +>x : T +>T : T +>y : T +>T : T +} + +interface I { +>I : I +>T : T + + new(x: T, y?: T): B; +>x : T +>T : T +>y : T +>T : T +>B : B +>T : T +} + +interface I2 { +>I2 : I2 + + new(x: T, y?: T): C; +>T : T +>x : T +>T : T +>y : T +>T : T +>C : C +>T : T +} + +var a: { new(x: T, y?: T): B } +>a : new (x: T, y?: T) => B +>T : T +>x : T +>T : T +>y : T +>T : T +>B : B +>T : T + +var b = { new(x: T, y?: T) { return new C(x, y); } }; // not a construct signature, function called new +>b : { new: (x: T, y?: T) => C; } +>{ new(x: T, y?: T) { return new C(x, y); } } : { new: (x: T, y?: T) => C; } +>new : (x: T, y?: T) => C +>new(x: T, y?: T) { return new C(x, y); } : (x: T, y?: T) => C +>T : T +>x : T +>T : T +>y : T +>T : T +>new C(x, y) : C +>C : typeof C +>T : T +>x : T +>y : T + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: new (x: T, y?: T) => B): any; (x: new (x: T, y?: T) => B): any; } +>x : new (x: T, y?: T) => B +>a : new (x: T, y?: T) => B + +function foo3(x: typeof a); // error +>foo3 : { (x: new (x: T, y?: T) => B): any; (x: new (x: T, y?: T) => B): any; } +>x : new (x: T, y?: T) => B +>a : new (x: T, y?: T) => B + +function foo3(x: any) { } +>foo3 : { (x: new (x: T, y?: T) => B): any; (x: new (x: T, y?: T) => B): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { new: (x: T, y?: T) => C; }): any; (x: { new: (x: T, y?: T) => C; }): any; } +>x : { new: (x: T, y?: T) => C; } +>b : { new: (x: T, y?: T) => C; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { new: (x: T, y?: T) => C; }): any; (x: { new: (x: T, y?: T) => C; }): any; } +>x : { new: (x: T, y?: T) => C; } +>b : { new: (x: T, y?: T) => C; } + +function foo4(x: any) { } +>foo4 : { (x: { new: (x: T, y?: T) => C; }): any; (x: { new: (x: T, y?: T) => C; }): any; } +>x : any + +function foo8(x: B): string; +>foo8 : { (x: B): string; (x: I): number; } +>x : B +>B : B + +function foo8(x: I): number; // BUG 832086 +>foo8 : { (x: B): string; (x: I): number; } +>x : I +>I : I + +function foo8(x: any): any { } +>foo8 : { (x: B): string; (x: I): number; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error, differ only by return type +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: new (x: T, y?: T) => B): any; } +>x : B +>B : B + +function foo10(x: typeof a); // BUG 832086 +>foo10 : { (x: B): any; (x: new (x: T, y?: T) => B): any; } +>x : new (x: T, y?: T) => B +>a : new (x: T, y?: T) => B + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: new (x: T, y?: T) => B): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { new: (x: T, y?: T) => C; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { new: (x: T, y?: T) => C; }): any; } +>x : { new: (x: T, y?: T) => C; } +>b : { new: (x: T, y?: T) => C; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { new: (x: T, y?: T) => C; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // BUG 832086 +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: new (x: T, y?: T) => B): any; } +>x : I +>I : I + +function foo13(x: typeof a); // BUG 832086 +>foo13 : { (x: I): any; (x: new (x: T, y?: T) => B): any; } +>x : new (x: T, y?: T) => B +>a : new (x: T, y?: T) => B + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: new (x: T, y?: T) => B): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { new: (x: T, y?: T) => C; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { new: (x: T, y?: T) => C; }): any; } +>x : { new: (x: T, y?: T) => C; } +>b : { new: (x: T, y?: T) => C; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { new: (x: T, y?: T) => C; }): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.types new file mode 100644 index 00000000000..e7a435a9194 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.types @@ -0,0 +1,271 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.ts === +// Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those +// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, +// optional or rest) and types, and identical return types. + +class B { +>B : B +>T : T +>U : U + + constructor(x: T, y?: U) { return null; } +>x : T +>T : T +>y : U +>U : U +} + +class C { +>C : C +>T : T +>U : U + + constructor(x: T, y?: U) { return null; } +>x : T +>T : T +>y : U +>U : U +} + +interface I { +>I : I +>T : T +>U : U + + new (x: T, y?: U): B; +>x : T +>T : T +>y : U +>U : U +>B : B +>T : T +>U : U +} + +interface I2 { +>I2 : I2 + + new (x: T, y?: U): C; +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>C : C +>T : T +>U : U +} + +var a: { new(x: T, y?: U): B } +>a : new (x: T, y?: U) => B +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>B : B +>T : T +>U : U + +var b = { new(x: T, y?: U) { return new C(x, y); } }; // not a construct signature, function called new +>b : { new: (x: T, y?: U) => C; } +>{ new(x: T, y?: U) { return new C(x, y); } } : { new: (x: T, y?: U) => C; } +>new : (x: T, y?: U) => C +>new(x: T, y?: U) { return new C(x, y); } : (x: T, y?: U) => C +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>new C(x, y) : C +>C : typeof C +>T : T +>U : U +>x : T +>y : U + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: new (x: T, y?: U) => B): any; (x: new (x: T, y?: U) => B): any; } +>x : new (x: T, y?: U) => B +>a : new (x: T, y?: U) => B + +function foo3(x: typeof a); // error +>foo3 : { (x: new (x: T, y?: U) => B): any; (x: new (x: T, y?: U) => B): any; } +>x : new (x: T, y?: U) => B +>a : new (x: T, y?: U) => B + +function foo3(x: any) { } +>foo3 : { (x: new (x: T, y?: U) => B): any; (x: new (x: T, y?: U) => B): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { new: (x: T, y?: U) => C; }): any; (x: { new: (x: T, y?: U) => C; }): any; } +>x : { new: (x: T, y?: U) => C; } +>b : { new: (x: T, y?: U) => C; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { new: (x: T, y?: U) => C; }): any; (x: { new: (x: T, y?: U) => C; }): any; } +>x : { new: (x: T, y?: U) => C; } +>b : { new: (x: T, y?: U) => C; } + +function foo4(x: any) { } +>foo4 : { (x: { new: (x: T, y?: U) => C; }): any; (x: { new: (x: T, y?: U) => C; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // BUG 832086 +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: new (x: T, y?: U) => B): any; } +>x : B +>B : B + +function foo10(x: typeof a); // BUG 832086 +>foo10 : { (x: B): any; (x: new (x: T, y?: U) => B): any; } +>x : new (x: T, y?: U) => B +>a : new (x: T, y?: U) => B + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: new (x: T, y?: U) => B): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { new: (x: T, y?: U) => C; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { new: (x: T, y?: U) => C; }): any; } +>x : { new: (x: T, y?: U) => C; } +>b : { new: (x: T, y?: U) => C; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { new: (x: T, y?: U) => C; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // BUG 832086 +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // ok +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: new (x: T, y?: U) => B): any; } +>x : I +>I : I + +function foo13(x: typeof a); // BUG 832086 +>foo13 : { (x: I): any; (x: new (x: T, y?: U) => B): any; } +>x : new (x: T, y?: U) => B +>a : new (x: T, y?: U) => B + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: new (x: T, y?: U) => B): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { new: (x: T, y?: U) => C; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { new: (x: T, y?: U) => C; }): any; } +>x : { new: (x: T, y?: U) => C; } +>b : { new: (x: T, y?: U) => C; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { new: (x: T, y?: U) => C; }): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.types new file mode 100644 index 00000000000..b8cf86ac003 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.types @@ -0,0 +1,271 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.ts === +// Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those +// parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, +// optional or rest) and types, and identical return types. + +class B { +>B : B +>T : T +>U : U + + constructor(x: T, y: U) { return null; } +>x : T +>T : T +>y : U +>U : U +} + +class C { +>C : C +>T : T +>U : U + + constructor(x: T, y?: U) { return null; } +>x : T +>T : T +>y : U +>U : U +} + +interface I { +>I : I +>T : T +>U : U + + new(x: T, y?: U): B; +>x : T +>T : T +>y : U +>U : U +>B : B +>T : T +>U : U +} + +interface I2 { +>I2 : I2 + + new(x: T, y: U): C; +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>C : C +>T : T +>U : U +} + +var a: { new (x: T, y?: U): B }; +>a : new (x: T, y?: U) => B +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>B : B +>T : T +>U : U + +var b = { new(x: T, y: U) { return new C(x, y); } }; // not a construct signature, function called new +>b : { new: (x: T, y: U) => C; } +>{ new(x: T, y: U) { return new C(x, y); } } : { new: (x: T, y: U) => C; } +>new : (x: T, y: U) => C +>new(x: T, y: U) { return new C(x, y); } : (x: T, y: U) => C +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>new C(x, y) : C +>C : typeof C +>T : T +>U : U +>x : T +>y : U + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: new (x: T, y?: U) => B): any; (x: new (x: T, y?: U) => B): any; } +>x : new (x: T, y?: U) => B +>a : new (x: T, y?: U) => B + +function foo3(x: typeof a); // error +>foo3 : { (x: new (x: T, y?: U) => B): any; (x: new (x: T, y?: U) => B): any; } +>x : new (x: T, y?: U) => B +>a : new (x: T, y?: U) => B + +function foo3(x: any) { } +>foo3 : { (x: new (x: T, y?: U) => B): any; (x: new (x: T, y?: U) => B): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { new: (x: T, y: U) => C; }): any; (x: { new: (x: T, y: U) => C; }): any; } +>x : { new: (x: T, y: U) => C; } +>b : { new: (x: T, y: U) => C; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { new: (x: T, y: U) => C; }): any; (x: { new: (x: T, y: U) => C; }): any; } +>x : { new: (x: T, y: U) => C; } +>b : { new: (x: T, y: U) => C; } + +function foo4(x: any) { } +>foo4 : { (x: { new: (x: T, y: U) => C; }): any; (x: { new: (x: T, y: U) => C; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // BUG 832086 +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error, differ only by return type +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: new (x: T, y?: U) => B): any; } +>x : B +>B : B + +function foo10(x: typeof a); // BUG 832086 +>foo10 : { (x: B): any; (x: new (x: T, y?: U) => B): any; } +>x : new (x: T, y?: U) => B +>a : new (x: T, y?: U) => B + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: new (x: T, y?: U) => B): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { new: (x: T, y: U) => C; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { new: (x: T, y: U) => C; }): any; } +>x : { new: (x: T, y: U) => C; } +>b : { new: (x: T, y: U) => C; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { new: (x: T, y: U) => C; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo12b(x: I2); +>foo12b : { (x: I2): any; (x: C): any; } +>x : I2 +>I2 : I2 + +function foo12b(x: C); // BUG 832086 +>foo12b : { (x: I2): any; (x: C): any; } +>x : C +>C : C + +function foo12b(x: any) { } +>foo12b : { (x: I2): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: new (x: T, y?: U) => B): any; } +>x : I +>I : I + +function foo13(x: typeof a); // BUG 832086 +>foo13 : { (x: I): any; (x: new (x: T, y?: U) => B): any; } +>x : new (x: T, y?: U) => B +>a : new (x: T, y?: U) => B + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: new (x: T, y?: U) => B): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { new: (x: T, y: U) => C; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { new: (x: T, y: U) => C; }): any; } +>x : { new: (x: T, y: U) => C; } +>b : { new: (x: T, y: U) => C; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { new: (x: T, y: U) => C; }): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.types b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.types new file mode 100644 index 00000000000..3524cc78f76 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.types @@ -0,0 +1,378 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers1.ts === +// object types are identical structurally + +class A { +>A : A + + [x: number]: string; +>x : number +} + +class B { +>B : B + + [x: number]: string; +>x : number +} + +class C { +>C : C +>T : T + + [x: number]: T; +>x : number +>T : T +} + +interface I { +>I : I + + [x: number]: string; +>x : number +} + +class PA extends A { +>PA : PA +>A : A +} + +class PB extends B { +>PB : PB +>B : B +} + +var a: { +>a : { [x: number]: string; } + + [x: number]: string; +>x : number +} +var b: { [x: number]: string; } = { foo: '' }; +>b : { [x: number]: string; } +>x : number +>{ foo: '' } : { [x: number]: string; foo: string; } +>foo : string + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { [x: number]: string; }): any; (x: { [x: number]: string; }): any; } +>x : { [x: number]: string; } +>a : { [x: number]: string; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { [x: number]: string; }): any; (x: { [x: number]: string; }): any; } +>x : { [x: number]: string; } +>a : { [x: number]: string; } + +function foo3(x: any) { } +>foo3 : { (x: { [x: number]: string; }): any; (x: { [x: number]: string; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { [x: number]: string; }): any; (x: { [x: number]: string; }): any; } +>x : { [x: number]: string; } +>b : { [x: number]: string; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { [x: number]: string; }): any; (x: { [x: number]: string; }): any; } +>x : { [x: number]: string; } +>b : { [x: number]: string; } + +function foo4(x: any) { } +>foo4 : { (x: { [x: number]: string; }): any; (x: { [x: number]: string; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // error +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // error +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo5c(x: A); +>foo5c : { (x: A): any; (x: PA): any; } +>x : A +>A : A + +function foo5c(x: PA); // error +>foo5c : { (x: A): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo5c(x: any) { } +>foo5c : { (x: A): any; (x: PA): any; } +>x : any + +function foo5d(x: A); +>foo5d : { (x: A): any; (x: PB): any; } +>x : A +>A : A + +function foo5d(x: PB); // error +>foo5d : { (x: A): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo5d(x: any) { } +>foo5d : { (x: A): any; (x: PB): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // error +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { [x: number]: string; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // error +>foo7 : { (x: A): any; (x: { [x: number]: string; }): any; } +>x : { [x: number]: string; } +>a : { [x: number]: string; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { [x: number]: string; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // error +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { [x: number]: string; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // error +>foo10 : { (x: B): any; (x: { [x: number]: string; }): any; } +>x : { [x: number]: string; } +>a : { [x: number]: string; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { [x: number]: string; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { [x: number]: string; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // error +>foo11 : { (x: B): any; (x: { [x: number]: string; }): any; } +>x : { [x: number]: string; } +>b : { [x: number]: string; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { [x: number]: string; }): any; } +>x : any + +function foo11b(x: B); +>foo11b : { (x: B): any; (x: PA): any; } +>x : B +>B : B + +function foo11b(x: PA); // error +>foo11b : { (x: B): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo11b(x: any) { } +>foo11b : { (x: B): any; (x: PA): any; } +>x : any + +function foo11c(x: B); +>foo11c : { (x: B): any; (x: PB): any; } +>x : B +>B : B + +function foo11c(x: PB); // error +>foo11c : { (x: B): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo11c(x: any) { } +>foo11c : { (x: B): any; (x: PB): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // error +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { [x: number]: string; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // error +>foo13 : { (x: I): any; (x: { [x: number]: string; }): any; } +>x : { [x: number]: string; } +>a : { [x: number]: string; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { [x: number]: string; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { [x: number]: string; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // error +>foo14 : { (x: I): any; (x: { [x: number]: string; }): any; } +>x : { [x: number]: string; } +>b : { [x: number]: string; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { [x: number]: string; }): any; } +>x : any + +function foo15(x: I); +>foo15 : { (x: I): any; (x: PA): any; } +>x : I +>I : I + +function foo15(x: PA); // error +>foo15 : { (x: I): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo15(x: any) { } +>foo15 : { (x: I): any; (x: PA): any; } +>x : any + +function foo16(x: I); +>foo16 : { (x: I): any; (x: PB): any; } +>x : I +>I : I + +function foo16(x: PB); // error +>foo16 : { (x: I): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo16(x: any) { } +>foo16 : { (x: I): any; (x: PB): any; } +>x : any + + diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.types b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.types new file mode 100644 index 00000000000..e8bc9e5037b --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.types @@ -0,0 +1,397 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers2.ts === +// object types are identical structurally + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class A { +>A : A + + [x: number]: Base; +>x : number +>Base : Base +} + +class B { +>B : B + + [x: number]: Derived; +>x : number +>Derived : Derived +} + +class C { +>C : C +>T : T + + [x: number]: T; +>x : number +>T : T +} + +interface I { +>I : I + + [x: number]: Derived; +>x : number +>Derived : Derived +} + +class PA extends A { +>PA : PA +>A : A +} + +class PB extends B { +>PB : PB +>B : B +} + +var a: { +>a : { [x: number]: Base; } + + [x: number]: Base; +>x : number +>Base : Base +} +var b: { [x: number]: Derived; } = { foo: null }; +>b : { [x: number]: Derived; } +>x : number +>Derived : Derived +>{ foo: null } : { [x: number]: Derived; foo: Derived; } +>foo : Derived +>null : Derived +>Derived : Derived + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { [x: number]: Base; }): any; (x: { [x: number]: Base; }): any; } +>x : { [x: number]: Base; } +>a : { [x: number]: Base; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { [x: number]: Base; }): any; (x: { [x: number]: Base; }): any; } +>x : { [x: number]: Base; } +>a : { [x: number]: Base; } + +function foo3(x: any) { } +>foo3 : { (x: { [x: number]: Base; }): any; (x: { [x: number]: Base; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { [x: number]: Derived; }): any; (x: { [x: number]: Derived; }): any; } +>x : { [x: number]: Derived; } +>b : { [x: number]: Derived; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { [x: number]: Derived; }): any; (x: { [x: number]: Derived; }): any; } +>x : { [x: number]: Derived; } +>b : { [x: number]: Derived; } + +function foo4(x: any) { } +>foo4 : { (x: { [x: number]: Derived; }): any; (x: { [x: number]: Derived; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // ok +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // ok +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C +>Derived : Derived + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo5c(x: A); +>foo5c : { (x: A): any; (x: PA): any; } +>x : A +>A : A + +function foo5c(x: PA); // error +>foo5c : { (x: A): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo5c(x: any) { } +>foo5c : { (x: A): any; (x: PA): any; } +>x : any + +function foo5d(x: A); +>foo5d : { (x: A): any; (x: PB): any; } +>x : A +>A : A + +function foo5d(x: PB); // ok +>foo5d : { (x: A): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo5d(x: any) { } +>foo5d : { (x: A): any; (x: PB): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { [x: number]: Base; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // error +>foo7 : { (x: A): any; (x: { [x: number]: Base; }): any; } +>x : { [x: number]: Base; } +>a : { [x: number]: Base; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { [x: number]: Base; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // error +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // ok +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C +>Base : Base + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { [x: number]: Base; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: { [x: number]: Base; }): any; } +>x : { [x: number]: Base; } +>a : { [x: number]: Base; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { [x: number]: Base; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { [x: number]: Derived; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // error +>foo11 : { (x: B): any; (x: { [x: number]: Derived; }): any; } +>x : { [x: number]: Derived; } +>b : { [x: number]: Derived; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { [x: number]: Derived; }): any; } +>x : any + +function foo11b(x: B); +>foo11b : { (x: B): any; (x: PA): any; } +>x : B +>B : B + +function foo11b(x: PA); // ok +>foo11b : { (x: B): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo11b(x: any) { } +>foo11b : { (x: B): any; (x: PA): any; } +>x : any + +function foo11c(x: B); +>foo11c : { (x: B): any; (x: PB): any; } +>x : B +>B : B + +function foo11c(x: PB); // error +>foo11c : { (x: B): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo11c(x: any) { } +>foo11c : { (x: B): any; (x: PB): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // error +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C +>Derived : Derived + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { [x: number]: Base; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: { [x: number]: Base; }): any; } +>x : { [x: number]: Base; } +>a : { [x: number]: Base; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { [x: number]: Base; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { [x: number]: Derived; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // error +>foo14 : { (x: I): any; (x: { [x: number]: Derived; }): any; } +>x : { [x: number]: Derived; } +>b : { [x: number]: Derived; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { [x: number]: Derived; }): any; } +>x : any + +function foo15(x: I); +>foo15 : { (x: I): any; (x: PA): any; } +>x : I +>I : I + +function foo15(x: PA); // ok +>foo15 : { (x: I): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo15(x: any) { } +>foo15 : { (x: I): any; (x: PA): any; } +>x : any + +function foo16(x: I); +>foo16 : { (x: I): any; (x: PB): any; } +>x : I +>I : I + +function foo16(x: PB); // error +>foo16 : { (x: I): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo16(x: any) { } +>foo16 : { (x: I): any; (x: PB): any; } +>x : any + + diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.types b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.types new file mode 100644 index 00000000000..9c2851d405c --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.types @@ -0,0 +1,378 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers3.ts === +// object types are identical structurally + +class A { +>A : A + + [x: number]: string; +>x : number +} + +class B { +>B : B + + [x: string]: string; +>x : string +} + +class C { +>C : C +>T : T + + [x: number]: T; +>x : number +>T : T +} + +interface I { +>I : I + + [x: string]: string; +>x : string +} + +class PA extends A { +>PA : PA +>A : A +} + +class PB extends B { +>PB : PB +>B : B +} + +var a: { +>a : { [x: string]: string; } + + [x: string]: string; +>x : string +} +var b: { [x: number]: string; } = { foo: '' }; +>b : { [x: number]: string; } +>x : number +>{ foo: '' } : { [x: number]: string; foo: string; } +>foo : string + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { [x: string]: string; }): any; (x: { [x: string]: string; }): any; } +>x : { [x: string]: string; } +>a : { [x: string]: string; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { [x: string]: string; }): any; (x: { [x: string]: string; }): any; } +>x : { [x: string]: string; } +>a : { [x: string]: string; } + +function foo3(x: any) { } +>foo3 : { (x: { [x: string]: string; }): any; (x: { [x: string]: string; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { [x: number]: string; }): any; (x: { [x: number]: string; }): any; } +>x : { [x: number]: string; } +>b : { [x: number]: string; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { [x: number]: string; }): any; (x: { [x: number]: string; }): any; } +>x : { [x: number]: string; } +>b : { [x: number]: string; } + +function foo4(x: any) { } +>foo4 : { (x: { [x: number]: string; }): any; (x: { [x: number]: string; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // ok +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // error +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo5c(x: A); +>foo5c : { (x: A): any; (x: PA): any; } +>x : A +>A : A + +function foo5c(x: PA); // error +>foo5c : { (x: A): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo5c(x: any) { } +>foo5c : { (x: A): any; (x: PA): any; } +>x : any + +function foo5d(x: A); +>foo5d : { (x: A): any; (x: PB): any; } +>x : A +>A : A + +function foo5d(x: PB); // ok +>foo5d : { (x: A): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo5d(x: any) { } +>foo5d : { (x: A): any; (x: PB): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { [x: string]: string; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // ok +>foo7 : { (x: A): any; (x: { [x: string]: string; }): any; } +>x : { [x: string]: string; } +>a : { [x: string]: string; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { [x: string]: string; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // error +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // ok +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { [x: string]: string; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // error +>foo10 : { (x: B): any; (x: { [x: string]: string; }): any; } +>x : { [x: string]: string; } +>a : { [x: string]: string; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { [x: string]: string; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { [x: number]: string; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // ok +>foo11 : { (x: B): any; (x: { [x: number]: string; }): any; } +>x : { [x: number]: string; } +>b : { [x: number]: string; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { [x: number]: string; }): any; } +>x : any + +function foo11b(x: B); +>foo11b : { (x: B): any; (x: PA): any; } +>x : B +>B : B + +function foo11b(x: PA); // ok +>foo11b : { (x: B): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo11b(x: any) { } +>foo11b : { (x: B): any; (x: PA): any; } +>x : any + +function foo11c(x: B); +>foo11c : { (x: B): any; (x: PB): any; } +>x : B +>B : B + +function foo11c(x: PB); // error +>foo11c : { (x: B): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo11c(x: any) { } +>foo11c : { (x: B): any; (x: PB): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { [x: string]: string; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // error +>foo13 : { (x: I): any; (x: { [x: string]: string; }): any; } +>x : { [x: string]: string; } +>a : { [x: string]: string; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { [x: string]: string; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { [x: number]: string; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { [x: number]: string; }): any; } +>x : { [x: number]: string; } +>b : { [x: number]: string; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { [x: number]: string; }): any; } +>x : any + +function foo15(x: I); +>foo15 : { (x: I): any; (x: PA): any; } +>x : I +>I : I + +function foo15(x: PA); // ok +>foo15 : { (x: I): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo15(x: any) { } +>foo15 : { (x: I): any; (x: PA): any; } +>x : any + +function foo16(x: I); +>foo16 : { (x: I): any; (x: PB): any; } +>x : I +>I : I + +function foo16(x: PB); // error +>foo16 : { (x: I): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo16(x: any) { } +>foo16 : { (x: I): any; (x: PB): any; } +>x : any + + diff --git a/tests/baselines/reference/objectTypesIdentityWithOptionality.types b/tests/baselines/reference/objectTypesIdentityWithOptionality.types new file mode 100644 index 00000000000..5cd444c9675 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithOptionality.types @@ -0,0 +1,168 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithOptionality.ts === +// object types are identical structurally + +class A { +>A : A + + foo: string; +>foo : string +} + +class B { +>B : B + + foo: string; +>foo : string +} + +class C { +>C : C +>T : T + + foo: T; +>foo : T +>T : T +} + +interface I { +>I : I + + foo?: string; +>foo : string +} + +var a: { foo?: string; } +>a : { foo?: string; } +>foo : string + +var b = { foo: '' }; +>b : { foo: string; } +>{ foo: '' } : { foo: string; } +>foo : string + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo?: string; }): any; (x: { foo?: string; }): any; } +>x : { foo?: string; } +>a : { foo?: string; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo?: string; }): any; (x: { foo?: string; }): any; } +>x : { foo?: string; } +>a : { foo?: string; } + +function foo3(x: any) { } +>foo3 : { (x: { foo?: string; }): any; (x: { foo?: string; }): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo?: string; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // ok +>foo7 : { (x: A): any; (x: { foo?: string; }): any; } +>x : { foo?: string; } +>a : { foo?: string; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo?: string; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // ok +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo?: string; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: { foo?: string; }): any; } +>x : { foo?: string; } +>a : { foo?: string; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo?: string; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // ok +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo?: string; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // error +>foo13 : { (x: I): any; (x: { foo?: string; }): any; } +>x : { foo?: string; } +>a : { foo?: string; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo?: string; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: string; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // ok +>foo14 : { (x: I): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>b : { foo: string; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: string; }): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates.types b/tests/baselines/reference/objectTypesIdentityWithPrivates.types new file mode 100644 index 00000000000..a9b6650fbfe --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates.types @@ -0,0 +1,375 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates.ts === +// object types are identical structurally + +class A { +>A : A + + private foo: string; +>foo : string +} + +class B { +>B : B + + private foo: string; +>foo : string +} + +class C { +>C : C +>T : T + + private foo: T; +>foo : T +>T : T +} + +interface I { +>I : I + + foo: string; +>foo : string +} + +class PA extends A { +>PA : PA +>A : A +} + +class PB extends B { +>PB : PB +>B : B +} + +var a: { foo: string; } +>a : { foo: string; } +>foo : string + +var b = { foo: '' }; +>b : { foo: string; } +>{ foo: '' } : { foo: string; } +>foo : string + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>a : { foo: string; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>a : { foo: string; } + +function foo3(x: any) { } +>foo3 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>b : { foo: string; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>b : { foo: string; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // no error +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // no error +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo5c(x: A); +>foo5c : { (x: A): any; (x: PA): any; } +>x : A +>A : A + +function foo5c(x: PA); // error +>foo5c : { (x: A): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo5c(x: any) { } +>foo5c : { (x: A): any; (x: PA): any; } +>x : any + +function foo5d(x: A); +>foo5d : { (x: A): any; (x: PB): any; } +>x : A +>A : A + +function foo5d(x: PB); // no error +>foo5d : { (x: A): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo5d(x: any) { } +>foo5d : { (x: A): any; (x: PB): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // no error +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo: string; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // no error +>foo7 : { (x: A): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>a : { foo: string; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo: string; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // no error +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // no error +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo: string; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // no error +>foo10 : { (x: B): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>a : { foo: string; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo: string; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: string; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // no error +>foo11 : { (x: B): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>b : { foo: string; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: string; }): any; } +>x : any + +function foo11b(x: B); +>foo11b : { (x: B): any; (x: PA): any; } +>x : B +>B : B + +function foo11b(x: PA); // no error +>foo11b : { (x: B): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo11b(x: any) { } +>foo11b : { (x: B): any; (x: PA): any; } +>x : any + +function foo11c(x: B); +>foo11c : { (x: B): any; (x: PB): any; } +>x : B +>B : B + +function foo11c(x: PB); // error +>foo11c : { (x: B): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo11c(x: any) { } +>foo11c : { (x: B): any; (x: PB): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // no error +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo: string; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // error +>foo13 : { (x: I): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>a : { foo: string; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo: string; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: string; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // error +>foo14 : { (x: I): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>b : { foo: string; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: string; }): any; } +>x : any + +function foo15(x: I); +>foo15 : { (x: I): any; (x: PA): any; } +>x : I +>I : I + +function foo15(x: PA); // no error +>foo15 : { (x: I): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo15(x: any) { } +>foo15 : { (x: I): any; (x: PA): any; } +>x : any + +function foo16(x: I); +>foo16 : { (x: I): any; (x: PB): any; } +>x : I +>I : I + +function foo16(x: PB); // no error +>foo16 : { (x: I): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo16(x: any) { } +>foo16 : { (x: I): any; (x: PB): any; } +>x : any + + diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates2.types b/tests/baselines/reference/objectTypesIdentityWithPrivates2.types new file mode 100644 index 00000000000..95b5b06e056 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates2.types @@ -0,0 +1,119 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates2.ts === +// object types are identical structurally + +class C { +>C : C +>T : T + + private foo: T; +>foo : T +>T : T +} + +class D extends C { +>D : D +>T : T +>C : C +>T : T +} + +function foo1(x: C); +>foo1 : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1(x: C); // ok +>foo1 : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1(x: any) { } +>foo1 : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: D); +>foo2 : { (x: D): any; (x: D): any; } +>x : D +>D : D + +function foo2(x: D); // ok +>foo2 : { (x: D): any; (x: D): any; } +>x : D +>D : D + +function foo2(x: any) { } +>foo2 : { (x: D): any; (x: D): any; } +>x : any + +function foo3(x: C); +>foo3 : { (x: C): any; (x: D): any; } +>x : C +>C : C + +function foo3(x: D); // ok +>foo3 : { (x: C): any; (x: D): any; } +>x : D +>D : D + +function foo3(x: any) { } +>foo3 : { (x: C): any; (x: D): any; } +>x : any + +function foo4(x: C): number; +>foo4 : { (x: C): number; (x: D): string; } +>x : C +>C : C + +function foo4(x: D): string; // BUG 831926 +>foo4 : { (x: C): number; (x: D): string; } +>x : D +>D : D + +function foo4(x: any): any { } +>foo4 : { (x: C): number; (x: D): string; } +>x : any + +var r = foo4(new C()); +>r : number +>foo4(new C()) : number +>foo4 : { (x: C): number; (x: D): string; } +>new C() : C +>C : typeof C + +var r = foo4(new D()); +>r : number +>foo4(new D()) : number +>foo4 : { (x: C): number; (x: D): string; } +>new D() : D +>D : typeof D + +function foo5(x: C): number; +>foo5 : { (x: C): number; (x: C): string; } +>x : C +>C : C + +function foo5(x: C): string; // error +>foo5 : { (x: C): number; (x: C): string; } +>x : C +>C : C + +function foo5(x: any): any { } +>foo5 : { (x: C): number; (x: C): string; } +>x : any + +function foo6(x: D): number; +>foo6 : { (x: D): number; (x: D): string; } +>x : D +>D : D + +function foo6(x: D): string; // error +>foo6 : { (x: D): number; (x: D): string; } +>x : D +>D : D + +function foo6(x: any): any { } +>foo6 : { (x: D): number; (x: D): string; } +>x : any + + + diff --git a/tests/baselines/reference/objectTypesIdentityWithPublics.types b/tests/baselines/reference/objectTypesIdentityWithPublics.types new file mode 100644 index 00000000000..dcb53a0c419 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithPublics.types @@ -0,0 +1,280 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPublics.ts === +// object types are identical structurally + +class A { +>A : A + + public foo: string; +>foo : string +} + +class B { +>B : B + + public foo: string; +>foo : string +} + +class C { +>C : C +>T : T + + public foo: T; +>foo : T +>T : T +} + +interface I { +>I : I + + foo: string; +>foo : string +} + +var a: { foo: string; } +>a : { foo: string; } +>foo : string + +var b = { foo: '' }; +>b : { foo: string; } +>{ foo: '' } : { foo: string; } +>foo : string + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>a : { foo: string; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>a : { foo: string; } + +function foo3(x: any) { } +>foo3 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>b : { foo: string; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>b : { foo: string; } + +function foo4(x: any) { } +>foo4 : { (x: { foo: string; }): any; (x: { foo: string; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // error +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // error +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // error +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { foo: string; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // error +>foo7 : { (x: A): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>a : { foo: string; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { foo: string; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // error +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { foo: string; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // error +>foo10 : { (x: B): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>a : { foo: string; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { foo: string; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { foo: string; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // error +>foo11 : { (x: B): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>b : { foo: string; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { foo: string; }): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // error +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { foo: string; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // error +>foo13 : { (x: I): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>a : { foo: string; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { foo: string; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { foo: string; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // error +>foo14 : { (x: I): any; (x: { foo: string; }): any; } +>x : { foo: string; } +>b : { foo: string; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { foo: string; }): any; } +>x : any + diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.types b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.types new file mode 100644 index 00000000000..c4613c0b62f --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.types @@ -0,0 +1,378 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithStringIndexers.ts === +// object types are identical structurally + +class A { +>A : A + + [x: string]: string; +>x : string +} + +class B { +>B : B + + [x: string]: string; +>x : string +} + +class C { +>C : C +>T : T + + [x: string]: T; +>x : string +>T : T +} + +interface I { +>I : I + + [x: string]: string; +>x : string +} + +class PA extends A { +>PA : PA +>A : A +} + +class PB extends B { +>PB : PB +>B : B +} + +var a: { +>a : { [x: string]: string; } + + [x: string]: string; +>x : string +} +var b: { [x: string]: string; } = { foo: '' }; +>b : { [x: string]: string; } +>x : string +>{ foo: '' } : { [x: string]: string; foo: string; } +>foo : string + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { [x: string]: string; }): any; (x: { [x: string]: string; }): any; } +>x : { [x: string]: string; } +>a : { [x: string]: string; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { [x: string]: string; }): any; (x: { [x: string]: string; }): any; } +>x : { [x: string]: string; } +>a : { [x: string]: string; } + +function foo3(x: any) { } +>foo3 : { (x: { [x: string]: string; }): any; (x: { [x: string]: string; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { [x: string]: string; }): any; (x: { [x: string]: string; }): any; } +>x : { [x: string]: string; } +>b : { [x: string]: string; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { [x: string]: string; }): any; (x: { [x: string]: string; }): any; } +>x : { [x: string]: string; } +>b : { [x: string]: string; } + +function foo4(x: any) { } +>foo4 : { (x: { [x: string]: string; }): any; (x: { [x: string]: string; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // error +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // error +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo5c(x: A); +>foo5c : { (x: A): any; (x: PA): any; } +>x : A +>A : A + +function foo5c(x: PA); // error +>foo5c : { (x: A): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo5c(x: any) { } +>foo5c : { (x: A): any; (x: PA): any; } +>x : any + +function foo5d(x: A); +>foo5d : { (x: A): any; (x: PB): any; } +>x : A +>A : A + +function foo5d(x: PB); // error +>foo5d : { (x: A): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo5d(x: any) { } +>foo5d : { (x: A): any; (x: PB): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // error +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { [x: string]: string; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // error +>foo7 : { (x: A): any; (x: { [x: string]: string; }): any; } +>x : { [x: string]: string; } +>a : { [x: string]: string; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { [x: string]: string; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // error +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // error +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { [x: string]: string; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // error +>foo10 : { (x: B): any; (x: { [x: string]: string; }): any; } +>x : { [x: string]: string; } +>a : { [x: string]: string; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { [x: string]: string; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { [x: string]: string; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // error +>foo11 : { (x: B): any; (x: { [x: string]: string; }): any; } +>x : { [x: string]: string; } +>b : { [x: string]: string; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { [x: string]: string; }): any; } +>x : any + +function foo11b(x: B); +>foo11b : { (x: B): any; (x: PA): any; } +>x : B +>B : B + +function foo11b(x: PA); // error +>foo11b : { (x: B): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo11b(x: any) { } +>foo11b : { (x: B): any; (x: PA): any; } +>x : any + +function foo11c(x: B); +>foo11c : { (x: B): any; (x: PB): any; } +>x : B +>B : B + +function foo11c(x: PB); // error +>foo11c : { (x: B): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo11c(x: any) { } +>foo11c : { (x: B): any; (x: PB): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // error +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { [x: string]: string; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // error +>foo13 : { (x: I): any; (x: { [x: string]: string; }): any; } +>x : { [x: string]: string; } +>a : { [x: string]: string; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { [x: string]: string; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { [x: string]: string; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // error +>foo14 : { (x: I): any; (x: { [x: string]: string; }): any; } +>x : { [x: string]: string; } +>b : { [x: string]: string; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { [x: string]: string; }): any; } +>x : any + +function foo15(x: I); +>foo15 : { (x: I): any; (x: PA): any; } +>x : I +>I : I + +function foo15(x: PA); // error +>foo15 : { (x: I): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo15(x: any) { } +>foo15 : { (x: I): any; (x: PA): any; } +>x : any + +function foo16(x: I); +>foo16 : { (x: I): any; (x: PB): any; } +>x : I +>I : I + +function foo16(x: PB); // error +>foo16 : { (x: I): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo16(x: any) { } +>foo16 : { (x: I): any; (x: PB): any; } +>x : any + + diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.types b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.types new file mode 100644 index 00000000000..90f9d5acef8 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.types @@ -0,0 +1,397 @@ +=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithStringIndexers2.ts === +// object types are identical structurally + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class A { +>A : A + + [x: string]: Base; +>x : string +>Base : Base +} + +class B { +>B : B + + [x: string]: Derived; +>x : string +>Derived : Derived +} + +class C { +>C : C +>T : T + + [x: string]: T; +>x : string +>T : T +} + +interface I { +>I : I + + [x: string]: Derived; +>x : string +>Derived : Derived +} + +class PA extends A { +>PA : PA +>A : A +} + +class PB extends B { +>PB : PB +>B : B +} + +var a: { +>a : { [x: string]: Base; } + + [x: string]: Base; +>x : string +>Base : Base +} +var b: { [x: string]: Derived; } = { foo: null }; +>b : { [x: string]: Derived; } +>x : string +>Derived : Derived +>{ foo: null } : { [x: string]: Derived; foo: Derived; } +>foo : Derived +>null : Derived +>Derived : Derived + +function foo1(x: A); +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: A); // error +>foo1 : { (x: A): any; (x: A): any; } +>x : A +>A : A + +function foo1(x: any) { } +>foo1 : { (x: A): any; (x: A): any; } +>x : any + +function foo1b(x: B); +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: B); // error +>foo1b : { (x: B): any; (x: B): any; } +>x : B +>B : B + +function foo1b(x: any) { } +>foo1b : { (x: B): any; (x: B): any; } +>x : any + +function foo1c(x: C); +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: C); // error +>foo1c : { (x: C): any; (x: C): any; } +>x : C +>C : C + +function foo1c(x: any) { } +>foo1c : { (x: C): any; (x: C): any; } +>x : any + +function foo2(x: I); +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: I); // error +>foo2 : { (x: I): any; (x: I): any; } +>x : I +>I : I + +function foo2(x: any) { } +>foo2 : { (x: I): any; (x: I): any; } +>x : any + +function foo3(x: typeof a); +>foo3 : { (x: { [x: string]: Base; }): any; (x: { [x: string]: Base; }): any; } +>x : { [x: string]: Base; } +>a : { [x: string]: Base; } + +function foo3(x: typeof a); // error +>foo3 : { (x: { [x: string]: Base; }): any; (x: { [x: string]: Base; }): any; } +>x : { [x: string]: Base; } +>a : { [x: string]: Base; } + +function foo3(x: any) { } +>foo3 : { (x: { [x: string]: Base; }): any; (x: { [x: string]: Base; }): any; } +>x : any + +function foo4(x: typeof b); +>foo4 : { (x: { [x: string]: Derived; }): any; (x: { [x: string]: Derived; }): any; } +>x : { [x: string]: Derived; } +>b : { [x: string]: Derived; } + +function foo4(x: typeof b); // error +>foo4 : { (x: { [x: string]: Derived; }): any; (x: { [x: string]: Derived; }): any; } +>x : { [x: string]: Derived; } +>b : { [x: string]: Derived; } + +function foo4(x: any) { } +>foo4 : { (x: { [x: string]: Derived; }): any; (x: { [x: string]: Derived; }): any; } +>x : any + +function foo5(x: A); +>foo5 : { (x: A): any; (x: B): any; } +>x : A +>A : A + +function foo5(x: B); // ok +>foo5 : { (x: A): any; (x: B): any; } +>x : B +>B : B + +function foo5(x: any) { } +>foo5 : { (x: A): any; (x: B): any; } +>x : any + +function foo5b(x: A); +>foo5b : { (x: A): any; (x: C): any; } +>x : A +>A : A + +function foo5b(x: C); // ok +>foo5b : { (x: A): any; (x: C): any; } +>x : C +>C : C +>Derived : Derived + +function foo5b(x: any) { } +>foo5b : { (x: A): any; (x: C): any; } +>x : any + +function foo5c(x: A); +>foo5c : { (x: A): any; (x: PA): any; } +>x : A +>A : A + +function foo5c(x: PA); // error +>foo5c : { (x: A): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo5c(x: any) { } +>foo5c : { (x: A): any; (x: PA): any; } +>x : any + +function foo5d(x: A); +>foo5d : { (x: A): any; (x: PB): any; } +>x : A +>A : A + +function foo5d(x: PB); // ok +>foo5d : { (x: A): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo5d(x: any) { } +>foo5d : { (x: A): any; (x: PB): any; } +>x : any + +function foo6(x: A); +>foo6 : { (x: A): any; (x: I): any; } +>x : A +>A : A + +function foo6(x: I); // ok +>foo6 : { (x: A): any; (x: I): any; } +>x : I +>I : I + +function foo6(x: any) { } +>foo6 : { (x: A): any; (x: I): any; } +>x : any + +function foo7(x: A); +>foo7 : { (x: A): any; (x: { [x: string]: Base; }): any; } +>x : A +>A : A + +function foo7(x: typeof a); // error +>foo7 : { (x: A): any; (x: { [x: string]: Base; }): any; } +>x : { [x: string]: Base; } +>a : { [x: string]: Base; } + +function foo7(x: any) { } +>foo7 : { (x: A): any; (x: { [x: string]: Base; }): any; } +>x : any + +function foo8(x: B); +>foo8 : { (x: B): any; (x: I): any; } +>x : B +>B : B + +function foo8(x: I); // error +>foo8 : { (x: B): any; (x: I): any; } +>x : I +>I : I + +function foo8(x: any) { } +>foo8 : { (x: B): any; (x: I): any; } +>x : any + +function foo9(x: B); +>foo9 : { (x: B): any; (x: C): any; } +>x : B +>B : B + +function foo9(x: C); // ok +>foo9 : { (x: B): any; (x: C): any; } +>x : C +>C : C +>Base : Base + +function foo9(x: any) { } +>foo9 : { (x: B): any; (x: C): any; } +>x : any + +function foo10(x: B); +>foo10 : { (x: B): any; (x: { [x: string]: Base; }): any; } +>x : B +>B : B + +function foo10(x: typeof a); // ok +>foo10 : { (x: B): any; (x: { [x: string]: Base; }): any; } +>x : { [x: string]: Base; } +>a : { [x: string]: Base; } + +function foo10(x: any) { } +>foo10 : { (x: B): any; (x: { [x: string]: Base; }): any; } +>x : any + +function foo11(x: B); +>foo11 : { (x: B): any; (x: { [x: string]: Derived; }): any; } +>x : B +>B : B + +function foo11(x: typeof b); // error +>foo11 : { (x: B): any; (x: { [x: string]: Derived; }): any; } +>x : { [x: string]: Derived; } +>b : { [x: string]: Derived; } + +function foo11(x: any) { } +>foo11 : { (x: B): any; (x: { [x: string]: Derived; }): any; } +>x : any + +function foo11b(x: B); +>foo11b : { (x: B): any; (x: PA): any; } +>x : B +>B : B + +function foo11b(x: PA); // ok +>foo11b : { (x: B): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo11b(x: any) { } +>foo11b : { (x: B): any; (x: PA): any; } +>x : any + +function foo11c(x: B); +>foo11c : { (x: B): any; (x: PB): any; } +>x : B +>B : B + +function foo11c(x: PB); // error +>foo11c : { (x: B): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo11c(x: any) { } +>foo11c : { (x: B): any; (x: PB): any; } +>x : any + +function foo12(x: I); +>foo12 : { (x: I): any; (x: C): any; } +>x : I +>I : I + +function foo12(x: C); // error +>foo12 : { (x: I): any; (x: C): any; } +>x : C +>C : C +>Derived : Derived + +function foo12(x: any) { } +>foo12 : { (x: I): any; (x: C): any; } +>x : any + +function foo13(x: I); +>foo13 : { (x: I): any; (x: { [x: string]: Base; }): any; } +>x : I +>I : I + +function foo13(x: typeof a); // ok +>foo13 : { (x: I): any; (x: { [x: string]: Base; }): any; } +>x : { [x: string]: Base; } +>a : { [x: string]: Base; } + +function foo13(x: any) { } +>foo13 : { (x: I): any; (x: { [x: string]: Base; }): any; } +>x : any + +function foo14(x: I); +>foo14 : { (x: I): any; (x: { [x: string]: Derived; }): any; } +>x : I +>I : I + +function foo14(x: typeof b); // error +>foo14 : { (x: I): any; (x: { [x: string]: Derived; }): any; } +>x : { [x: string]: Derived; } +>b : { [x: string]: Derived; } + +function foo14(x: any) { } +>foo14 : { (x: I): any; (x: { [x: string]: Derived; }): any; } +>x : any + +function foo15(x: I); +>foo15 : { (x: I): any; (x: PA): any; } +>x : I +>I : I + +function foo15(x: PA); // ok +>foo15 : { (x: I): any; (x: PA): any; } +>x : PA +>PA : PA + +function foo15(x: any) { } +>foo15 : { (x: I): any; (x: PA): any; } +>x : any + +function foo16(x: I); +>foo16 : { (x: I): any; (x: PB): any; } +>x : I +>I : I + +function foo16(x: PB); // error +>foo16 : { (x: I): any; (x: PB): any; } +>x : PB +>PB : PB + +function foo16(x: any) { } +>foo16 : { (x: I): any; (x: PB): any; } +>x : any + + diff --git a/tests/baselines/reference/optionalAccessorsInInterface1.types b/tests/baselines/reference/optionalAccessorsInInterface1.types new file mode 100644 index 00000000000..c426cdba178 --- /dev/null +++ b/tests/baselines/reference/optionalAccessorsInInterface1.types @@ -0,0 +1,53 @@ +=== tests/cases/compiler/optionalAccessorsInInterface1.ts === +interface MyPropertyDescriptor { +>MyPropertyDescriptor : MyPropertyDescriptor + + get? (): any; +>get : () => any + + set? (v: any): void; +>set : (v: any) => void +>v : any +} + +declare function defineMyProperty(o: any, p: string, attributes: MyPropertyDescriptor): any; +>defineMyProperty : (o: any, p: string, attributes: MyPropertyDescriptor) => any +>o : any +>p : string +>attributes : MyPropertyDescriptor +>MyPropertyDescriptor : MyPropertyDescriptor + +defineMyProperty({}, "name", { get: function () { return 5; } }); +>defineMyProperty({}, "name", { get: function () { return 5; } }) : any +>defineMyProperty : (o: any, p: string, attributes: MyPropertyDescriptor) => any +>{} : {} +>{ get: function () { return 5; } } : { get: () => number; } +>get : () => number +>function () { return 5; } : () => number + +interface MyPropertyDescriptor2 { +>MyPropertyDescriptor2 : MyPropertyDescriptor2 + + get?: () => any; +>get : () => any + + set?: (v: any) => void; +>set : (v: any) => void +>v : any +} + +declare function defineMyProperty2(o: any, p: string, attributes: MyPropertyDescriptor2): any; +>defineMyProperty2 : (o: any, p: string, attributes: MyPropertyDescriptor2) => any +>o : any +>p : string +>attributes : MyPropertyDescriptor2 +>MyPropertyDescriptor2 : MyPropertyDescriptor2 + +defineMyProperty2({}, "name", { get: function () { return 5; } }); +>defineMyProperty2({}, "name", { get: function () { return 5; } }) : any +>defineMyProperty2 : (o: any, p: string, attributes: MyPropertyDescriptor2) => any +>{} : {} +>{ get: function () { return 5; } } : { get: () => number; } +>get : () => number +>function () { return 5; } : () => number + diff --git a/tests/baselines/reference/optionalConstructorArgInSuper.types b/tests/baselines/reference/optionalConstructorArgInSuper.types new file mode 100644 index 00000000000..26d4fcb9abb --- /dev/null +++ b/tests/baselines/reference/optionalConstructorArgInSuper.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/optionalConstructorArgInSuper.ts === +class Base { +>Base : Base + + constructor(opt?) { } +>opt : any + + foo(other?) { } +>foo : (other?: any) => void +>other : any +} +class Derived extends Base { +>Derived : Derived +>Base : Base +} +var d = new Derived(); // bug caused an error here, couldn't select overload +>d : Derived +>new Derived() : Derived +>Derived : typeof Derived + +var d2: Derived; +>d2 : Derived +>Derived : Derived + +d2.foo(); +>d2.foo() : void +>d2.foo : (other?: any) => void +>d2 : Derived +>foo : (other?: any) => void + diff --git a/tests/baselines/reference/optionalParamInOverride.types b/tests/baselines/reference/optionalParamInOverride.types new file mode 100644 index 00000000000..f4530dace61 --- /dev/null +++ b/tests/baselines/reference/optionalParamInOverride.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/optionalParamInOverride.ts === +class Z { +>Z : Z + + public func(): void { } +>func : () => void +} +class Y extends Z { +>Y : Y +>Z : Z + + public func(value?: any): void { } +>func : (value?: any) => void +>value : any +} + diff --git a/tests/baselines/reference/optionalParamReferencingOtherParams1.types b/tests/baselines/reference/optionalParamReferencingOtherParams1.types new file mode 100644 index 00000000000..3a62d51759c --- /dev/null +++ b/tests/baselines/reference/optionalParamReferencingOtherParams1.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/optionalParamReferencingOtherParams1.ts === +function strange(x: number, y = x * 1, z = x + y) { +>strange : (x: number, y?: number, z?: number) => number +>x : number +>y : number +>x * 1 : number +>x : number +>z : number +>x + y : number +>x : number +>y : number + + return z; +>z : number +} diff --git a/tests/baselines/reference/out-flag.types b/tests/baselines/reference/out-flag.types new file mode 100644 index 00000000000..ac1b38b4e2e --- /dev/null +++ b/tests/baselines/reference/out-flag.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/out-flag.ts === +//// @out: bin\ + +// my class comments +class MyClass +>MyClass : MyClass +{ + // my function comments + public Count(): number +>Count : () => number + { + return 42; + } + + public SetCount(value: number) +>SetCount : (value: number) => void +>value : number + { + // + } +} diff --git a/tests/baselines/reference/overload2.types b/tests/baselines/reference/overload2.types new file mode 100644 index 00000000000..05a9533b2d2 --- /dev/null +++ b/tests/baselines/reference/overload2.types @@ -0,0 +1,42 @@ +=== tests/cases/compiler/overload2.ts === +enum A { } +>A : A + +enum B { } +>B : B + +function foo(a: A); +>foo : { (a: A): any; (b: B): any; } +>a : A +>A : A + +function foo(b: B); +>foo : { (a: A): any; (b: B): any; } +>b : B +>B : B + +// should be ok +function foo(x: number) { +>foo : { (a: A): any; (b: B): any; } +>x : number +} + +class C { } +>C : C + +function foo1(a: A); +>foo1 : { (a: A): any; (c: C): any; } +>a : A +>A : A + +function foo1(c: C); +>foo1 : { (a: A): any; (c: C): any; } +>c : C +>C : C + +// should be ok +function foo1(x: number) { +>foo1 : { (a: A): any; (c: C): any; } +>x : number +} + diff --git a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.types b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.types new file mode 100644 index 00000000000..311cf971b61 --- /dev/null +++ b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.types @@ -0,0 +1,121 @@ +=== tests/cases/compiler/overloadBindingAcrossDeclarationBoundaries.ts === +interface Opt1 { +>Opt1 : Opt1 + + p?: any; +>p : any +} +interface Opt2 { +>Opt2 : Opt2 + + q?: any; +>q : any +} +interface Opt3 { +>Opt3 : Opt3 + + r?: any; +>r : any +} +interface Opt4 { +>Opt4 : Opt4 + + s?: any; +>s : any +} +interface A { +>A : A + + a(o: Opt1): Opt1; +>a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } +>o : Opt1 +>Opt1 : Opt1 +>Opt1 : Opt1 + + a(o: Opt2): Opt2; +>a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } +>o : Opt2 +>Opt2 : Opt2 +>Opt2 : Opt2 + + (o: Opt1): Opt1; +>o : Opt1 +>Opt1 : Opt1 +>Opt1 : Opt1 + + (o: Opt2): Opt2; +>o : Opt2 +>Opt2 : Opt2 +>Opt2 : Opt2 + + new (o: Opt1): Opt1; +>o : Opt1 +>Opt1 : Opt1 +>Opt1 : Opt1 + + new (o: Opt2): Opt2; +>o : Opt2 +>Opt2 : Opt2 +>Opt2 : Opt2 +} +interface A { +>A : A + + a(o: Opt3): Opt3; +>a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } +>o : Opt3 +>Opt3 : Opt3 +>Opt3 : Opt3 + + a(o: Opt4): Opt4; +>a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } +>o : Opt4 +>Opt4 : Opt4 +>Opt4 : Opt4 + + (o: Opt3): Opt3; +>o : Opt3 +>Opt3 : Opt3 +>Opt3 : Opt3 + + (o: Opt4): Opt4; +>o : Opt4 +>Opt4 : Opt4 +>Opt4 : Opt4 + + new (o: Opt3): Opt3; +>o : Opt3 +>Opt3 : Opt3 +>Opt3 : Opt3 + + new (o: Opt4): Opt4; +>o : Opt4 +>Opt4 : Opt4 +>Opt4 : Opt4 +} + +var a: A; +>a : A +>A : A + +// These should all be Opt3 +var a1 = a.a({}); +>a1 : Opt3 +>a.a({}) : Opt3 +>a.a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } +>a : A +>a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } +>{} : {} + +var a1 = a({}); +>a1 : Opt3 +>a({}) : Opt3 +>a : A +>{} : {} + +var a1 = new a({}); +>a1 : Opt3 +>new a({}) : Opt3 +>a : A +>{} : {} + diff --git a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.types b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.types new file mode 100644 index 00000000000..e67ff2f8de6 --- /dev/null +++ b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.types @@ -0,0 +1,124 @@ +=== tests/cases/compiler/overloadBindingAcrossDeclarationBoundaries_file0.ts === +interface Opt1 { +>Opt1 : Opt1 + + p?: any; +>p : any +} +interface Opt2 { +>Opt2 : Opt2 + + q?: any; +>q : any +} +interface Opt3 { +>Opt3 : Opt3 + + r?: any; +>r : any +} +interface Opt4 { +>Opt4 : Opt4 + + s?: any; +>s : any +} + +interface A { +>A : A + + a(o: Opt1): Opt1; +>a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } +>o : Opt1 +>Opt1 : Opt1 +>Opt1 : Opt1 + + a(o: Opt2): Opt2; +>a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } +>o : Opt2 +>Opt2 : Opt2 +>Opt2 : Opt2 + + (o: Opt1): Opt1; +>o : Opt1 +>Opt1 : Opt1 +>Opt1 : Opt1 + + (o: Opt2): Opt2; +>o : Opt2 +>Opt2 : Opt2 +>Opt2 : Opt2 + + new (o: Opt1): Opt1; +>o : Opt1 +>Opt1 : Opt1 +>Opt1 : Opt1 + + new (o: Opt2): Opt2; +>o : Opt2 +>Opt2 : Opt2 +>Opt2 : Opt2 +} + +=== tests/cases/compiler/overloadBindingAcrossDeclarationBoundaries_file1.ts === +interface A { +>A : A + + a(o: Opt3): Opt3; +>a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } +>o : Opt3 +>Opt3 : Opt3 +>Opt3 : Opt3 + + a(o: Opt4): Opt4; +>a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } +>o : Opt4 +>Opt4 : Opt4 +>Opt4 : Opt4 + + (o: Opt3): Opt3; +>o : Opt3 +>Opt3 : Opt3 +>Opt3 : Opt3 + + (o: Opt4): Opt4; +>o : Opt4 +>Opt4 : Opt4 +>Opt4 : Opt4 + + new (o: Opt3): Opt3; +>o : Opt3 +>Opt3 : Opt3 +>Opt3 : Opt3 + + new (o: Opt4): Opt4; +>o : Opt4 +>Opt4 : Opt4 +>Opt4 : Opt4 +} + +var a: A; +>a : A +>A : A + +// These should all be Opt3 +var a1 = a.a({}); +>a1 : Opt3 +>a.a({}) : Opt3 +>a.a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } +>a : A +>a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } +>{} : {} + +var a1 = a({}); +>a1 : Opt3 +>a({}) : Opt3 +>a : A +>{} : {} + +var a1 = new a({}); +>a1 : Opt3 +>new a({}) : Opt3 +>a : A +>{} : {} + diff --git a/tests/baselines/reference/overloadCallTest.types b/tests/baselines/reference/overloadCallTest.types new file mode 100644 index 00000000000..0ed7ecccdbc --- /dev/null +++ b/tests/baselines/reference/overloadCallTest.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/overloadCallTest.ts === +class foo { +>foo : foo + + constructor() { + function bar(): string; +>bar : { (): string; (s: string): any; } + + function bar(s:string); +>bar : { (): string; (s: string): any; } +>s : string + + function bar(foo?: string) { return "foo" }; +>bar : { (): string; (s: string): any; } +>foo : string + + var test = bar("test"); +>test : any +>bar("test") : any +>bar : { (): string; (s: string): any; } + + var goo = bar(); +>goo : string +>bar() : string +>bar : { (): string; (s: string): any; } + + goo = bar("test"); +>goo = bar("test") : any +>goo : string +>bar("test") : any +>bar : { (): string; (s: string): any; } + } + +} + + diff --git a/tests/baselines/reference/overloadCrash.types b/tests/baselines/reference/overloadCrash.types new file mode 100644 index 00000000000..88c2b8c79c0 --- /dev/null +++ b/tests/baselines/reference/overloadCrash.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/overloadCrash.ts === +interface I1 {a:number; b:number;}; +>I1 : I1 +>a : number +>b : number + +interface I2 {c:number; d:number;}; +>I2 : I2 +>c : number +>d : number + +interface I3 {a:number; b:number; c:number; d:number;}; +>I3 : I3 +>a : number +>b : number +>c : number +>d : number + +declare function foo(...n:I1[]); +>foo : { (...n: I1[]): any; (n1: I2, n3: I2): any; } +>n : I1[] +>I1 : I1 + +declare function foo(n1:I2, n3:I2); +>foo : { (...n: I1[]): any; (n1: I2, n3: I2): any; } +>n1 : I2 +>I2 : I2 +>n3 : I2 +>I2 : I2 + +var i3:I3; +>i3 : I3 +>I3 : I3 + +foo(i3, i3); // should not crash the compiler :) +>foo(i3, i3) : any +>foo : { (...n: I1[]): any; (n1: I2, n3: I2): any; } +>i3 : I3 +>i3 : I3 + diff --git a/tests/baselines/reference/overloadEquivalenceWithStatics.types b/tests/baselines/reference/overloadEquivalenceWithStatics.types new file mode 100644 index 00000000000..6c55c8aeb0c --- /dev/null +++ b/tests/baselines/reference/overloadEquivalenceWithStatics.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/overloadEquivalenceWithStatics.ts === +class A1 { +>A1 : A1 +>T : T + +static B(v: A1): A1; // 1 +>B : { (v: A1): A1; (v: S): A1; } +>S : S +>v : A1 +>A1 : A1 +>S : S +>A1 : A1 +>S : S + +static B(v: S): A1; // 2 : Error Duplicate signature +>B : { (v: A1): A1; (v: S): A1; } +>S : S +>v : S +>S : S +>A1 : A1 +>S : S + +static B(v: any): A1 { +>B : { (v: A1): A1; (v: S): A1; } +>S : S +>v : any +>A1 : A1 +>S : S + +return null; +} +} + diff --git a/tests/baselines/reference/overloadGenericFunctionWithRestArgs.types b/tests/baselines/reference/overloadGenericFunctionWithRestArgs.types new file mode 100644 index 00000000000..8e45d35defe --- /dev/null +++ b/tests/baselines/reference/overloadGenericFunctionWithRestArgs.types @@ -0,0 +1,39 @@ +=== tests/cases/compiler/overloadGenericFunctionWithRestArgs.ts === +class B{ +>B : B +>V : V + + private id: V; +>id : V +>V : V +} +class A{ +>A : A +>U : U + + GetEnumerator: () => B; +>GetEnumerator : () => B +>B : B +>U : U +} +function Choice(...v_args: T[]): A; +>Choice : (...v_args: T[]) => A +>T : T +>v_args : T[] +>T : T +>A : A +>T : T + +function Choice(...v_args: T[]): A { +>Choice : (...v_args: T[]) => A +>T : T +>v_args : T[] +>T : T +>A : A +>T : T + + return new A(); +>new A() : A +>A : typeof A +>T : T +} diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks1.types b/tests/baselines/reference/overloadOnConstConstraintChecks1.types new file mode 100644 index 00000000000..9f92e56c682 --- /dev/null +++ b/tests/baselines/reference/overloadOnConstConstraintChecks1.types @@ -0,0 +1,78 @@ +=== tests/cases/compiler/overloadOnConstConstraintChecks1.ts === +class Base { foo() { } } +>Base : Base +>foo : () => void + +class Derived1 extends Base { bar() { } } +>Derived1 : Derived1 +>Base : Base +>bar : () => void + +class Derived2 extends Base { baz() { } } +>Derived2 : Derived2 +>Base : Base +>baz : () => void + +class Derived3 extends Base { biz() { } } +>Derived3 : Derived3 +>Base : Base +>biz : () => void + +interface MyDoc { // Document +>MyDoc : MyDoc + + createElement(tagName: string): Base; +>createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } +>tagName : string +>Base : Base + + createElement(tagName: 'canvas'): Derived1; +>createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } +>tagName : 'canvas' +>Derived1 : Derived1 + + createElement(tagName: 'div'): Derived2; +>createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } +>tagName : 'div' +>Derived2 : Derived2 + + createElement(tagName: 'span'): Derived3; +>createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } +>tagName : 'span' +>Derived3 : Derived3 + + // + 100 more +} + +class D implements MyDoc { +>D : D +>MyDoc : MyDoc + + createElement(tagName:string): Base; +>createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } +>tagName : string +>Base : Base + + createElement(tagName: 'canvas'): Derived1; +>createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } +>tagName : 'canvas' +>Derived1 : Derived1 + + createElement(tagName: 'div'): Derived2; +>createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } +>tagName : 'div' +>Derived2 : Derived2 + + createElement(tagName: 'span'): Derived3; +>createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } +>tagName : 'span' +>Derived3 : Derived3 + + createElement(tagName:any): Base { +>createElement : { (tagName: string): Base; (tagName: 'canvas'): Derived1; (tagName: 'div'): Derived2; (tagName: 'span'): Derived3; } +>tagName : any +>Base : Base + + return null; + } +} diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks2.types b/tests/baselines/reference/overloadOnConstConstraintChecks2.types new file mode 100644 index 00000000000..c5af206c6da --- /dev/null +++ b/tests/baselines/reference/overloadOnConstConstraintChecks2.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/overloadOnConstConstraintChecks2.ts === +class A {} +>A : A + +class B extends A {} +>B : B +>A : A + +class C extends A { +>C : C +>A : A + + public foo() { } +>foo : () => void +} +function foo(name: 'hi'): B; +>foo : { (name: 'hi'): B; (name: 'bye'): C; (name: string): A; } +>name : 'hi' +>B : B + +function foo(name: 'bye'): C; +>foo : { (name: 'hi'): B; (name: 'bye'): C; (name: string): A; } +>name : 'bye' +>C : C + +function foo(name: string): A; +>foo : { (name: 'hi'): B; (name: 'bye'): C; (name: string): A; } +>name : string +>A : A + +function foo(name: any): A { +>foo : { (name: 'hi'): B; (name: 'bye'): C; (name: string): A; } +>name : any +>A : A + + return null; +} diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks3.types b/tests/baselines/reference/overloadOnConstConstraintChecks3.types new file mode 100644 index 00000000000..adc41ff235c --- /dev/null +++ b/tests/baselines/reference/overloadOnConstConstraintChecks3.types @@ -0,0 +1,39 @@ +=== tests/cases/compiler/overloadOnConstConstraintChecks3.ts === +class A { private x = 1} +>A : A +>x : number + +class B extends A {} +>B : B +>A : A + +class C extends A { +>C : C +>A : A + + public foo() { } +>foo : () => void +} +function foo(name: 'hi'): B; +>foo : { (name: 'hi'): B; (name: 'bye'): C; (name: string): A; } +>name : 'hi' +>B : B + +function foo(name: 'bye'): C; +>foo : { (name: 'hi'): B; (name: 'bye'): C; (name: string): A; } +>name : 'bye' +>C : C + +function foo(name: string): A; +>foo : { (name: 'hi'): B; (name: 'bye'): C; (name: string): A; } +>name : string +>A : A + +function foo(name: any): A { +>foo : { (name: 'hi'): B; (name: 'bye'): C; (name: string): A; } +>name : any +>A : A + + return null; +} + diff --git a/tests/baselines/reference/overloadOnConstInheritance1.types b/tests/baselines/reference/overloadOnConstInheritance1.types new file mode 100644 index 00000000000..96f8df3dffd --- /dev/null +++ b/tests/baselines/reference/overloadOnConstInheritance1.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/overloadOnConstInheritance1.ts === +interface Base { +>Base : Base + + addEventListener(x: string): any; +>addEventListener : { (x: string): any; (x: 'foo'): string; } +>x : string + + addEventListener(x: 'foo'): string; +>addEventListener : { (x: string): any; (x: 'foo'): string; } +>x : 'foo' +} +interface Deriver extends Base { +>Deriver : Deriver +>Base : Base + + addEventListener(x: string): any; +>addEventListener : { (x: string): any; (x: 'bar'): string; } +>x : string + + addEventListener(x: 'bar'): string; +>addEventListener : { (x: string): any; (x: 'bar'): string; } +>x : 'bar' +} + diff --git a/tests/baselines/reference/overloadOnGenericArity.types b/tests/baselines/reference/overloadOnGenericArity.types new file mode 100644 index 00000000000..53c9e922fb9 --- /dev/null +++ b/tests/baselines/reference/overloadOnGenericArity.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/overloadOnGenericArity.ts === +interface Test { +>Test : Test + + then(p: string): string; +>then : { (p: string): string; (p: string): Date; } +>U : U +>p : string + + then(p: string): Date; // Error: Overloads cannot differ only by return type +>then : { (p: string): string; (p: string): Date; } +>p : string +>Date : Date +} + + diff --git a/tests/baselines/reference/overloadOnGenericClassAndNonGenericClass.types b/tests/baselines/reference/overloadOnGenericClassAndNonGenericClass.types new file mode 100644 index 00000000000..3277cf78488 --- /dev/null +++ b/tests/baselines/reference/overloadOnGenericClassAndNonGenericClass.types @@ -0,0 +1,60 @@ +=== tests/cases/compiler/overloadOnGenericClassAndNonGenericClass.ts === +class A { a; } +>A : A +>a : any + +class B { b; } +>B : B +>b : any + +class C { c; } +>C : C +>c : any + +class X { x: T; } +>X : X +>T : T +>x : T +>T : T + +class X1 { x: string; } +>X1 : X1 +>x : string + +class X2 { x: string; } +>X2 : X2 +>x : string + +function f(a: X1): A; +>f : { (a: X1): A; (a: X): B; } +>a : X1 +>X1 : X1 +>A : A + +function f(a: X): B; +>f : { (a: X1): A; (a: X): B; } +>T : T +>a : X +>X : X +>T : T +>B : B + +function f(a): any { +>f : { (a: X1): A; (a: X): B; } +>a : any +} + +var xs: X; +>xs : X +>X : X + +var t3 = f(xs); +>t3 : A +>f(xs) : A +>f : { (a: X1): A; (a: X): B; } +>xs : X + +var t3: A; // should not error +>t3 : A +>A : A + diff --git a/tests/baselines/reference/overloadResolutionOverNonCTLambdas.types b/tests/baselines/reference/overloadResolutionOverNonCTLambdas.types new file mode 100644 index 00000000000..4b4781948a5 --- /dev/null +++ b/tests/baselines/reference/overloadResolutionOverNonCTLambdas.types @@ -0,0 +1,88 @@ +=== tests/cases/compiler/overloadResolutionOverNonCTLambdas.ts === +module Bugs { +>Bugs : typeof Bugs + + class A { +>A : A + } + + // replace(searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; + function bug2(message:string, ...args:any[]):string { +>bug2 : (message: string, ...args: any[]) => string +>message : string +>args : any[] + + var result= message.replace(/\{(\d+)\}/g, function(match, ...rest) { +>result : string +>message.replace(/\{(\d+)\}/g, function(match, ...rest) { + var index= rest[0]; + return typeof args[index] !== 'undefined' + ? args[index] + : match; + }) : string +>message.replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; } +>message : string +>replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; } +>/\{(\d+)\}/g : RegExp +>function(match, ...rest) { + var index= rest[0]; + return typeof args[index] !== 'undefined' + ? args[index] + : match; + } : (match: string, ...rest: any[]) => any +>match : string +>rest : any[] + + var index= rest[0]; +>index : any +>rest[0] : any +>rest : any[] + + return typeof args[index] !== 'undefined' +>typeof args[index] !== 'undefined' + ? args[index] + : match : any +>typeof args[index] !== 'undefined' : boolean +>typeof args[index] : string +>args[index] : any +>args : any[] +>index : any + + ? args[index] +>args[index] : any +>args : any[] +>index : any + + : match; +>match : string + + }); + return result; +>result : string + } +} + +function bug3(f:(x:string)=>string) { return f("s") } +>bug3 : (f: (x: string) => string) => string +>f : (x: string) => string +>x : string +>f("s") : string +>f : (x: string) => string + +function fprime(x:string):string { return x; } +>fprime : (x: string) => string +>x : string +>x : string + +bug3(fprime); +>bug3(fprime) : string +>bug3 : (f: (x: string) => string) => string +>fprime : (x: string) => string + +bug3(function(x:string):string { return x; }); +>bug3(function(x:string):string { return x; }) : string +>bug3 : (f: (x: string) => string) => string +>function(x:string):string { return x; } : (x: string) => string +>x : string +>x : string + diff --git a/tests/baselines/reference/overloadResolutionOverNonCTObjectLit.types b/tests/baselines/reference/overloadResolutionOverNonCTObjectLit.types new file mode 100644 index 00000000000..6bc491fd157 --- /dev/null +++ b/tests/baselines/reference/overloadResolutionOverNonCTObjectLit.types @@ -0,0 +1,67 @@ +=== tests/cases/compiler/overloadResolutionOverNonCTObjectLit.ts === +module Bugs { +>Bugs : typeof Bugs + + export interface IToken { +>IToken : IToken + + startIndex:number; +>startIndex : number + + type:string; +>type : string + + bracket:number; +>bracket : number + } + + export interface IState { +>IState : IState + } + + export interface IStateToken extends IToken { +>IStateToken : IStateToken +>IToken : IToken + + state: IState; +>state : IState +>IState : IState + + length: number; +>length : number + } + + function bug3() { +>bug3 : () => void + + var tokens:IToken[]= []; +>tokens : IToken[] +>IToken : IToken +>[] : IToken[] + + tokens.push({ startIndex: 1, type: '', bracket: 3 }); +>tokens.push({ startIndex: 1, type: '', bracket: 3 }) : number +>tokens.push : (...items: IToken[]) => number +>tokens : IToken[] +>push : (...items: IToken[]) => number +>{ startIndex: 1, type: '', bracket: 3 } : { startIndex: number; type: string; bracket: number; } +>startIndex : number +>type : string +>bracket : number + + tokens.push(({ startIndex: 1, type: '', bracket: 3, state: null, length: 10 })); +>tokens.push(({ startIndex: 1, type: '', bracket: 3, state: null, length: 10 })) : number +>tokens.push : (...items: IToken[]) => number +>tokens : IToken[] +>push : (...items: IToken[]) => number +>({ startIndex: 1, type: '', bracket: 3, state: null, length: 10 }) : IToken +>IToken : IToken +>({ startIndex: 1, type: '', bracket: 3, state: null, length: 10 }) : { startIndex: number; type: string; bracket: number; state: null; length: number; } +>{ startIndex: 1, type: '', bracket: 3, state: null, length: 10 } : { startIndex: number; type: string; bracket: number; state: null; length: number; } +>startIndex : number +>type : string +>bracket : number +>state : any +>length : number + } +} diff --git a/tests/baselines/reference/overloadResolutionWithAny.types b/tests/baselines/reference/overloadResolutionWithAny.types new file mode 100644 index 00000000000..14d378c9fac --- /dev/null +++ b/tests/baselines/reference/overloadResolutionWithAny.types @@ -0,0 +1,69 @@ +=== tests/cases/compiler/overloadResolutionWithAny.ts === +var func: { +>func : { (s: string): number; (s: any): string; } + + (s: string): number; +>s : string + + (s: any): string; +>s : any + +}; + +func(""); // number +>func("") : number +>func : { (s: string): number; (s: any): string; } + +func(3); // string +>func(3) : string +>func : { (s: string): number; (s: any): string; } + +var x: any; +>x : any + +func(x); // string +>func(x) : string +>func : { (s: string): number; (s: any): string; } +>x : any + +var func2: { +>func2 : { (s: string, t: string): number; (s: any, t: string): boolean; (s: string, t: any): RegExp; (s: any, t: any): string; } + + (s: string, t: string): number; +>s : string +>t : string + + (s: any, t: string): boolean; +>s : any +>t : string + + (s: string, t: any): RegExp; +>s : string +>t : any +>RegExp : RegExp + + (s: any, t: any): string; +>s : any +>t : any +} + +func2(x, x); // string +>func2(x, x) : string +>func2 : { (s: string, t: string): number; (s: any, t: string): boolean; (s: string, t: any): RegExp; (s: any, t: any): string; } +>x : any +>x : any + +func2("", ""); // number +>func2("", "") : number +>func2 : { (s: string, t: string): number; (s: any, t: string): boolean; (s: string, t: any): RegExp; (s: any, t: any): string; } + +func2(x, ""); // boolean +>func2(x, "") : boolean +>func2 : { (s: string, t: string): number; (s: any, t: string): boolean; (s: string, t: any): RegExp; (s: any, t: any): string; } +>x : any + +func2("", x); // RegExp +>func2("", x) : RegExp +>func2 : { (s: string, t: string): number; (s: any, t: string): boolean; (s: string, t: any): RegExp; (s: any, t: any): string; } +>x : any + diff --git a/tests/baselines/reference/overloadRet.types b/tests/baselines/reference/overloadRet.types new file mode 100644 index 00000000000..b4eb8538dbc --- /dev/null +++ b/tests/baselines/reference/overloadRet.types @@ -0,0 +1,38 @@ +=== tests/cases/compiler/overloadRet.ts === +interface I { +>I : I + + f(s:string):number; +>f : { (s: string): number; (n: number): string; } +>s : string + + f(n:number):string; +>f : { (s: string): number; (n: number): string; } +>n : number + + g(n:number):any; +>g : { (n: number): any; (n: number, m: number): string; } +>n : number + + g(n:number,m:number):string; +>g : { (n: number): any; (n: number, m: number): string; } +>n : number +>m : number + + h(n:number):I; +>h : { (n: number): I; (b: boolean): number; } +>n : number +>I : I + + h(b:boolean):number; +>h : { (n: number): I; (b: boolean): number; } +>b : boolean + + i(b:boolean):number; +>i : { (b: boolean): number; (b: boolean): any; } +>b : boolean + + i(b:boolean):any; +>i : { (b: boolean): number; (b: boolean): any; } +>b : boolean +} diff --git a/tests/baselines/reference/overloadReturnTypes.types b/tests/baselines/reference/overloadReturnTypes.types new file mode 100644 index 00000000000..1823c752ae7 --- /dev/null +++ b/tests/baselines/reference/overloadReturnTypes.types @@ -0,0 +1,62 @@ +=== tests/cases/compiler/overloadReturnTypes.ts === +class Accessor {} +>Accessor : Accessor + +function attr(name: string): string; +>attr : { (name: string): string; (name: string, value: string): Accessor; (map: any): Accessor; } +>name : string + +function attr(name: string, value: string): Accessor; +>attr : { (name: string): string; (name: string, value: string): Accessor; (map: any): Accessor; } +>name : string +>value : string +>Accessor : Accessor + +function attr(map: any): Accessor; +>attr : { (name: string): string; (name: string, value: string): Accessor; (map: any): Accessor; } +>map : any +>Accessor : Accessor + +function attr(nameOrMap: any, value?: string): any { +>attr : { (name: string): string; (name: string, value: string): Accessor; (map: any): Accessor; } +>nameOrMap : any +>value : string + + if (nameOrMap && typeof nameOrMap === "object") { +>nameOrMap && typeof nameOrMap === "object" : boolean +>nameOrMap : any +>typeof nameOrMap === "object" : boolean +>typeof nameOrMap : string +>nameOrMap : any + + // handle map case + return new Accessor; +>new Accessor : Accessor +>Accessor : typeof Accessor + } + else { + // handle string case + return "s"; + } +} + + +interface IFace { +>IFace : IFace + + attr(name:string):string; +>attr : { (name: string): string; (name: string, value: string): Accessor; (map: any): Accessor; } +>name : string + + attr(name: string, value: string): Accessor; +>attr : { (name: string): string; (name: string, value: string): Accessor; (map: any): Accessor; } +>name : string +>value : string +>Accessor : Accessor + + attr(map: any): Accessor; +>attr : { (name: string): string; (name: string, value: string): Accessor; (map: any): Accessor; } +>map : any +>Accessor : Accessor +} + diff --git a/tests/baselines/reference/overloadWithCallbacksWithDifferingOptionalityOnArgs.types b/tests/baselines/reference/overloadWithCallbacksWithDifferingOptionalityOnArgs.types new file mode 100644 index 00000000000..2ed804ad012 --- /dev/null +++ b/tests/baselines/reference/overloadWithCallbacksWithDifferingOptionalityOnArgs.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/overloadWithCallbacksWithDifferingOptionalityOnArgs.ts === +function x2(callback: (x?: number) => number); +>x2 : { (callback: (x?: number) => number): any; (callback: (x: string) => number): any; } +>callback : (x?: number) => number +>x : number + +function x2(callback: (x: string) => number); +>x2 : { (callback: (x?: number) => number): any; (callback: (x: string) => number): any; } +>callback : (x: string) => number +>x : string + +function x2(callback: (x: any) => number) { } +>x2 : { (callback: (x?: number) => number): any; (callback: (x: string) => number): any; } +>callback : (x: any) => number +>x : any + +x2(() => 1); +>x2(() => 1) : any +>x2 : { (callback: (x?: number) => number): any; (callback: (x: string) => number): any; } +>() => 1 : () => number + +x2((x) => 1 ); +>x2((x) => 1 ) : any +>x2 : { (callback: (x?: number) => number): any; (callback: (x: string) => number): any; } +>(x) => 1 : (x: number) => number +>x : number + diff --git a/tests/baselines/reference/overloadedStaticMethodSpecialization.types b/tests/baselines/reference/overloadedStaticMethodSpecialization.types new file mode 100644 index 00000000000..a8e9e685d89 --- /dev/null +++ b/tests/baselines/reference/overloadedStaticMethodSpecialization.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/overloadedStaticMethodSpecialization.ts === +class A { +>A : A +>T : T + + static B(v: A): A; +>B : { (v: A): A; (v: S): A; } +>S : S +>v : A +>A : A +>S : S +>A : A +>S : S + + static B(v: S): A; +>B : { (v: A): A; (v: S): A; } +>S : S +>v : S +>S : S +>A : A +>S : S + + static B(v: any): A { +>B : { (v: A): A; (v: S): A; } +>S : S +>v : any +>A : A +>S : S + + return null; + } +} + diff --git a/tests/baselines/reference/overloadsAndTypeArgumentArity.types b/tests/baselines/reference/overloadsAndTypeArgumentArity.types new file mode 100644 index 00000000000..1b76b8e13fe --- /dev/null +++ b/tests/baselines/reference/overloadsAndTypeArgumentArity.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/overloadsAndTypeArgumentArity.ts === +declare function Callbacks(flags?: string): void; +>Callbacks : { (flags?: string): void; (flags?: string): void; (flags?: string): void; (flags?: string): void; } +>flags : string + +declare function Callbacks(flags?: string): void; +>Callbacks : { (flags?: string): void; (flags?: string): void; (flags?: string): void; (flags?: string): void; } +>T : T +>flags : string + +declare function Callbacks(flags?: string): void; +>Callbacks : { (flags?: string): void; (flags?: string): void; (flags?: string): void; (flags?: string): void; } +>T1 : T1 +>T2 : T2 +>flags : string + +declare function Callbacks(flags?: string): void; +>Callbacks : { (flags?: string): void; (flags?: string): void; (flags?: string): void; (flags?: string): void; } +>T1 : T1 +>T2 : T2 +>T3 : T3 +>flags : string + +Callbacks('s'); // no error +>Callbacks('s') : void +>Callbacks : { (flags?: string): void; (flags?: string): void; (flags?: string): void; (flags?: string): void; } + +new Callbacks('s'); // no error +>new Callbacks('s') : any +>Callbacks : { (flags?: string): void; (flags?: string): void; (flags?: string): void; (flags?: string): void; } + diff --git a/tests/baselines/reference/parameterPropertyInitializerInInitializers.types b/tests/baselines/reference/parameterPropertyInitializerInInitializers.types new file mode 100644 index 00000000000..c15ace849af --- /dev/null +++ b/tests/baselines/reference/parameterPropertyInitializerInInitializers.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/parameterPropertyInitializerInInitializers.ts === +class Foo { +>Foo : Foo + + constructor(public x: number, public y: number = x) { } +>x : number +>y : number +>x : number +} diff --git a/tests/baselines/reference/parameterPropertyReferencingOtherParameter.types b/tests/baselines/reference/parameterPropertyReferencingOtherParameter.types new file mode 100644 index 00000000000..0cf31b8e3f8 --- /dev/null +++ b/tests/baselines/reference/parameterPropertyReferencingOtherParameter.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/parameterPropertyReferencingOtherParameter.ts === +class Foo { +>Foo : Foo + + constructor(public x: number, public y: number = x) { } +>x : number +>y : number +>x : number +} + diff --git a/tests/baselines/reference/parameterReferencesOtherParameter1.types b/tests/baselines/reference/parameterReferencesOtherParameter1.types new file mode 100644 index 00000000000..bab9ef89189 --- /dev/null +++ b/tests/baselines/reference/parameterReferencesOtherParameter1.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/parameterReferencesOtherParameter1.ts === +class Model { +>Model : Model + + public name: string; +>name : string +} + +class UI { +>UI : UI + + constructor(model: Model, foo:string = model.name) +>model : Model +>Model : Model +>foo : string +>model.name : string +>model : Model +>name : string + { + } +} diff --git a/tests/baselines/reference/parameterReferencesOtherParameter2.types b/tests/baselines/reference/parameterReferencesOtherParameter2.types new file mode 100644 index 00000000000..3aac2cfd345 --- /dev/null +++ b/tests/baselines/reference/parameterReferencesOtherParameter2.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/parameterReferencesOtherParameter2.ts === +class Model { +>Model : Model + + public name: string; +>name : string +} + +class UI { +>UI : UI + + constructor(model: Model, foo = model.name) +>model : Model +>Model : Model +>foo : string +>model.name : string +>model : Model +>name : string + { + } +} diff --git a/tests/baselines/reference/parametersWithNoAnnotationAreAny.types b/tests/baselines/reference/parametersWithNoAnnotationAreAny.types new file mode 100644 index 00000000000..72fd2cb64be --- /dev/null +++ b/tests/baselines/reference/parametersWithNoAnnotationAreAny.types @@ -0,0 +1,100 @@ +=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/parametersWithNoAnnotationAreAny.ts === +function foo(x) { return x; } +>foo : (x: any) => any +>x : any +>x : any + +var f = function foo(x) { return x; } +>f : (x: any) => any +>function foo(x) { return x; } : (x: any) => any +>foo : (x: any) => any +>x : any +>x : any + +var f2 = (x) => x; +>f2 : (x: any) => any +>(x) => x : (x: any) => any +>x : any +>x : any + +var f3 = (x) => x; +>f3 : (x: any) => any +>(x) => x : (x: any) => any +>T : T +>x : any +>x : any + +class C { +>C : C + + foo(x) { +>foo : (x: any) => any +>x : any + + return x; +>x : any + } +} + +interface I { +>I : I + + foo(x); +>foo : (x: any) => any +>x : any + + foo2(x, y); +>foo2 : (x: any, y: any) => any +>x : any +>y : any +} + +var a: { +>a : { foo(x: any): any; } + + foo(x); +>foo : (x: any) => any +>x : any +} + +var b = { +>b : { foo: (x: any) => any; a: (x: any) => any; b: (x: any) => any; } +>{ + foo(x) { + return x; + }, + a: function foo(x) { + return x; + }, + b: (x) => x +} : { foo: (x: any) => any; a: (x: any) => any; b: (x: any) => any; } + + foo(x) { +>foo : (x: any) => any +>foo(x) { + return x; + } : (x: any) => any +>x : any + + return x; +>x : any + + }, + a: function foo(x) { +>a : (x: any) => any +>function foo(x) { + return x; + } : (x: any) => any +>foo : (x: any) => any +>x : any + + return x; +>x : any + + }, + b: (x) => x +>b : (x: any) => any +>(x) => x : (x: any) => any +>x : any +>x : any +} diff --git a/tests/baselines/reference/parseShortform.types b/tests/baselines/reference/parseShortform.types new file mode 100644 index 00000000000..21aff67ead4 --- /dev/null +++ b/tests/baselines/reference/parseShortform.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/parseShortform.ts === +interface I { +>I : I + + w: { +>w : { (): boolean; [x: string]: { x: any; y: any; }; [x: number]: { x: any; y: any; }; z: I; } + + z: I; +>z : I +>I : I + + (): boolean; + [s: string]: { x: any; y: any; }; +>s : string +>x : any +>y : any + + [n: number]: { x: any; y: any; }; +>n : number +>x : any +>y : any + + }; + x: boolean; +>x : boolean + + y: (s: string) => boolean; +>y : (s: string) => boolean +>s : string + + z: I; +>z : I +>I : I +} diff --git a/tests/baselines/reference/parser509677.types b/tests/baselines/reference/parser509677.types new file mode 100644 index 00000000000..2e5c8244923 --- /dev/null +++ b/tests/baselines/reference/parser509677.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509677.ts === +var n: { y: string }; +>n : { y: string; } +>y : string + diff --git a/tests/baselines/reference/parser537152.types b/tests/baselines/reference/parser537152.types new file mode 100644 index 00000000000..5c07bd6ae2d --- /dev/null +++ b/tests/baselines/reference/parser537152.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser537152.ts === +var t; +>t : any + +var y = t.e1; +>y : any +>t.e1 : any +>t : any +>e1 : any + diff --git a/tests/baselines/reference/parser579071.types b/tests/baselines/reference/parser579071.types new file mode 100644 index 00000000000..bfdece6f787 --- /dev/null +++ b/tests/baselines/reference/parser579071.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser579071.ts === +var x = /fo(o/; +>x : RegExp +>/fo(o/ : RegExp + diff --git a/tests/baselines/reference/parser596700.types b/tests/baselines/reference/parser596700.types new file mode 100644 index 00000000000..b14e28be716 --- /dev/null +++ b/tests/baselines/reference/parser596700.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser596700.ts === +var regex2 = /[a-z/]$/i; +>regex2 : RegExp +>/[a-z/]$/i : RegExp + diff --git a/tests/baselines/reference/parser630933.types b/tests/baselines/reference/parser630933.types new file mode 100644 index 00000000000..5134bda8c1f --- /dev/null +++ b/tests/baselines/reference/parser630933.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser630933.ts === +var a = "Hello"; +>a : string + +var b = a.match(/\/ver=([^/]+)/); +>b : RegExpMatchArray +>a.match(/\/ver=([^/]+)/) : RegExpMatchArray +>a.match : { (regexp: string): RegExpMatchArray; (regexp: RegExp): RegExpMatchArray; } +>a : string +>match : { (regexp: string): RegExpMatchArray; (regexp: RegExp): RegExpMatchArray; } +>/\/ver=([^/]+)/ : RegExp + diff --git a/tests/baselines/reference/parser642331.types b/tests/baselines/reference/parser642331.types new file mode 100644 index 00000000000..19cd40b76b8 --- /dev/null +++ b/tests/baselines/reference/parser642331.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331.ts === +class test { +>test : test + + constructor (static) { } +>static : any +} + diff --git a/tests/baselines/reference/parser643728.types b/tests/baselines/reference/parser643728.types new file mode 100644 index 00000000000..55c5377b6f7 --- /dev/null +++ b/tests/baselines/reference/parser643728.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser643728.ts === +interface C { +>C : C + + foo; +>foo : any + + new; +>new : any +} + diff --git a/tests/baselines/reference/parser645086_3.types b/tests/baselines/reference/parser645086_3.types new file mode 100644 index 00000000000..8cf6c0e73a5 --- /dev/null +++ b/tests/baselines/reference/parser645086_3.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser645086_3.ts === +var v = /[\]/]/ +>v : RegExp +>/[\]/]/ : RegExp + diff --git a/tests/baselines/reference/parser645086_4.types b/tests/baselines/reference/parser645086_4.types new file mode 100644 index 00000000000..a7c00b04fce --- /dev/null +++ b/tests/baselines/reference/parser645086_4.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser645086_4.ts === +var v = /[^\]/]/ +>v : RegExp +>/[^\]/]/ : RegExp + diff --git a/tests/baselines/reference/parser645484.types b/tests/baselines/reference/parser645484.types new file mode 100644 index 00000000000..60ab6719e3c --- /dev/null +++ b/tests/baselines/reference/parser645484.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser645484.ts === +var c : { +>c : { new?(): any; } + + new?(): any; +>new : () => any +} diff --git a/tests/baselines/reference/parser768531.types b/tests/baselines/reference/parser768531.types new file mode 100644 index 00000000000..43b5dbfa547 --- /dev/null +++ b/tests/baselines/reference/parser768531.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/Fuzz/parser768531.ts === +{a: 3} +/x/ +>/x/ : RegExp + diff --git a/tests/baselines/reference/parserAccessibilityAfterStatic11.types b/tests/baselines/reference/parserAccessibilityAfterStatic11.types new file mode 100644 index 00000000000..c3b3699bb27 --- /dev/null +++ b/tests/baselines/reference/parserAccessibilityAfterStatic11.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic11.ts === +class Outer +>Outer : Outer +{ +static public() {} +>public : () => void +} + diff --git a/tests/baselines/reference/parserAccessibilityAfterStatic14.types b/tests/baselines/reference/parserAccessibilityAfterStatic14.types new file mode 100644 index 00000000000..6b4cff3e17f --- /dev/null +++ b/tests/baselines/reference/parserAccessibilityAfterStatic14.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic14.ts === +class Outer +>Outer : Outer +{ +static public() {} +>public : () => void +>T : T +} + diff --git a/tests/baselines/reference/parserAccessibilityAfterStatic2.types b/tests/baselines/reference/parserAccessibilityAfterStatic2.types new file mode 100644 index 00000000000..d22f2fe7876 --- /dev/null +++ b/tests/baselines/reference/parserAccessibilityAfterStatic2.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic2.ts === +class Outer +>Outer : Outer +{ +static public; +>public : any +} + diff --git a/tests/baselines/reference/parserAccessibilityAfterStatic3.types b/tests/baselines/reference/parserAccessibilityAfterStatic3.types new file mode 100644 index 00000000000..b8eeb416c92 --- /dev/null +++ b/tests/baselines/reference/parserAccessibilityAfterStatic3.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic3.ts === +class Outer +>Outer : Outer +{ +static public = 1; +>public : number +} + diff --git a/tests/baselines/reference/parserAccessibilityAfterStatic4.types b/tests/baselines/reference/parserAccessibilityAfterStatic4.types new file mode 100644 index 00000000000..2e987cb0946 --- /dev/null +++ b/tests/baselines/reference/parserAccessibilityAfterStatic4.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic4.ts === +class Outer +>Outer : Outer +{ +static public: number; +>public : number +} + diff --git a/tests/baselines/reference/parserAccessibilityAfterStatic5.types b/tests/baselines/reference/parserAccessibilityAfterStatic5.types new file mode 100644 index 00000000000..34cc33ce34c --- /dev/null +++ b/tests/baselines/reference/parserAccessibilityAfterStatic5.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic5.ts === +class Outer +>Outer : Outer +{ +static public +>public : any +} + diff --git a/tests/baselines/reference/parserAccessors2.types b/tests/baselines/reference/parserAccessors2.types new file mode 100644 index 00000000000..9a0d9b0fdaa --- /dev/null +++ b/tests/baselines/reference/parserAccessors2.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors2.ts === +class C { +>C : C + + set Foo(a) { } +>Foo : any +>a : any +} diff --git a/tests/baselines/reference/parserAccessors4.types b/tests/baselines/reference/parserAccessors4.types new file mode 100644 index 00000000000..d2db232d796 --- /dev/null +++ b/tests/baselines/reference/parserAccessors4.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors4.ts === +var v = { set Foo(a) { } }; +>v : { Foo: any; } +>{ set Foo(a) { } } : { Foo: any; } +>Foo : any +>a : any + diff --git a/tests/baselines/reference/parserArrayLiteralExpression1.types b/tests/baselines/reference/parserArrayLiteralExpression1.types new file mode 100644 index 00000000000..d31f5ee3bfb --- /dev/null +++ b/tests/baselines/reference/parserArrayLiteralExpression1.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ArrayLiteralExpressions/parserArrayLiteralExpression1.ts === +var v = []; +>v : any[] +>[] : undefined[] + diff --git a/tests/baselines/reference/parserArrayLiteralExpression10.types b/tests/baselines/reference/parserArrayLiteralExpression10.types new file mode 100644 index 00000000000..d324d42aa46 --- /dev/null +++ b/tests/baselines/reference/parserArrayLiteralExpression10.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ArrayLiteralExpressions/parserArrayLiteralExpression10.ts === +var v = [1,1,]; +>v : number[] +>[1,1,] : number[] + diff --git a/tests/baselines/reference/parserArrayLiteralExpression11.types b/tests/baselines/reference/parserArrayLiteralExpression11.types new file mode 100644 index 00000000000..44ac1f6c5aa --- /dev/null +++ b/tests/baselines/reference/parserArrayLiteralExpression11.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ArrayLiteralExpressions/parserArrayLiteralExpression11.ts === +var v = [1,,1]; +>v : number[] +>[1,,1] : number[] + diff --git a/tests/baselines/reference/parserArrayLiteralExpression12.types b/tests/baselines/reference/parserArrayLiteralExpression12.types new file mode 100644 index 00000000000..a2ea5f12404 --- /dev/null +++ b/tests/baselines/reference/parserArrayLiteralExpression12.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ArrayLiteralExpressions/parserArrayLiteralExpression12.ts === +var v = [1,,,1]; +>v : number[] +>[1,,,1] : number[] + diff --git a/tests/baselines/reference/parserArrayLiteralExpression13.types b/tests/baselines/reference/parserArrayLiteralExpression13.types new file mode 100644 index 00000000000..bf8c15ac6b2 --- /dev/null +++ b/tests/baselines/reference/parserArrayLiteralExpression13.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ArrayLiteralExpressions/parserArrayLiteralExpression13.ts === +var v = [1,,1,,1]; +>v : number[] +>[1,,1,,1] : number[] + diff --git a/tests/baselines/reference/parserArrayLiteralExpression14.types b/tests/baselines/reference/parserArrayLiteralExpression14.types new file mode 100644 index 00000000000..4de3139c4b8 --- /dev/null +++ b/tests/baselines/reference/parserArrayLiteralExpression14.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ArrayLiteralExpressions/parserArrayLiteralExpression14.ts === +var v = [,,1,1,,1,,1,1,,1]; +>v : number[] +>[,,1,1,,1,,1,1,,1] : number[] + diff --git a/tests/baselines/reference/parserArrayLiteralExpression15.types b/tests/baselines/reference/parserArrayLiteralExpression15.types new file mode 100644 index 00000000000..b484c537f70 --- /dev/null +++ b/tests/baselines/reference/parserArrayLiteralExpression15.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ArrayLiteralExpressions/parserArrayLiteralExpression15.ts === +var v = [,,1,1,,1,,1,1,,1,]; +>v : number[] +>[,,1,1,,1,,1,1,,1,] : number[] + diff --git a/tests/baselines/reference/parserArrayLiteralExpression2.types b/tests/baselines/reference/parserArrayLiteralExpression2.types new file mode 100644 index 00000000000..dd16681ab82 --- /dev/null +++ b/tests/baselines/reference/parserArrayLiteralExpression2.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ArrayLiteralExpressions/parserArrayLiteralExpression2.ts === +var v = [,]; +>v : any[] +>[,] : undefined[] + diff --git a/tests/baselines/reference/parserArrayLiteralExpression3.types b/tests/baselines/reference/parserArrayLiteralExpression3.types new file mode 100644 index 00000000000..d0fbaa9b67b --- /dev/null +++ b/tests/baselines/reference/parserArrayLiteralExpression3.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ArrayLiteralExpressions/parserArrayLiteralExpression3.ts === +var v = [,,]; +>v : any[] +>[,,] : undefined[] + diff --git a/tests/baselines/reference/parserArrayLiteralExpression4.types b/tests/baselines/reference/parserArrayLiteralExpression4.types new file mode 100644 index 00000000000..0ceded3e62a --- /dev/null +++ b/tests/baselines/reference/parserArrayLiteralExpression4.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ArrayLiteralExpressions/parserArrayLiteralExpression4.ts === +var v = [,,,]; +>v : any[] +>[,,,] : undefined[] + diff --git a/tests/baselines/reference/parserArrayLiteralExpression5.types b/tests/baselines/reference/parserArrayLiteralExpression5.types new file mode 100644 index 00000000000..b729f7fed86 --- /dev/null +++ b/tests/baselines/reference/parserArrayLiteralExpression5.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ArrayLiteralExpressions/parserArrayLiteralExpression5.ts === +var v = [1]; +>v : number[] +>[1] : number[] + diff --git a/tests/baselines/reference/parserArrayLiteralExpression6.types b/tests/baselines/reference/parserArrayLiteralExpression6.types new file mode 100644 index 00000000000..a72a8eda339 --- /dev/null +++ b/tests/baselines/reference/parserArrayLiteralExpression6.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ArrayLiteralExpressions/parserArrayLiteralExpression6.ts === +var v = [,1]; +>v : number[] +>[,1] : number[] + diff --git a/tests/baselines/reference/parserArrayLiteralExpression7.types b/tests/baselines/reference/parserArrayLiteralExpression7.types new file mode 100644 index 00000000000..ca8c5d6e890 --- /dev/null +++ b/tests/baselines/reference/parserArrayLiteralExpression7.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ArrayLiteralExpressions/parserArrayLiteralExpression7.ts === +var v = [1,]; +>v : number[] +>[1,] : number[] + diff --git a/tests/baselines/reference/parserArrayLiteralExpression8.types b/tests/baselines/reference/parserArrayLiteralExpression8.types new file mode 100644 index 00000000000..06824d77a1a --- /dev/null +++ b/tests/baselines/reference/parserArrayLiteralExpression8.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ArrayLiteralExpressions/parserArrayLiteralExpression8.ts === +var v = [,1,]; +>v : number[] +>[,1,] : number[] + diff --git a/tests/baselines/reference/parserArrayLiteralExpression9.types b/tests/baselines/reference/parserArrayLiteralExpression9.types new file mode 100644 index 00000000000..7107f9e4090 --- /dev/null +++ b/tests/baselines/reference/parserArrayLiteralExpression9.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ArrayLiteralExpressions/parserArrayLiteralExpression9.ts === +var v = [1,1]; +>v : number[] +>[1,1] : number[] + diff --git a/tests/baselines/reference/parserClassDeclaration16.types b/tests/baselines/reference/parserClassDeclaration16.types new file mode 100644 index 00000000000..646e3db8789 --- /dev/null +++ b/tests/baselines/reference/parserClassDeclaration16.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration16.ts === +class C { +>C : C + + foo(); +>foo : () => any + + foo() { } +>foo : () => any +} diff --git a/tests/baselines/reference/parserClassDeclaration17.types b/tests/baselines/reference/parserClassDeclaration17.types new file mode 100644 index 00000000000..665d4b8cb60 --- /dev/null +++ b/tests/baselines/reference/parserClassDeclaration17.types @@ -0,0 +1,17 @@ +=== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration17.ts === +declare class Enumerator { +>Enumerator : Enumerator + + public atEnd(): boolean; +>atEnd : () => boolean + + public moveNext(); +>moveNext : () => any + + public item(): any; +>item : () => any + + constructor (o: any); +>o : any +} + diff --git a/tests/baselines/reference/parserClassDeclaration19.types b/tests/baselines/reference/parserClassDeclaration19.types new file mode 100644 index 00000000000..1f6a25bbdc8 --- /dev/null +++ b/tests/baselines/reference/parserClassDeclaration19.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration19.ts === +class C { +>C : C + + foo(); +>foo : () => any + + "foo"() { } +} diff --git a/tests/baselines/reference/parserClassDeclaration20.types b/tests/baselines/reference/parserClassDeclaration20.types new file mode 100644 index 00000000000..e8014bf3af5 --- /dev/null +++ b/tests/baselines/reference/parserClassDeclaration20.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration20.ts === +class C { +>C : C + + 0(); + "0"() { } +} diff --git a/tests/baselines/reference/parserClassDeclaration23.types b/tests/baselines/reference/parserClassDeclaration23.types new file mode 100644 index 00000000000..71f293f5894 --- /dev/null +++ b/tests/baselines/reference/parserClassDeclaration23.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration23.ts === +class C\u0032 { +>C\u0032 : C\u0032 +} diff --git a/tests/baselines/reference/parserClassDeclaration26.types b/tests/baselines/reference/parserClassDeclaration26.types new file mode 100644 index 00000000000..567872e245e --- /dev/null +++ b/tests/baselines/reference/parserClassDeclaration26.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration26.ts === +class C { +>C : C + + var +>var : any + + public +>public : any +} diff --git a/tests/baselines/reference/parserClassDeclaration7.d.types b/tests/baselines/reference/parserClassDeclaration7.d.types new file mode 100644 index 00000000000..968f16d296a --- /dev/null +++ b/tests/baselines/reference/parserClassDeclaration7.d.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration7.d.ts === +declare class C { +>C : C +} diff --git a/tests/baselines/reference/parserClassDeclarationIndexSignature1.types b/tests/baselines/reference/parserClassDeclarationIndexSignature1.types new file mode 100644 index 00000000000..f4d2adeedcd --- /dev/null +++ b/tests/baselines/reference/parserClassDeclarationIndexSignature1.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclarationIndexSignature1.ts === +class C { +>C : C + + [index:number]:number +>index : number +} diff --git a/tests/baselines/reference/parserConstructorDeclaration1.types b/tests/baselines/reference/parserConstructorDeclaration1.types new file mode 100644 index 00000000000..cc0d6f7a5c5 --- /dev/null +++ b/tests/baselines/reference/parserConstructorDeclaration1.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration1.ts === +class C { +>C : C + + public constructor() { } +} diff --git a/tests/baselines/reference/parserDebuggerStatement1.types b/tests/baselines/reference/parserDebuggerStatement1.types new file mode 100644 index 00000000000..bfc1785f927 --- /dev/null +++ b/tests/baselines/reference/parserDebuggerStatement1.types @@ -0,0 +1,3 @@ +=== tests/cases/conformance/parser/ecmascript5/parserDebuggerStatement1.ts === +debugger +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parserDebuggerStatement2.types b/tests/baselines/reference/parserDebuggerStatement2.types new file mode 100644 index 00000000000..9916218897c --- /dev/null +++ b/tests/baselines/reference/parserDebuggerStatement2.types @@ -0,0 +1,3 @@ +=== tests/cases/conformance/parser/ecmascript5/parserDebuggerStatement2.ts === +debugger; +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parserDoStatement2.types b/tests/baselines/reference/parserDoStatement2.types new file mode 100644 index 00000000000..62790b49103 --- /dev/null +++ b/tests/baselines/reference/parserDoStatement2.types @@ -0,0 +1,3 @@ +=== tests/cases/conformance/parser/ecmascript5/Statements/parserDoStatement2.ts === +do{;}while(false)false +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parserEmptyFile1.types b/tests/baselines/reference/parserEmptyFile1.types new file mode 100644 index 00000000000..d48ac0a4841 --- /dev/null +++ b/tests/baselines/reference/parserEmptyFile1.types @@ -0,0 +1,3 @@ +=== tests/cases/conformance/parser/ecmascript5/parserEmptyFile1.ts === + +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parserEmptyStatement1.types b/tests/baselines/reference/parserEmptyStatement1.types new file mode 100644 index 00000000000..585c87f202b --- /dev/null +++ b/tests/baselines/reference/parserEmptyStatement1.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/parserEmptyStatement1.ts === +; ; +var a = 1; +>a : number + +; + diff --git a/tests/baselines/reference/parserEnum6.types b/tests/baselines/reference/parserEnum6.types new file mode 100644 index 00000000000..9b9e2a4909a --- /dev/null +++ b/tests/baselines/reference/parserEnum6.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum6.ts === +enum E { +>E : E + + "A", "B", "C" +} diff --git a/tests/baselines/reference/parserEnum7.types b/tests/baselines/reference/parserEnum7.types new file mode 100644 index 00000000000..63a77cb9d23 --- /dev/null +++ b/tests/baselines/reference/parserEnum7.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum7.ts === +enum E { +>E : E + + 1, 2, 3 +} diff --git a/tests/baselines/reference/parserEnumDeclaration1.types b/tests/baselines/reference/parserEnumDeclaration1.types new file mode 100644 index 00000000000..86ac928d20f --- /dev/null +++ b/tests/baselines/reference/parserEnumDeclaration1.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1.ts === +enum E { +>E : E + + Foo = 1, +>Foo : E + + Bar +>Bar : E +} diff --git a/tests/baselines/reference/parserEnumDeclaration2.d.types b/tests/baselines/reference/parserEnumDeclaration2.d.types new file mode 100644 index 00000000000..782c530e505 --- /dev/null +++ b/tests/baselines/reference/parserEnumDeclaration2.d.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration2.d.ts === +declare enum E { +>E : E +} diff --git a/tests/baselines/reference/parserEnumDeclaration3.types b/tests/baselines/reference/parserEnumDeclaration3.types new file mode 100644 index 00000000000..a2a5542c060 --- /dev/null +++ b/tests/baselines/reference/parserEnumDeclaration3.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3.ts === +declare enum E { +>E : E + + A = 1 +>A : E +} diff --git a/tests/baselines/reference/parserEnumDeclaration5.types b/tests/baselines/reference/parserEnumDeclaration5.types new file mode 100644 index 00000000000..be3559bd2b9 --- /dev/null +++ b/tests/baselines/reference/parserEnumDeclaration5.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5.ts === +enum E { +>E : E + + A = 1, +>A : E + + B, +>B : E + + C = 2, +>C : E + + D +>D : E +} diff --git a/tests/baselines/reference/parserExportAsFunctionIdentifier.types b/tests/baselines/reference/parserExportAsFunctionIdentifier.types new file mode 100644 index 00000000000..6e8fb29287f --- /dev/null +++ b/tests/baselines/reference/parserExportAsFunctionIdentifier.types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/parser/ecmascript5/parserExportAsFunctionIdentifier.ts === +interface Foo { +>Foo : Foo + + export(): string; +>export : () => string +} + +var f: Foo; +>f : Foo +>Foo : Foo + +var x = f.export(); +>x : string +>f.export() : string +>f.export : () => string +>f : Foo +>export : () => string + diff --git a/tests/baselines/reference/parserFunctionDeclaration1.d.types b/tests/baselines/reference/parserFunctionDeclaration1.d.types new file mode 100644 index 00000000000..cb62ab01c90 --- /dev/null +++ b/tests/baselines/reference/parserFunctionDeclaration1.d.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration1.d.ts === +declare function F(); +>F : () => any + diff --git a/tests/baselines/reference/parserFunctionDeclaration5.types b/tests/baselines/reference/parserFunctionDeclaration5.types new file mode 100644 index 00000000000..a3cf71336ea --- /dev/null +++ b/tests/baselines/reference/parserFunctionDeclaration5.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration5.ts === +function foo(); +>foo : () => any + +function foo() { } +>foo : () => any + diff --git a/tests/baselines/reference/parserFunctionDeclaration8.types b/tests/baselines/reference/parserFunctionDeclaration8.types new file mode 100644 index 00000000000..ebb8ff8d409 --- /dev/null +++ b/tests/baselines/reference/parserFunctionDeclaration8.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration8.ts === +declare module M { +>M : typeof M + + function foo(); +>foo : () => any +} diff --git a/tests/baselines/reference/parserFunctionPropertyAssignment1.types b/tests/baselines/reference/parserFunctionPropertyAssignment1.types new file mode 100644 index 00000000000..d84e798d023 --- /dev/null +++ b/tests/baselines/reference/parserFunctionPropertyAssignment1.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/PropertyAssignments/parserFunctionPropertyAssignment1.ts === +var v = { foo() { } }; +>v : { foo: () => void; } +>{ foo() { } } : { foo: () => void; } +>foo : () => void +>foo() { } : () => void + diff --git a/tests/baselines/reference/parserFunctionPropertyAssignment2.types b/tests/baselines/reference/parserFunctionPropertyAssignment2.types new file mode 100644 index 00000000000..21d182993bb --- /dev/null +++ b/tests/baselines/reference/parserFunctionPropertyAssignment2.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/PropertyAssignments/parserFunctionPropertyAssignment2.ts === +var v = { 0() { } }; +>v : { 0: () => void; } +>{ 0() { } } : { 0: () => void; } +>0() { } : () => void + diff --git a/tests/baselines/reference/parserFunctionPropertyAssignment3.types b/tests/baselines/reference/parserFunctionPropertyAssignment3.types new file mode 100644 index 00000000000..2c76fdf07a4 --- /dev/null +++ b/tests/baselines/reference/parserFunctionPropertyAssignment3.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/PropertyAssignments/parserFunctionPropertyAssignment3.ts === +var v = { "foo"() { } }; +>v : { "foo": () => void; } +>{ "foo"() { } } : { "foo": () => void; } +>"foo"() { } : () => void + diff --git a/tests/baselines/reference/parserFunctionPropertyAssignment4.types b/tests/baselines/reference/parserFunctionPropertyAssignment4.types new file mode 100644 index 00000000000..4aec89e265f --- /dev/null +++ b/tests/baselines/reference/parserFunctionPropertyAssignment4.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/PropertyAssignments/parserFunctionPropertyAssignment4.ts === +var v = { 0() { } }; +>v : { 0: () => void; } +>{ 0() { } } : { 0: () => void; } +>0() { } : () => void +>T : T + diff --git a/tests/baselines/reference/parserGenericClass1.types b/tests/baselines/reference/parserGenericClass1.types new file mode 100644 index 00000000000..546da49f9ab --- /dev/null +++ b/tests/baselines/reference/parserGenericClass1.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass1.ts === +class C { +>C : C +>T : T +} diff --git a/tests/baselines/reference/parserGenericClass2.types b/tests/baselines/reference/parserGenericClass2.types new file mode 100644 index 00000000000..b577eef39f3 --- /dev/null +++ b/tests/baselines/reference/parserGenericClass2.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass2.ts === +class C { +>C : C +>K : K +>V : V +} diff --git a/tests/baselines/reference/parserGenericConstraint1.types b/tests/baselines/reference/parserGenericConstraint1.types new file mode 100644 index 00000000000..2b03617861c --- /dev/null +++ b/tests/baselines/reference/parserGenericConstraint1.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/Generics/parserGenericConstraint1.ts === +class C { +>C : C +>T : T +} diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity1.types b/tests/baselines/reference/parserGreaterThanTokenAmbiguity1.types new file mode 100644 index 00000000000..451ff65cdd9 --- /dev/null +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity1.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity1.ts === +1 >> 2; +>1 >> 2 : number + diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.types b/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.types new file mode 100644 index 00000000000..09626481336 --- /dev/null +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity10.ts === +1 +>1 +// before +>>> // after +2 : number + +// before +>>> // after +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.types b/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.types new file mode 100644 index 00000000000..e62528a1e1f --- /dev/null +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity5.ts === +1 +>1 +// before +>> // after +2 : number + +// before +>> // after +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity6.types b/tests/baselines/reference/parserGreaterThanTokenAmbiguity6.types new file mode 100644 index 00000000000..fc7616eef90 --- /dev/null +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity6.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity6.ts === +1 >>> 2; +>1 >>> 2 : number + diff --git a/tests/baselines/reference/parserIndexMemberDeclaration1.types b/tests/baselines/reference/parserIndexMemberDeclaration1.types new file mode 100644 index 00000000000..83bcfe79678 --- /dev/null +++ b/tests/baselines/reference/parserIndexMemberDeclaration1.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration1.ts === +class C { +>C : C + + [a: string]: number +>a : string +} diff --git a/tests/baselines/reference/parserIndexMemberDeclaration2.types b/tests/baselines/reference/parserIndexMemberDeclaration2.types new file mode 100644 index 00000000000..00ef9a54880 --- /dev/null +++ b/tests/baselines/reference/parserIndexMemberDeclaration2.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration2.ts === +class C { +>C : C + + [a: string]: number +>a : string + + public v: number +>v : number +} diff --git a/tests/baselines/reference/parserIndexMemberDeclaration3.types b/tests/baselines/reference/parserIndexMemberDeclaration3.types new file mode 100644 index 00000000000..15a7d63ab8a --- /dev/null +++ b/tests/baselines/reference/parserIndexMemberDeclaration3.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration3.ts === +class C { +>C : C + + [a: string]: number; +>a : string + + public v: number +>v : number +} diff --git a/tests/baselines/reference/parserIndexMemberDeclaration4.types b/tests/baselines/reference/parserIndexMemberDeclaration4.types new file mode 100644 index 00000000000..a8d8880261d --- /dev/null +++ b/tests/baselines/reference/parserIndexMemberDeclaration4.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration4.ts === +class C { +>C : C + + [a: string]: number; public v: number +>a : string +>v : number +} diff --git a/tests/baselines/reference/parserInterfaceKeywordInEnum.types b/tests/baselines/reference/parserInterfaceKeywordInEnum.types new file mode 100644 index 00000000000..aa71126883d --- /dev/null +++ b/tests/baselines/reference/parserInterfaceKeywordInEnum.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum.ts === +enum Bar { +>Bar : Bar + + interface, +>interface : Bar +} + diff --git a/tests/baselines/reference/parserInterfaceKeywordInEnum1.types b/tests/baselines/reference/parserInterfaceKeywordInEnum1.types new file mode 100644 index 00000000000..f17bfeacf88 --- /dev/null +++ b/tests/baselines/reference/parserInterfaceKeywordInEnum1.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1.ts === +"use strict"; + +enum Bar { +>Bar : Bar + + interface, +>interface : Bar +} + diff --git a/tests/baselines/reference/parserKeywordsAsIdentifierName1.types b/tests/baselines/reference/parserKeywordsAsIdentifierName1.types new file mode 100644 index 00000000000..e940f534c1e --- /dev/null +++ b/tests/baselines/reference/parserKeywordsAsIdentifierName1.types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/parser/ecmascript5/parserKeywordsAsIdentifierName1.ts === +var big = { +>big : { break: number; super: number; const: number; } +>{ + break : 0, + super : 0, + const : 0 +} : { break: number; super: number; const: number; } + + break : 0, +>break : number + + super : 0, +>super : number + + const : 0 +>const : number +} + diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration4.types b/tests/baselines/reference/parserMemberAccessorDeclaration4.types new file mode 100644 index 00000000000..de4bc245d2e --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessorDeclaration4.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration4.ts === +class C { +>C : C + + set a(i) { } +>a : any +>i : any +} diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration5.types b/tests/baselines/reference/parserMemberAccessorDeclaration5.types new file mode 100644 index 00000000000..d22ee2d775a --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessorDeclaration5.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration5.ts === +class C { +>C : C + + set "a"(i) { } +>i : any +} diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration6.types b/tests/baselines/reference/parserMemberAccessorDeclaration6.types new file mode 100644 index 00000000000..a06b6ddfa0c --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessorDeclaration6.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration6.ts === +class C { +>C : C + + set 0(i) { } +>i : any +} diff --git a/tests/baselines/reference/parserMethodSignature1.types b/tests/baselines/reference/parserMethodSignature1.types new file mode 100644 index 00000000000..fe016067294 --- /dev/null +++ b/tests/baselines/reference/parserMethodSignature1.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/MethodSignatures/parserMethodSignature1.ts === +interface I { +>I : I + + A(); +>A : () => any +} diff --git a/tests/baselines/reference/parserMethodSignature10.types b/tests/baselines/reference/parserMethodSignature10.types new file mode 100644 index 00000000000..34b3bfcbd33 --- /dev/null +++ b/tests/baselines/reference/parserMethodSignature10.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/MethodSignatures/parserMethodSignature10.ts === +interface I { +>I : I + + 1?(); +} diff --git a/tests/baselines/reference/parserMethodSignature11.types b/tests/baselines/reference/parserMethodSignature11.types new file mode 100644 index 00000000000..f47eda1e9cd --- /dev/null +++ b/tests/baselines/reference/parserMethodSignature11.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/MethodSignatures/parserMethodSignature11.ts === +interface I { +>I : I + + 2(); +>T : T +} diff --git a/tests/baselines/reference/parserMethodSignature12.types b/tests/baselines/reference/parserMethodSignature12.types new file mode 100644 index 00000000000..b5b38fadb4b --- /dev/null +++ b/tests/baselines/reference/parserMethodSignature12.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/MethodSignatures/parserMethodSignature12.ts === +interface I { +>I : I + + 3?(); +>T : T +} diff --git a/tests/baselines/reference/parserMethodSignature2.types b/tests/baselines/reference/parserMethodSignature2.types new file mode 100644 index 00000000000..380c66c6a87 --- /dev/null +++ b/tests/baselines/reference/parserMethodSignature2.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/MethodSignatures/parserMethodSignature2.ts === +interface I { +>I : I + + B?(); +>B : () => any +} diff --git a/tests/baselines/reference/parserMethodSignature3.types b/tests/baselines/reference/parserMethodSignature3.types new file mode 100644 index 00000000000..c08081993fd --- /dev/null +++ b/tests/baselines/reference/parserMethodSignature3.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/MethodSignatures/parserMethodSignature3.ts === +interface I { +>I : I + + C(); +>C : () => any +>T : T +} diff --git a/tests/baselines/reference/parserMethodSignature4.types b/tests/baselines/reference/parserMethodSignature4.types new file mode 100644 index 00000000000..e569b8e36a5 --- /dev/null +++ b/tests/baselines/reference/parserMethodSignature4.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/MethodSignatures/parserMethodSignature4.ts === +interface I { +>I : I + + D?(); +>D : () => any +>T : T +} diff --git a/tests/baselines/reference/parserMethodSignature5.types b/tests/baselines/reference/parserMethodSignature5.types new file mode 100644 index 00000000000..86053a7c1f8 --- /dev/null +++ b/tests/baselines/reference/parserMethodSignature5.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/MethodSignatures/parserMethodSignature5.ts === +interface I { +>I : I + + "E"(); +} diff --git a/tests/baselines/reference/parserMethodSignature6.types b/tests/baselines/reference/parserMethodSignature6.types new file mode 100644 index 00000000000..184cdc1148a --- /dev/null +++ b/tests/baselines/reference/parserMethodSignature6.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/MethodSignatures/parserMethodSignature6.ts === +interface I { +>I : I + + "F"?(); +} diff --git a/tests/baselines/reference/parserMethodSignature7.types b/tests/baselines/reference/parserMethodSignature7.types new file mode 100644 index 00000000000..58a029c0a4a --- /dev/null +++ b/tests/baselines/reference/parserMethodSignature7.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/MethodSignatures/parserMethodSignature7.ts === +interface I { +>I : I + + "G"(); +>T : T +} diff --git a/tests/baselines/reference/parserMethodSignature8.types b/tests/baselines/reference/parserMethodSignature8.types new file mode 100644 index 00000000000..7480e3d92a2 --- /dev/null +++ b/tests/baselines/reference/parserMethodSignature8.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/MethodSignatures/parserMethodSignature8.ts === +interface I { +>I : I + + "H"?(); +>T : T +} diff --git a/tests/baselines/reference/parserMethodSignature9.types b/tests/baselines/reference/parserMethodSignature9.types new file mode 100644 index 00000000000..ac2f85d002d --- /dev/null +++ b/tests/baselines/reference/parserMethodSignature9.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/MethodSignatures/parserMethodSignature9.ts === +interface I { +>I : I + + 0(); +} diff --git a/tests/baselines/reference/parserModifierOnPropertySignature2.types b/tests/baselines/reference/parserModifierOnPropertySignature2.types new file mode 100644 index 00000000000..adf8b411565 --- /dev/null +++ b/tests/baselines/reference/parserModifierOnPropertySignature2.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnPropertySignature2.ts === +interface Foo{ +>Foo : Foo + + public +>public : any + + biz; +>biz : any +} + diff --git a/tests/baselines/reference/parserModuleDeclaration11.types b/tests/baselines/reference/parserModuleDeclaration11.types new file mode 100644 index 00000000000..23c74ae1538 --- /dev/null +++ b/tests/baselines/reference/parserModuleDeclaration11.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration11.ts === +declare module string { +>string : typeof string + + interface X { } +>X : X + + export function foo(s: string); +>foo : (s: string) => any +>s : string +} +string.foo("abc"); +>string.foo("abc") : any +>string.foo : (s: string) => any +>string : typeof string +>foo : (s: string) => any + +var x: string.X; +>x : X +>string : string +>X : X + diff --git a/tests/baselines/reference/parserModuleDeclaration12.types b/tests/baselines/reference/parserModuleDeclaration12.types new file mode 100644 index 00000000000..1c3d9e39906 --- /dev/null +++ b/tests/baselines/reference/parserModuleDeclaration12.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration12.ts === +module A.string { +>A : A +>string : string +} diff --git a/tests/baselines/reference/parserModuleDeclaration2.types b/tests/baselines/reference/parserModuleDeclaration2.types new file mode 100644 index 00000000000..340cee697f1 --- /dev/null +++ b/tests/baselines/reference/parserModuleDeclaration2.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration2.ts === +declare module "Foo" { +No type information for this code.} +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parserModuleDeclaration3.d.types b/tests/baselines/reference/parserModuleDeclaration3.d.types new file mode 100644 index 00000000000..221078dacb7 --- /dev/null +++ b/tests/baselines/reference/parserModuleDeclaration3.d.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration3.d.ts === +declare module M { +>M : M +} diff --git a/tests/baselines/reference/parserModuleDeclaration4.types b/tests/baselines/reference/parserModuleDeclaration4.types new file mode 100644 index 00000000000..625691557e4 --- /dev/null +++ b/tests/baselines/reference/parserModuleDeclaration4.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration4.ts === +module M { +>M : M + + declare module M1 { +>M1 : M1 + + module M2 { +>M2 : M2 + } + } +} diff --git a/tests/baselines/reference/parserModuleDeclaration6.types b/tests/baselines/reference/parserModuleDeclaration6.types new file mode 100644 index 00000000000..7d11c0a5ce3 --- /dev/null +++ b/tests/baselines/reference/parserModuleDeclaration6.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration6.ts === +module number { +>number : number +} diff --git a/tests/baselines/reference/parserModuleDeclaration7.types b/tests/baselines/reference/parserModuleDeclaration7.types new file mode 100644 index 00000000000..a593c2051a4 --- /dev/null +++ b/tests/baselines/reference/parserModuleDeclaration7.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration7.ts === +module number.a { +>number : number +>a : a +} diff --git a/tests/baselines/reference/parserModuleDeclaration8.types b/tests/baselines/reference/parserModuleDeclaration8.types new file mode 100644 index 00000000000..9247cebe11f --- /dev/null +++ b/tests/baselines/reference/parserModuleDeclaration8.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration8.ts === +module a.number { +>a : a +>number : number +} diff --git a/tests/baselines/reference/parserModuleDeclaration9.types b/tests/baselines/reference/parserModuleDeclaration9.types new file mode 100644 index 00000000000..cb3ab79e93d --- /dev/null +++ b/tests/baselines/reference/parserModuleDeclaration9.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration9.ts === +module a.number.b { +>a : a +>number : number +>b : b +} diff --git a/tests/baselines/reference/parserObjectLiterals1.types b/tests/baselines/reference/parserObjectLiterals1.types new file mode 100644 index 00000000000..c38adbf55b6 --- /dev/null +++ b/tests/baselines/reference/parserObjectLiterals1.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/ObjectLiterals/parserObjectLiterals1.ts === +var v = { a: 1, b: 2 }; +>v : { a: number; b: number; } +>{ a: 1, b: 2 } : { a: number; b: number; } +>a : number +>b : number + diff --git a/tests/baselines/reference/parserObjectType1.types b/tests/baselines/reference/parserObjectType1.types new file mode 100644 index 00000000000..4f333a41c4d --- /dev/null +++ b/tests/baselines/reference/parserObjectType1.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/ObjectTypes/parserObjectType1.ts === +var v: {}; +>v : {} + diff --git a/tests/baselines/reference/parserObjectType2.types b/tests/baselines/reference/parserObjectType2.types new file mode 100644 index 00000000000..cdc055a1660 --- /dev/null +++ b/tests/baselines/reference/parserObjectType2.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/ObjectTypes/parserObjectType2.ts === +var v: { x: number }; +>v : { x: number; } +>x : number + diff --git a/tests/baselines/reference/parserObjectType3.types b/tests/baselines/reference/parserObjectType3.types new file mode 100644 index 00000000000..2cc6e50e807 --- /dev/null +++ b/tests/baselines/reference/parserObjectType3.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/parser/ecmascript5/ObjectTypes/parserObjectType3.ts === +var v: { +>v : { x: any; y: any; } + + x; +>x : any + + y +>y : any + +}; diff --git a/tests/baselines/reference/parserObjectType4.types b/tests/baselines/reference/parserObjectType4.types new file mode 100644 index 00000000000..bbed75a7478 --- /dev/null +++ b/tests/baselines/reference/parserObjectType4.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/parser/ecmascript5/ObjectTypes/parserObjectType4.ts === +var v: { +>v : { x: any; y: any; } + + x +>x : any + + y +>y : any + +}; diff --git a/tests/baselines/reference/parserPropertySignature1.types b/tests/baselines/reference/parserPropertySignature1.types new file mode 100644 index 00000000000..43a754c7751 --- /dev/null +++ b/tests/baselines/reference/parserPropertySignature1.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/PropertySignatures/parserPropertySignature1.ts === +interface I { +>I : I + + A; +>A : any +} diff --git a/tests/baselines/reference/parserPropertySignature10.types b/tests/baselines/reference/parserPropertySignature10.types new file mode 100644 index 00000000000..06d1e78f0f1 --- /dev/null +++ b/tests/baselines/reference/parserPropertySignature10.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/PropertySignatures/parserPropertySignature10.ts === +interface I { +>I : I + + 1?; +} diff --git a/tests/baselines/reference/parserPropertySignature11.types b/tests/baselines/reference/parserPropertySignature11.types new file mode 100644 index 00000000000..55776f4f820 --- /dev/null +++ b/tests/baselines/reference/parserPropertySignature11.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/PropertySignatures/parserPropertySignature11.ts === +interface I { +>I : I + + 2:any; +} diff --git a/tests/baselines/reference/parserPropertySignature12.types b/tests/baselines/reference/parserPropertySignature12.types new file mode 100644 index 00000000000..1c37dcaa460 --- /dev/null +++ b/tests/baselines/reference/parserPropertySignature12.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/PropertySignatures/parserPropertySignature12.ts === +interface I { +>I : I + + 3?:any; +} diff --git a/tests/baselines/reference/parserPropertySignature2.types b/tests/baselines/reference/parserPropertySignature2.types new file mode 100644 index 00000000000..fe67046e238 --- /dev/null +++ b/tests/baselines/reference/parserPropertySignature2.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/PropertySignatures/parserPropertySignature2.ts === +interface I { +>I : I + + B?; +>B : any +} diff --git a/tests/baselines/reference/parserPropertySignature3.types b/tests/baselines/reference/parserPropertySignature3.types new file mode 100644 index 00000000000..04c3d21b0a1 --- /dev/null +++ b/tests/baselines/reference/parserPropertySignature3.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/PropertySignatures/parserPropertySignature3.ts === +interface I { +>I : I + + C:any; +>C : any +} diff --git a/tests/baselines/reference/parserPropertySignature4.types b/tests/baselines/reference/parserPropertySignature4.types new file mode 100644 index 00000000000..c1dda0e533d --- /dev/null +++ b/tests/baselines/reference/parserPropertySignature4.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/PropertySignatures/parserPropertySignature4.ts === +interface I { +>I : I + + D?:any; +>D : any +} diff --git a/tests/baselines/reference/parserPropertySignature5.types b/tests/baselines/reference/parserPropertySignature5.types new file mode 100644 index 00000000000..c85c814fc70 --- /dev/null +++ b/tests/baselines/reference/parserPropertySignature5.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/PropertySignatures/parserPropertySignature5.ts === +interface I { +>I : I + + "E"; +} diff --git a/tests/baselines/reference/parserPropertySignature6.types b/tests/baselines/reference/parserPropertySignature6.types new file mode 100644 index 00000000000..94ca4e313df --- /dev/null +++ b/tests/baselines/reference/parserPropertySignature6.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/PropertySignatures/parserPropertySignature6.ts === +interface I { +>I : I + + "F"?; +} diff --git a/tests/baselines/reference/parserPropertySignature7.types b/tests/baselines/reference/parserPropertySignature7.types new file mode 100644 index 00000000000..0f78332d756 --- /dev/null +++ b/tests/baselines/reference/parserPropertySignature7.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/PropertySignatures/parserPropertySignature7.ts === +interface I { +>I : I + + "G":any; +} diff --git a/tests/baselines/reference/parserPropertySignature8.types b/tests/baselines/reference/parserPropertySignature8.types new file mode 100644 index 00000000000..79594cec56a --- /dev/null +++ b/tests/baselines/reference/parserPropertySignature8.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/PropertySignatures/parserPropertySignature8.ts === +interface I { +>I : I + + "H"?:any; +} diff --git a/tests/baselines/reference/parserPropertySignature9.types b/tests/baselines/reference/parserPropertySignature9.types new file mode 100644 index 00000000000..b7dbff8cbee --- /dev/null +++ b/tests/baselines/reference/parserPropertySignature9.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/PropertySignatures/parserPropertySignature9.ts === +interface I { +>I : I + + 0; +} diff --git a/tests/baselines/reference/parserReturnStatement3.types b/tests/baselines/reference/parserReturnStatement3.types new file mode 100644 index 00000000000..6484050efee --- /dev/null +++ b/tests/baselines/reference/parserReturnStatement3.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/Statements/ReturnStatements/parserReturnStatement3.ts === +function f() { +>f : () => void + + return; +} diff --git a/tests/baselines/reference/parserS7.6.1.1_A1.10.types b/tests/baselines/reference/parserS7.6.1.1_A1.10.types new file mode 100644 index 00000000000..28441e36fe6 --- /dev/null +++ b/tests/baselines/reference/parserS7.6.1.1_A1.10.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/parser/ecmascript5/parserS7.6.1.1_A1.10.ts === +// Copyright 2009 the Sputnik authors. All rights reserved. +No type information for this code.// This code is governed by the BSD license found in the LICENSE file. +No type information for this code. +No type information for this code./** +No type information for this code. * The "for" token can not be used as identifier +No type information for this code. * +No type information for this code. * @path ch07/7.6/7.6.1/7.6.1.1/S7.6.1.1_A1.10.js +No type information for this code. * @description Checking if execution of "for=1" fails +No type information for this code. * @negative +No type information for this code. */ +No type information for this code. +No type information for this code.//for = 1; +No type information for this code. +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parserSbp_7.9_A9_T3.types b/tests/baselines/reference/parserSbp_7.9_A9_T3.types new file mode 100644 index 00000000000..0d6df58ed39 --- /dev/null +++ b/tests/baselines/reference/parserSbp_7.9_A9_T3.types @@ -0,0 +1,18 @@ +=== tests/cases/conformance/parser/ecmascript5/parserSbp_7.9_A9_T3.ts === +// Copyright 2009 the Sputnik authors. All rights reserved. +No type information for this code.// This code is governed by the BSD license found in the LICENSE file. +No type information for this code. +No type information for this code./** +No type information for this code. * Check Do-While Statement for automatic semicolon insertion +No type information for this code. * +No type information for this code. * @path bestPractice/Sbp_7.9_A9_T3.js +No type information for this code. * @description Execute do { \n ; \n }while(false) true +No type information for this code. */ +No type information for this code. +No type information for this code.//CHECK#1 +No type information for this code.do { +No type information for this code. ; +No type information for this code.} while (false) true +No type information for this code. +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parserStrictMode16.types b/tests/baselines/reference/parserStrictMode16.types new file mode 100644 index 00000000000..6e68c0cbc6b --- /dev/null +++ b/tests/baselines/reference/parserStrictMode16.types @@ -0,0 +1,15 @@ +=== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts === +"use strict"; +delete this; +>delete this : boolean +>this : any + +delete 1; +>delete 1 : boolean + +delete null; +>delete null : boolean + +delete "a"; +>delete "a" : boolean + diff --git a/tests/baselines/reference/parserSyntaxWalker.generated.types b/tests/baselines/reference/parserSyntaxWalker.generated.types new file mode 100644 index 00000000000..dde34e06746 --- /dev/null +++ b/tests/baselines/reference/parserSyntaxWalker.generated.types @@ -0,0 +1,281 @@ +=== tests/cases/conformance/parser/ecmascript5/parserSyntaxWalker.generated.ts === +//declare module "fs" { +No type information for this code.// export class File { +No type information for this code.// constructor(filename: string); +No type information for this code.// public ReadAllText(): string; +No type information for this code.// } +No type information for this code.// export interface IFile { +No type information for this code.// [index: number]: string; +No type information for this code.// } +No type information for this code.//} +No type information for this code. +No type information for this code.//import fs = module("fs"); +No type information for this code. +No type information for this code. +No type information for this code.//module TypeScriptAllInOne { +No type information for this code.// export class Program { +No type information for this code.// static Main(...args: string[]) { +No type information for this code.// try { +No type information for this code.// var bfs = new BasicFeatures(); +No type information for this code.// var retValue: number = 0; +No type information for this code. +No type information for this code.// retValue = bfs.VARIABLES(); +No type information for this code.// if (retValue != 0) { +No type information for this code. +No type information for this code.// return 1; +No type information for this code.// } +No type information for this code. +No type information for this code.// retValue = bfs.STATEMENTS(4); +No type information for this code.// if (retValue != 0) { +No type information for this code. +No type information for this code.// return 1; +No type information for this code.// } +No type information for this code. +No type information for this code. +No type information for this code.// retValue = bfs.TYPES(); +No type information for this code.// if (retValue != 0) { +No type information for this code. +No type information for this code.// return 1; +No type information for this code.// } +No type information for this code. +No type information for this code.// retValue = bfs.OPERATOR(); +No type information for this code.// if (retValue != 0) { +No type information for this code. +No type information for this code.// return 1; +No type information for this code.// } +No type information for this code.// } +No type information for this code.// catch (e) { +No type information for this code.// console.log(e); +No type information for this code.// } +No type information for this code.// finally { +No type information for this code. +No type information for this code.// } +No type information for this code. +No type information for this code.// console.log('Done'); +No type information for this code. +No type information for this code.// return 0; +No type information for this code. +No type information for this code.// } +No type information for this code.// } +No type information for this code. +No type information for this code.// class BasicFeatures { +No type information for this code.// /// +No type information for this code.// /// Test various of variables. Including nullable,key world as variable,special format +No type information for this code.// /// +No type information for this code.// /// +No type information for this code.// public VARIABLES(): number { +No type information for this code.// var local = Number.MAX_VALUE; +No type information for this code.// var min = Number.MIN_VALUE; +No type information for this code.// var inf = Number.NEGATIVE_INFINITY; +No type information for this code.// var nan = Number.NaN; +No type information for this code.// var undef = undefined; +No type information for this code. +No type information for this code.// var п = local; +No type information for this code.// var м = local; +No type information for this code. +No type information for this code.// var local5 = null; +No type information for this code.// var local6 = local5 instanceof fs.File; +No type information for this code. +No type information for this code.// var hex = 0xBADC0DE, Hex = 0XDEADBEEF; +No type information for this code.// var float = 6.02e23, float2 = 6.02E-23 +No type information for this code.// var char = 'c', \u0066 = '\u0066', hexchar = '\x42'; +No type information for this code.// var quoted = '"', quoted2 = "'"; +No type information for this code.// var reg = /\w*/; +No type information for this code.// var objLit = { "var": number = 42, equals: function (x) { return x["var"] === 42; }, toString: () => 'objLit{42}' }; +No type information for this code.// var weekday = Weekdays.Monday; +No type information for this code. +No type information for this code.// var con = char + f + hexchar + float.toString() + float2.toString() + reg.toString() + objLit + weekday; +No type information for this code. +No type information for this code.// // +No type information for this code.// var any = 0; +No type information for this code.// var boolean = 0; +No type information for this code.// var declare = 0; +No type information for this code.// var constructor = 0; +No type information for this code.// var get = 0; +No type information for this code.// var implements = 0; +No type information for this code.// var interface = 0; +No type information for this code.// var let = 0; +No type information for this code.// var module = 0; +No type information for this code.// var number = 0; +No type information for this code.// var package = 0; +No type information for this code.// var private = 0; +No type information for this code.// var protected = 0; +No type information for this code.// var public = 0; +No type information for this code.// var set = 0; +No type information for this code.// var static = 0; +No type information for this code.// var string = 0; +No type information for this code.// var yield = 0; +No type information for this code. +No type information for this code.// var sum3 = any + boolean + declare + constructor + get + implements + interface + let + module + number + package + private + protected + public + set + static + string + yield; +No type information for this code. +No type information for this code.// return 0; +No type information for this code.// } +No type information for this code. +No type information for this code.// /// +No type information for this code.// /// Test different statements. Including if-else,swith,foreach,(un)checked,lock,using,try-catch-finally +No type information for this code.// /// +No type information for this code.// /// +No type information for this code.// /// +No type information for this code.// STATEMENTS(i: number): number { +No type information for this code.// var retVal = 0; +No type information for this code.// if (i == 1) +No type information for this code.// retVal = 1; +No type information for this code.// else +No type information for this code.// retVal = 0; +No type information for this code.// switch (i) { +No type information for this code.// case 2: +No type information for this code.// retVal = 1; +No type information for this code.// break; +No type information for this code.// case 3: +No type information for this code.// retVal = 1; +No type information for this code.// break; +No type information for this code.// default: +No type information for this code.// break; +No type information for this code.// } +No type information for this code. +No type information for this code.// for (var x in { x: 0, y: 1 }) { +No type information for this code.// } +No type information for this code. +No type information for this code.// try { +No type information for this code.// throw null; +No type information for this code.// } +No type information for this code.// catch (Exception) { +No type information for this code.// } +No type information for this code.// finally { +No type information for this code.// try { } +No type information for this code.// catch (Exception) { } +No type information for this code.// } +No type information for this code. +No type information for this code.// return retVal; +No type information for this code.// } +No type information for this code. +No type information for this code.// /// +No type information for this code.// /// Test types in ts language. Including class,struct,interface,delegate,anonymous type +No type information for this code.// /// +No type information for this code.// /// +No type information for this code.// public TYPES(): number { +No type information for this code.// var retVal = 0; +No type information for this code.// var c = new CLASS(); +No type information for this code.// var xx: IF = c; +No type information for this code.// retVal += c.Property; +No type information for this code.// retVal += c.Member(); +No type information for this code.// retVal += xx ^= Foo() ? 0 : 1; +No type information for this code. +No type information for this code.// //anonymous type +No type information for this code.// var anony = { a: new CLASS() }; +No type information for this code. +No type information for this code.// retVal += anony.a.d(); +No type information for this code. +No type information for this code.// return retVal; +No type information for this code.// } +No type information for this code. +No type information for this code. +No type information for this code.// ///// +No type information for this code.// ///// Test different operators +No type information for this code.// ///// +No type information for this code.// ///// +No type information for this code.// public OPERATOR(): number { +No type information for this code.// var a: number[] = [1, 2, 3, 4, implements , ];/*[] bug*/ // YES [] +No type information for this code.// var i = a[1];/*[]*/ +No type information for this code.// i = i + i - i * i / i % i & i | i ^ i;/*+ - * / % & | ^*/ +No type information for this code.// var b = true && false || true ^ false;/*& | ^*/ +No type information for this code.// b = !b;/*!*/ +No type information for this code.// i = ~i;/*~i*/ +No type information for this code.// b = i < (i - continue ) && (i + 1) > i;/*< && >*/ +No type information for this code.// var f = true ? 1 : 0;/*? :*/ // YES : +No type information for this code.// i++;/*++*/ +No type information for this code.// i--;/*--*/ +No type information for this code.// b = true && false || true;/*&& ||*/ +No type information for this code.// i = i << 5;/*<<*/ +No type information for this code.// i = i >> 5;/*>>*/ +No type information for this code.// var j = i; +No type information for this code.// b = i == j && i != j && i <= j && i >= j;/*= == && != <= >=*/ +No type information for this code.// i += 5.0;/*+=*/ +No type information for this code.// i -= i;/*-=*/ +No type information for this code.// i *= i;/**=*/ +No type information for this code.// if (i == 0) +No type information for this code.// i++; +No type information for this code.// i /= i;/*/=*/ +No type information for this code.// i %= i;/*%=*/ +No type information for this code.// i &= i;/*&=*/ +No type information for this code.// i |= i;/*|=*/ +No type information for this code.// i ^= i;/*^=*/ +No type information for this code.// i <<= i;/*<<=*/ +No type information for this code.// i >>= i;/*>>=*/ +No type information for this code. +No type information for this code.// if (i == 0 && !b && f == 1) +No type information for this code.// return 0; +No type information for this code.// else return 1; +No type information for this code.// } +No type information for this code. +No type information for this code.// } +No type information for this code. +No type information for this code.// interface IF { +No type information for this code.// Foo