vinivendra / Gryphon

The Swift to Kotlin translator.
https://vinivendra.github.io/Gryphon/
Other
609 stars 46 forks source link

When I trying use gryphon to translate from Swift to Kotlin I receive an error #87

Closed msemionenko closed 4 years ago

msemionenko commented 4 years ago

I'm trying to translate one or more files from Swift to Kotlin, but I receive an error:

String index is out of bounds: file /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-1103.8.25.8/swift/stdlib/public/core/StringRangeReplaceableCollection.swift, line 302 zsh: illegal hardware instruction gryphon Kotlin.swift

There is an empty protocol in the code that inherits from the other two. It is because of him that the error is poured. But if you add a method to an empty protocol, then there is no error, but inheritance does not occur:

public protocol A { func getValue() -> Decimal }

public protocol B { func update(value:Decimal) }

public protocol C: A, B { func calculate() // - if not write this method in protocol gryphon send error. }

Gryphon version 0.10.2.

vinivendra commented 4 years ago

Hi!

Thanks for the bug report. I just pushed a fix for this crash on the development branch. You can try it now if you want with brew install vinivendra/gryphon/gryphon --HEAD or wait for the fix to be publicly released on Wednesday night.

Protocol inheritances aren't supported yet, but I created issue #88 if you want to track their development. At first glance, it seems like something that would be easy to implement but might cause issues in edge cases (for instance, when we have default implementations and override conflicts), so I really have to study it more before knowing for sure. I'm currently working on #73 though, which is taking a long time, but I'll get to this as soon as possible.