-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Abstract Classes and methods #3579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
dd1f982
Parse abstract keyword
DickvdBrink 0e72677
Accept baseline changes
DickvdBrink b42e447
Error on creating a new instance of an abstract class
DickvdBrink 3aeae55
Output abstract keyword in declaration files (for classes)
DickvdBrink 9436934
Added test for abstract-classes
DickvdBrink 0ed7898
Accepted baselines
DickvdBrink 3bc2aa9
fix merge conflicts with master
cd06627
Fixed Some indentation
5316d0d
Abstract keyword: Added parsing and some checks
506349f
Fix merge conflicts with master
1954322
Fixed some indentation issues
864a28a
forbid abstract methods from having an implementation
388e2fd
merge with extendsExpressions
a07f862
forbid calling abstract member foo() via super.foo()
5ca3955
check for inheriting abstract member functions
6dc430d
constructor cannot have modifier 'abstract'
4c1002e
removed premature parser check
10c8b6a
removed comment
326036d
write to declaration file
d596bb7
declarations of abstract methods must be consecutive
8681388
added tests
8f1790d
Simplified checkClassPropertyAccess -- fixed bug in super access
df3560f
moved tests, added a test
b448310
accepted baselines
b7f4ee5
Merge branch 'master' into abstract-classes2
933a2fa
updated baseline for new __extends impl
24da34c
fixed some indentation quirks, comments
d0924f4
moved abstract-method-inheritance test to checkKindsOfPropertyMemberO…
31b627a
moved comment
92ef6f5
responded to some of Daniel's comments
5c0b913
changed error messages and fixed comments
0daa9eb
updated baselines for new error messages
a8d205a
new tests
676f4a1
added baselines for new tests
9451aa6
Fixed order of arguments in error message
1068890
Moved tests to classAbstractKeyword folder
74d248e
Changed error message
3eea717
Fixed some error messages.
1f6637b
Added check to test
771e487
Re-fixed error message.
36b1dba
accepted baselines
d34b23a
Merge branch 'master' into abstract-classes2
b332727
updated comment in test and baseline
15c6842
consolidated looping through class members into one loop
5930052
cleaner loop
f8b95a5
Drafting constructor assignability restrictions
4640148
added context flag
a7ec1c4
merged master
31b8ff6
Merge branch 'contextSensitiveIsRelatedTo' into abstract-classes2
a183ba9
added flag as argument to checkTypeRelatedTo
2a9ea48
Merge branch 'master' into contextSensitiveIsRelatedTo
d8fe237
merged in master
ded2441
fixed a conflict
d932618
merged with contextSensitiveRelatedTo
e47e5bc
fixed a comment
b445f90
Merge branch 'contextSensitiveIsRelatedTo' into abstract-classes2
12383af
Responding to Jason
18d6e73
Revert isRelatedFlags changes
5864a66
updated baselines on classAbstract tests
994b73f
fixed an erroneous assertion
feb7e1d
Fixed generic abstract class inheritance and some comments
a1877ef
fexed comment and initialization
4dd369f
moved initialization and changed a comment
1608845
merged with master
1efff28
fixed union-type determination, moved abstract implementation test, a…
c93bde6
added tests
139d0f4
updated baselines
27ebd5c
removed a prototype
a0bd465
Appeasing Jason
07142a4
Revert "Appeasing Jason"
f3b1321
Appeasing Jason lite
6d0c7c9
removed a comment
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -765,7 +765,6 @@ | |
"category": "Error", | ||
"code": 1311 | ||
}, | ||
|
||
"The return type of a property decorator function must be either 'void' or 'any'.": { | ||
"category": "Error", | ||
"code": 1236 | ||
|
@@ -790,7 +789,22 @@ | |
"category": "Error", | ||
"code": 1241 | ||
}, | ||
|
||
"'abstract' modifier can only appear on a class or method declaration.": { | ||
"category": "Error", | ||
"code": 1242 | ||
}, | ||
"'{0}' modifier cannot be used with '{1}' modifier.": { | ||
"category": "Error", | ||
"code": 1243 | ||
}, | ||
"Abstract methods can only appear within an abstract class.": { | ||
"category": "Error", | ||
"code": 1244 | ||
}, | ||
"Method '{0}' cannot have an implementation because it is marked abstract.": { | ||
"category": "Error", | ||
"code": 1245 | ||
}, | ||
"Duplicate identifier '{0}'.": { | ||
"category": "Error", | ||
"code": 2300 | ||
|
@@ -931,19 +945,19 @@ | |
"category": "Error", | ||
"code": 2336 | ||
}, | ||
"Super calls are not permitted outside constructors or in nested functions inside constructors": { | ||
"Super calls are not permitted outside constructors or in nested functions inside constructors.": { | ||
"category": "Error", | ||
"code": 2337 | ||
}, | ||
"'super' property access is permitted only in a constructor, member function, or member accessor of a derived class": { | ||
"'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.": { | ||
"category": "Error", | ||
"code": 2338 | ||
}, | ||
"Property '{0}' does not exist on type '{1}'.": { | ||
"category": "Error", | ||
"code": 2339 | ||
}, | ||
"Only public and protected methods of the base class are accessible via the 'super' keyword": { | ||
"Only public and protected methods of the base class are accessible via the 'super' keyword.": { | ||
"category": "Error", | ||
"code": 2340 | ||
}, | ||
|
@@ -1579,7 +1593,34 @@ | |
"category": "Error", | ||
"code": 2510 | ||
}, | ||
|
||
"Cannot create an instance of the abstract class '{0}'.": { | ||
"category": "Error", | ||
"code": 2511 | ||
}, | ||
"Overload signatures must all be abstract or not abstract.": { | ||
"category": "Error", | ||
"code": 2512 | ||
}, | ||
"Abstract method '{0}' in class '{1}' cannot be accessed via super expression.": { | ||
"category": "Error", | ||
"code": 2513 | ||
}, | ||
"Classes containing abstract methods must be marked abstract.": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this different from error 1238? This one is specifically for the inherited methods? |
||
"category": "Error", | ||
"code": 2514 | ||
}, | ||
"Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'.": { | ||
"category": "Error", | ||
"code": 2515 | ||
}, | ||
"All declarations of an abstract method must be consecutive.": { | ||
"category": "Error", | ||
"code": 2516 | ||
}, | ||
"Constructor objects of abstract type cannot be assigned to constructor objects of non-abstract type": { | ||
"category": "Error", | ||
"code":2517 | ||
}, | ||
"Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions.": { | ||
"category": "Error", | ||
"code": 2520 | ||
|
@@ -1600,7 +1641,6 @@ | |
"category": "Error", | ||
"code": 2524 | ||
}, | ||
|
||
"JSX element attributes type '{0}' must be an object type.": { | ||
"category": "Error", | ||
"code": 2600 | ||
|
@@ -1641,7 +1681,6 @@ | |
"category": "Error", | ||
"code": 2650 | ||
}, | ||
|
||
"Import declaration '{0}' is using private name '{1}'.": { | ||
"category": "Error", | ||
"code": 4000 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a test for
export default abstract class foo {}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hadn't thought of this case and the more general behavior of exports? What would we like to support? Currently this is a parsing error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would wait on this. i would add a test though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In principle, I see no reason to disallow default abstract classes. Why are they any different from concrete classes from an export default standpoint?