Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Swift 5.2 implicit return does not transpile properly #116

Closed
angelolloqui opened this issue May 17, 2020 · 0 comments
Closed

Swift 5.2 implicit return does not transpile properly #116

angelolloqui opened this issue May 17, 2020 · 0 comments

Comments

@angelolloqui
Copy link
Owner

angelolloqui commented May 17, 2020

The following swift code:

class A {
    var myVar: String {
        "test"
    }

    var state: Observable<RestaurantsListState> {
        get {
            myVar.asObservable()
        }
    }
    
    func myFunc() -> Int {
        2 + 5
    }
}

Returns this Kotlin:

class A {
    val myVar: String
        get() {
            "test"
        }

    val state: Observable<RestaurantsListState>
        get() {
            myVar.asObservable()
        }
    
    fun myFunc() : Int {
        2 + 5
    }
}

But that is not valid since it should either include return statements or preferably use the = like this:


class A {
    val myVar: String
        get() = "test"        

    val state: Observable<RestaurantsListState>
        get() = myVar.asObservable()        
    
    fun myFunc() : Int =
        2 + 5    
}

UPDATE: This is working for explicit returns, it is just happening with the new implicit ones from Swift5.2

angelolloqui added a commit that referenced this issue May 17, 2020
#116 Fixed implicit return statements from Swift 5.2
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant