Commit graph

8045 commits

Author SHA1 Message Date
Mohamed Hegazy 74518a9b7f respond to code review comments 2014-08-20 22:46:47 -07:00
Jason Freeman bfa2e940c0 Support resolution of any part of the RHS of an import 2014-08-19 15:04:30 -07:00
Jason Freeman a8c2f82f3c Temporary fix for import case in getTypeOfNode 2014-08-18 19:56:03 -07:00
Jason Freeman a08aa14a74 Address PR feedback 2014-08-18 18:51:18 -07:00
Jason Freeman d02d9bfa7e Merge branch 'master' into typeWriter
Conflicts:
	src/compiler/checker.ts
2014-08-18 14:37:21 -07:00
Sheetal Nandi 7a5512cdd0 Merge pull request #466 from sparecycles/fix/checker-declaration
fix --declaration typechecking (complex case)
2014-08-18 13:32:50 -07:00
Mohamed Hegazy 922d6d6258 support getReferences on properties and index access wiht numeric and string values 2014-08-18 13:03:35 -07:00
Mohamed Hegazy d419982422 Support getReferences on contextually typed object literal properties 2014-08-18 13:03:25 -07:00
Mohamed Hegazy 55d002117c support getReferences on object literals 2014-08-18 13:00:31 -07:00
Mohamed Hegazy 32a5984601 expose utility functions 2014-08-18 12:40:10 -07:00
Anders Hejlsberg 63b83e7c3f Contextual typing of array literals is now based on the presence or absence
of numerically named properties and doesn't directly test for tuple types.
2014-08-16 12:06:51 -07:00
Anders Hejlsberg 0cf503fd9f Merge branch 'master' into tupleTypes
Conflicts:
	tests/baselines/reference/typeName1.errors.txt
