Skip to content
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

Abstract Classes and methods #3579

Merged
merged 72 commits into from
Jul 1, 2015
Merged

Abstract Classes and methods #3579

merged 72 commits into from
Jul 1, 2015

Conversation

aozgaa
Copy link
Contributor

@aozgaa aozgaa commented Jun 19, 2015

Implements #3578.

Also many thanks to @DickvdBrink for his initial contributions!

DickvdBrink and others added 25 commits April 30, 2015 17:40
keyword `abstract` is parsed at the head of class declarations and as a modifier for class member functions/variables.

The following checks have been implemented:
* Objects whose type is an abstract class cannot be instantiated with `new`.
* all overloads of a function must match w/r/t having the abstract keyword.
* a member/class decl can't use the `abstract` keyword multiple times.
* a member can't be both `abstract` and `static`.
* a member can't be both `abstract` and `private`.
* Accessibility modifiers can't follow `abstract`
* Only classes and member functions can be declared abstract.
* abstract methods don't need an implementation
* abstract methods can only appear in abstract classes.

TODO:

* forbid abstract methods from having an implementation.
* make sure, barring overriding, an inherited method is abstract iff it is abstract in the parent.
* If a class has an abstract members, then it must be abstract. (eg: class B does not implement inherited member 'foo()')
* prevent overriding a non-abstract method with an abstract method.
* update "abstractness" flag when overriding abstract method with non-abstract method.
* prevent calling an abstract method via super.<abstract method name>()
* make all overloads of an abstract method adjacent to eachother.
* constructors can't be declared abstract -- give appropriate error.
* figure out what to emit to the *.ts file -- probably nothing.
* figure out what to emit to the *.d.ts file.
* process abstract declarations.
@aozgaa aozgaa changed the title Abstract classes2 Abstract Classes and Interfaces Jun 19, 2015
@aozgaa aozgaa mentioned this pull request Jun 19, 2015
@JsonFreeman
Copy link
Contributor

👍

@RyanCavanaugh
Copy link
Member

👍

aozgaa pushed a commit that referenced this pull request Jul 1, 2015
@aozgaa aozgaa merged commit 0e73a78 into master Jul 1, 2015
@DanielRosenwasser
Copy link
Member

🎉 🎈

@kenrick95
Copy link

🎊 🎉 ㊗️

@ghost ghost mentioned this pull request Jul 2, 2015
@CKGrafico
Copy link

💃💃

@ddotlic
Copy link

ddotlic commented Jul 2, 2015

👍 👍 👍 Yay!

@DickvdBrink
Copy link
Contributor

Thanks @aozgaa, can't wait for this to use in 1.6!

@tinganho
Copy link
Contributor

tinganho commented Jul 2, 2015

👍

@romanresh
Copy link

Great feature. We've been waiting it from the first releases of TS. Thanks!

@aozgaa
Copy link
Contributor Author

aozgaa commented Jul 2, 2015

Thanks to everyone for their comments and help!

@aozgaa aozgaa deleted the abstract-classes2 branch July 6, 2015 17:40
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.