Skip to content

Commit

Permalink
#108 Fixed equatable enums
Browse files Browse the repository at this point in the history
  • Loading branch information
angelolloqui committed Mar 21, 2020
1 parent 4b20e0c commit 62d9ed7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Assets/Tests/KotlinTokenizer/enums.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ enum CompassPoint {
case west
}

private enum Planet {
private enum Planet: Equatable {
case mercury, venus, earth
case mars, jupiter, saturn, uranus, neptune
}
Expand Down
7 changes: 5 additions & 2 deletions Sources/SwiftKotlinFramework/KotlinTokenizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,11 @@ public class KotlinTokenizer: SwiftTokenizer {

// Simple enums (no tuple values)
if !simpleCases.contains(where: { $0.tuple != nil }) {
if declaration.typeInheritanceClause != nil {
return tokenizeSimpleValueEnum(declaration:declaration, simpleCases: simpleCases)
let typeInheritanceList = declaration.typeInheritanceClause?.typeInheritanceList.filter {
$0.names.contains { $0.name.textDescription != "Equatable" }
}
if typeInheritanceList?.isEmpty == false {
return tokenizeSimpleValueEnum(declaration: declaration, simpleCases: simpleCases)
} else {
return tokenizeNoValueEnum(declaration: declaration, simpleCases: simpleCases)
}
Expand Down

0 comments on commit 62d9ed7

Please sign in to comment.