2014-08-16 11:11:59 -07:00
Adam Freidin 06e858ff40 fix --declaration typechecking (complex case)
This fixes generation of typescriptServices.d.ts,
although this is not a current requirement
( https://github.com/Microsoft/TypeScript/issues/465 ).
2014-08-15 20:16:05 -07:00
Vladimir Matveev 804bbac61f Merge pull request #462 from Microsoft/missing_checker
create instance of the checker prior to making any types
2014-08-15 15:50:37 -07:00
Jason Freeman 91c1a81563 Fix isTypeNode to not consider namespace accesses types 2014-08-15 14:37:41 -07:00
Jason Freeman 834a6f71c1 Add logic in checker for getting type of export assignments and imports 2014-08-15 14:37:32 -07:00
Jason Freeman 5574b58d64 Adjust TypeChecker to have separate method for getApparentType 2014-08-15 14:37:29 -07:00
Jason Freeman 537d8785f3 Change getTypeOfNode to take an apparentType flag 2014-08-15 14:36:49 -07:00
Jason Freeman 6b778f103c Handle type declaration nodes 2014-08-15 14:36:02 -07:00
Jason Freeman 12a0909fdd Add getTypeOfNode function to checker API 2014-08-15 14:36:00 -07:00
Vladimir Matveev bf64217615 create instance of the checker prior to making any types 2014-08-15 13:54:19 -07:00
Vladimir Matveev a271b94b9d merge with mastr 2014-08-15 12:06:53 -07:00
Sheetal Nandi f622cb4d11 Merge pull request #381 from branch 'remote/privacyErrors'
Report privacy errors on variable/property declarations and also emit import declarations that get used to defined visible type
2014-08-13 18:48:05 -07:00
Vladimir Matveev 8475a33bc6 added comment to fullTypeCheck parameter 2014-08-13 16:22:56 -07:00
Vladimir Matveev 72fc5dbf9b added fullTypeCheckFlag to TypeChecker 2014-08-13 15:12:51 -07:00
Anders Hejlsberg ef52312644 Addressing CR feedback. 2014-08-13 07:15:13 -07:00
Mohamed Hegazy d353fcdfb3 remove fullTypeCheck flag as it may lead to missing errors if we make any requests with fullTypeCheck=false and we cache any result 2014-08-12 17:34:30 -07:00
Anders Hejlsberg 3b1dbadb88 Addressing CR feedback, adding baselines. 2014-08-11 14:52:32 -07:00
Sheetal Nandi 98f631e23f Make changes to report error if the type used from external module cannot be named
Adds test cases too
2014-08-11 14:15:57 -07:00
Anders Hejlsberg 5b255243c9 Adding support for tuple types (e.g. [number, string]) 2014-08-11 12:21:26 -07:00
Sheetal Nandi e27e6b2bbb During qualification if we are looking in value space, the left qualifier meaning is also value 2014-08-08 17:07:00 -07:00
Sheetal Nandi 09ea12d95c Use typeof function in the declaration emitter instead of unwinding first level 2014-08-08 16:15:09 -07:00
Anders Hejlsberg 11492cb05d Simplifying createArrayType recursion check.
I made these changes during some unrelated experiments but I'd like to keep them.
2014-08-08 14:12:47 -07:00
Sheetal Nandi 1347621d0c Report error if the entityname reference in the import declaration is using private module 2014-08-08 13:56:53 -07:00
Sheetal Nandi c643f39557 Check for the accessible symbol from exported import
eg:
// @Filename: w1.ts
export = Widget1
class Widget1 { name = 'one'; }

// @Filename: exporter.ts
export import w = require('./w1');

// @Filename: consumer.ts
import e = require('./exporter');

export function w(): e.w { // Should be OK
    return new e.w();
}

In this looking for the name of return type of function w,
not just look for the alias == SymbolOfReturnType but also
look for alias.exportedSymbols === symbolOfReturnType
and qualify it during the toString
2014-08-08 12:57:59 -07:00
Sheetal Nandi 4801c3447f Emit the declarations for the chained import usage in the export assignment 2014-08-07 12:24:28 -07:00
Vladimir Matveev 02d0b024c6 Merge pull request #378 from Microsoft/inherited_overloads_with_specialized_signatures
do not reorder signatures from derived and base types
2014-08-07 10:35:47 -07:00
Vladimir Matveev e642086d56 fix comment 2014-08-07 10:26:18 -07:00
Sheetal Nandi 5810bfed6d Ambient module declarations (exception import declaration) are visible 2014-08-06 15:13:06 -07:00
Vladimir Matveev 236e24b468 do not reorder signatures from derived and base types 2014-08-06 13:39:09 -07:00
Sheetal Nandi 875d0c0c75 Emit unexported aliases that need to be emitted to .d.ts to make correct result 2014-08-06 13:12:49 -07:00
Sheetal Nandi 5c4009a163 Merge pull request #161 from Microsoft/privacyErrors
Report errors for usage of private types when generating declaration file
2014-08-06 11:51:55 -07:00
Sheetal Nandi e31aa9e12a Added more comments and todos as per code review feedback 2014-08-06 11:26:34 -07:00
Mohamed Hegazy ab05b75297 Merge pull request #326 from Microsoft/getDefinition
Wire getDefinitionAtPosition using the new compiler implementation
2014-08-04 15:11:58 -07:00
Vladimir Matveev 017a76bd85 Merge pull request #357 from Microsoft/specialized_signatures
fixed check for call\construct signatures in interfaces
2014-08-04 15:11:44 -07:00
Mohamed Hegazy 2ae1432644 Merge branch 'master' into getDefinition 2014-08-04 15:08:26 -07:00
Mohamed Hegazy a48ec090ae add missing semicolons 2014-08-04 15:07:42 -07:00
Vladimir Matveev 3fc10ed809 fix misplaced brackets 2014-08-04 15:05:15 -07:00
Vladimir Matveev 059b57f417 fixed check for call\construct signatures in interfaces 2014-08-04 14:37:24 -07:00
Anders Hejlsberg 7fc1b8c4ec Merge pull request #355 from Microsoft/pullContextualTypes3
Consistently record contextual types in function expressions.
2014-08-04 14:36:43 -07:00
Mohamed Hegazy 3c0fd5324c Merge branch 'master' into getDefinition 2014-08-04 13:43:14 -07:00
Mohamed Hegazy f8228e1544 Change variabel names:
* documentsByName to sourceFilesByName
* getSymbolOfIdentifierLikeNode to getSymbolInfo
2014-08-04 13:37:17 -07:00
Dick van den Brink c9c8748152 Code style: Missing semicolons 2014-08-04 22:32:32 +02:00
Anders Hejlsberg 261ff5b338 Consistently record contextual types in function expressions.
Removing check that would guard against recording contextual type. The NodeFlags.ContextChecked flag already
protects against assigning more than once.
2014-08-04 12:58:33 -07:00
Mohamed Hegazy 1667894ec6 Merge branch 'master' into getDefinition 2014-08-04 12:52:27 -07:00
Mohamed Hegazy a061f99541 undo moving unknownSymbol to global 2014-08-04 12:52:19 -07:00
Anders Hejlsberg 6b2a970ff3 Fix duplicate getTypeOfExpression function. 2014-08-04 11:58:32 -07:00
Anders Hejlsberg 9a5324347e Merge pull request #330 from Microsoft/pullContextualTypes
Pull model for contextual types
2014-08-04 11:51:23 -07:00
Anders Hejlsberg 2b26e37976 Addressing CR feedback. 2014-08-04 11:40:56 -07:00
Anders Hejlsberg 116401b2c8 Addressing CR feedback.
checkImplicitAny now returns void.
2014-08-03 15:53:06 -07:00
Mohamed Hegazy 8606873db6 move identifier-like node handleing (e.g. super, this, string property access etc..) to the checker 2014-08-01 17:11:11 -07:00
Vladimir Matveev b43d694ec1 move exportAssignSymbol to symbolLinks 2014-08-01 13:09:06 -07:00
Mohamed Hegazy a303c1eb27 Update getSymbolOfIdentifier to ensure we are gettting the alas symbol in both type and value positions 2014-08-01 12:55:20 -07:00
Mohamed Hegazy 12490755a8 Fix typos 2014-08-01 11:26:31 -07:00
Anders Hejlsberg 5d25821cff Introduced fullTypeCheck flag.
checkFunctionExpression only type checks function body if fullTypeCheck is true.
2014-08-01 08:13:38 -07:00
Mohamed Hegazy c406662bc4 Wire getDefinitionAtPosition using the new compiler implementation 2014-07-31 19:58:18 -07:00
Mohamed Hegazy 732ffc0d5d More changes to address code review comments 2014-07-31 19:04:55 -07:00
Mohamed Hegazy 61436368b5 Merge branch 'master' into ls 2014-07-31 18:43:53 -07:00
Anders Hejlsberg bd97ba443a Restructuring and cleanup.
Changed binder to record catch clause instead of catch variable as symbol declaration.
Restructuring of getTypeOfVariableDeclaration and getTypeOfVariableOrParameterOrProperty methods.
Restructuring of checkFunctionExpression method.
2014-07-31 15:48:03 -07:00
Vladimir Matveev ed26563146 Merge pull request #317 from Microsoft/order_of_overloads
Disallow statements between overloads
fixed #75 and #92
2014-07-31 11:37:34 -07:00
Vladimir Matveev a62b47eace addressed CR feedback: changed error message 2014-07-31 11:06:42 -07:00
Vladimir Matveev 59b1e46102 disallow statements between overloads 2014-07-30 16:27:13 -07:00
Anders Hejlsberg 8199b0b236 Pull model for contextual types.
New baselines reflect a couple of unrelated bug fixes.
2014-07-29 18:21:16 -07:00
Mohamed Hegazy 7faad38c84 remove unused interface 2014-07-29 12:18:12 -07:00
Mohamed Hegazy 346809ba2b wire in getCompletions 2014-07-29 12:10:21 -07:00
Mohamed Hegazy f8767a5617 wire quick info 2014-07-29 12:07:36 -07:00
Mohamed Hegazy 2ed3de1c28 push newline to compilerhost instead of using sys directelly. This allows the language service to set it, as sys is not defined in language service scenarios 2014-07-29 12:06:43 -07:00
Daniel Rosenwasser fce3bdd171 Merge pull request #256 from Microsoft/ambientAccessorErrors
Gracefully handle accessor declarations in ambient classes.
2014-07-29 11:46:32 -07:00
Vladimir Matveev df3567c7db Merge pull request #197 from Microsoft/locals_exports
Alternative proposal for grouping exported and local declarations
2014-07-28 11:26:08 -07:00
Anders Hejlsberg fc0004749f Merge pull request #264 from Microsoft/errorOnHiddenModuleImport
Error when importing shadowed internal module.
2014-07-27 18:09:04 -07:00
Anders Hejlsberg 3da5f1ef6f Error when importing shadowed internal module.
Fixes #73.
2014-07-26 08:13:52 -07:00
Vladimir Matveev e4256d827d Merge pull request #252 from Microsoft/array_symbol_links
Use symbol links to access global array type
2014-07-25 17:12:14 -07:00
Vladimir Matveev a2210184be comments updated 2014-07-25 17:08:35 -07:00
Vladimir Matveev 6fe8acb103 added comments 2014-07-25 16:49:35 -07:00
Vladimir Matveev 956b6398e0 localize special case (globalArrayType === undefined) in getTypeFromArrayTypeNode 2014-07-25 16:42:09 -07:00
Jason Freeman 4ee714f4e7 Merge branch 'master' into forInError 2014-07-25 15:10:34 -07:00
Jason Freeman 936863c299 Update error message to be more consistent with others 2014-07-25 14:01:50 -07:00
Jason Freeman aa40dc59b1 Fix up comment about bug #236 in checkCallExpression 2014-07-25 13:39:11 -07:00
Daniel Rosenwasser fc80c300a0 Gracefully handle accessor declarations in ambient classes. 2014-07-25 13:21:55 -07:00
Jason Freeman b2abab2f93 Improve the error in a 'for in' statement 2014-07-25 12:38:36 -07:00
Vladimir Matveev 442ad4b032 use symbol links to access global array type 2014-07-25 12:06:18 -07:00
Vladimir Matveev 42df260eb5 use getEffectiveDeclarationFlags to get Export flag 2014-07-25 11:15:19 -07:00
Anders Hejlsberg f991054691 Merge branch 'master' into argumentTypeErrors 2014-07-25 06:40:51 -07:00
Vladimir Matveev 81da2cb7b9 update comments 2014-07-24 23:22:40 -07:00
Anders Hejlsberg 511402cd84 Addressing CR feedback. 2014-07-24 19:39:50 -07:00
Vladimir Matveev bb193fedb9 augment check for colliding declaration spaces 2014-07-24 17:03:37 -07:00
Vladimir Matveev d7f67083b2 check groups of local symbols 2014-07-24 17:03:33 -07:00
Anders Hejlsberg a515b199b7 Better error messages in function calls.
Fixes #93.
This is an evolution of #220.
2014-07-24 17:00:03 -07:00
Jason Freeman 76804eb1f9 Add errors for break and continue statements 2014-07-23 12:07:46 -07:00
Jason Freeman ed3d740df4 Merge branch 'master' into errorOnWithStatement 2014-07-23 11:52:40 -07:00
Daniel Rosenwasser 0e10fc76b8 Removed parentheses around arrow function parameters.
As per feedback in pull request #147.
2014-07-22 17:08:12 -07:00
Daniel Rosenwasser c8fc26a20a Merge pull request #147 from Microsoft/noReturnExpression
Complain when a non-void function lacks a return expresson.
2014-07-22 13:46:54 -07:00
Jason Freeman f79cba2225 Type check the expression of the 'with' statement 2014-07-22 13:37:37 -07:00
Anders Hejlsberg c5db1614f6 Aligning index signature type inference with assignability rules.
Type inference now supports inferring from string index signatures to numeric index signatures.
Fixes #167.
2014-07-22 11:53:06 -07:00
Anders Hejlsberg d85df9e9fa Addressing CR feedback.
Adding comment to explain source type instantiation.
Adding a test case.
2014-07-22 10:54:20 -07:00
Jason Freeman 8cbe88b501 Give a semantic error on with statements 2014-07-21 17:10:04 -07:00
Daniel Rosenwasser 0f4e887155 Changed error message for annotated functions lacking return statements. 2014-07-21 16:42:48 -07:00
Daniel Rosenwasser 1728f7c654 Changed check on annotated functions/getters to only look for return statements. 2014-07-21 16:42:46 -07:00
Daniel Rosenwasser 69018e635a Minor renaming. 2014-07-21 16:42:45 -07:00
Daniel Rosenwasser b7343c214d Removed TODO relating to the task I just fixed. 2014-07-21 16:42:43 -07:00
Daniel Rosenwasser d33127ad34 Complain when a non-void/any function lacks a return expresson.
In effect this fixes #62.

Also
    - Changes the error message for get accessors lacking return expressions.
    - Actually checks for return expressions instead of return statements for get-accessors.
    - Removes fancy quotes.
    - Corrects errors in the compiler caught by the new check.
    - Simplified `checkAndAggregateReturnTypes` by extracting it out to `visitReturnStatements`.
2014-07-21 16:42:41 -07:00
unknown b24b28eaaa Added contextual signature instantiation during type inference.
Fixes #88.
2014-07-21 16:38:02 -07:00
unknown c3624c9b24 Addressing CR feedback. 2014-07-21 11:31:37 -07:00
Anders Hejlsberg 24dbe2dd79 Improving code and addressing code review feedback.
Binder now builds more generally useful linked list of all container declarations.
Emitter uses original spelling when creating unique local container names.
2014-07-21 11:26:24 -07:00
Anders Hejlsberg 175dba4977 Ensuring local module names are unique in emit.
Fixes #41 and #42.
2014-07-21 11:23:08 -07:00
Anders Hejlsberg 393be4687c Improving code and addressing code review feedback.
Binder now builds more generally useful linked list of all container declarations.
Emitter uses original spelling when creating unique local container names.
2014-07-21 11:17:47 -07:00
Anders Hejlsberg 85225c8f29 Ensuring local module names are unique in emit.
Fixes #41 and #42.
2014-07-21 11:17:44 -07:00
Jason Freeman 3580a999c8 Address PR feedback 2014-07-21 09:40:41 -07:00
Jason Freeman 837a8935c7 Remove error about missing module flag from checker 2014-07-21 09:40:38 -07:00
Jason Freeman 91d31c7f51 Add error about missing module flag to createProgram 2014-07-21 09:38:59 -07:00
Vladimir Matveev 96cf47d10f fixed typo in comment 2014-07-20 21:22:18 -07:00
Sheetal Nandi 999b7fed92 Checker and emitter changes to report errors on inaccessibility of symbols when writing types in declaration file 2014-07-18 18:06:37 -07:00
Sheetal Nandi bbb36dc933 Make the symbol writing api on the text writer 2014-07-18 17:50:12 -07:00
Vladimir Matveev 30ecd19029 added collision check for '_this' 2014-07-18 16:16:28 -07:00
Vladimir Matveev 2b8f04af0c do not check inherited properties if interface has one item in heritage list 2014-07-16 22:53:53 -07:00
Anders Hejlsberg 6b112b1a46 Merge branch 'master' into MergingErrors
Conflicts:
	src/compiler/checker.ts
2014-07-16 16:31:08 -07:00
Anders Hejlsberg 70f8057dc7 Addressing code review feedback. 2014-07-16 16:14:29 -07:00
Sheetal Nandi fe1fea3710 Merge pull request #30 from Microsoft/declarations
Changes to determine when to qualify the symbol in given enclosing declaration
2014-07-16 15:20:00 -07:00
Sheetal Nandi 1bb219a3dd Incorporating code review feedback 2014-07-16 14:50:37 -07:00
Anders Hejlsberg e4ea5ef1f9 Fix for 954635: Clodule declaration ordering
Fix for 955714: Fundule declaration ordering
2014-07-16 14:23:39 -07:00
Daniel Rosenwasser 9ecf01b57a When importing, only check for reserved type names when importing a type. 2014-07-16 14:08:15 -07:00
Jason Freeman 2af62a9912 Error for more than one enum omitting an initial initializer 2014-07-16 13:50:08 -07:00
Jason Freeman 17563f3c5d Remove SymbolLinks.typeChecked 2014-07-16 13:34:27 -07:00
Sheetal Nandi 148abea09d Use the isDeclarationVisible in checker to determine if the declaration needs to be emitted
This would help in unifying logic of when to check if the type is visible
2014-07-16 11:37:49 -07:00
Sheetal Nandi 5a23dd0684 Check if accessible symbol needs futher qualification 2014-07-16 11:30:38 -07:00
Sheetal Nandi d8f3481d38 Check if there is alias symbol in the scope corresponding to the symbol whose name we are trying to get in the symbol table 2014-07-16 11:30:34 -07:00
Sheetal Nandi 2273355df4 Start emitting qualified path if the current symbol is not visible in enclosing declaration
Note that this doesnt handle aliases yet.
2014-07-16 11:30:14 -07:00
Sheetal Nandi 6a68b3744c Do not emit arrow style call signatures when writing T of T[] 2014-07-15 13:08:13 -07:00
Sheetal Nandi 574c075dba Emit the types in declaration file 2014-07-15 13:08:10 -07:00
Sheetal Nandi 455364cf5a Do not emit the signature for implementation of overload in the declaration file 2014-07-15 08:58:02 -07:00
Sheetal Nandi bb7f7fb8dd Correct the condition for variable statement emit in the declaraiton file 2014-07-15 08:57:39 -07:00
Sheetal Nandi 063399d228 Emit declaration if its identifier is used in export assignment of external module 2014-07-15 08:57:22 -07:00
Jason Freeman 79d9539f7b Syntax error for nonambient module with a quoted name 2014-07-14 11:47:39 -07:00
Jason Freeman 60b521cddb Remove unnecessary isAmbientContext function 2014-07-14 11:46:42 -07:00
Mohamed Hegazy 214df64e28 Add snapshot of compiler sources 2014-07-12 17:30:19 -07:00