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

Add support for empty setters #518

Merged
merged 1 commit into from
Nov 1, 2018
Merged

Conversation

cwwwu
Copy link
Collaborator

@cwwwu cwwwu commented Nov 1, 2018

Fixes #494

@@ -44,6 +44,7 @@ class FunSpec private constructor(builder: Builder) {
val delegateConstructor = builder.delegateConstructor
val delegateConstructorArguments = builder.delegateConstructorArguments.toImmutableList()
val body = builder.body.build()
val isEmptySetter = name == SETTER && parameters.isEmpty()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private

@cwwwu cwwwu force-pushed the wallace/20181101_empty_setter branch from cc2be8d to 5ee19f5 Compare November 1, 2018 18:56

init {
require(body.isEmpty() || ABSTRACT !in builder.modifiers) {
"abstract function ${builder.name} cannot have code"
}
require(name != SETTER || parameters.size == 1) {
require(name != SETTER || parameters.size <= 1) {
"$name must have exactly one parameter"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change the message to reflect the newer condition?

@cwwwu cwwwu force-pushed the wallace/20181101_empty_setter branch from 5ee19f5 to 8752e17 Compare November 1, 2018 19:12
@Egorand Egorand merged commit 4e8d4af into master Nov 1, 2018
@Egorand Egorand deleted the wallace/20181101_empty_setter branch November 1, 2018 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants