Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,9 @@ public enum NestedEnum {
public init() {}
}
}

public enum NamespaceEnum {
public enum Nested {
public static func something() {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,11 @@ void testStructInEnum() {
assertTrue(one.isPresent());
}
}
}

@Test
void testNamespaceEnum() {
try (var arena = SwiftArena.ofConfined()) {
NamespaceEnum.Nested.something();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,11 @@ extension JNISwift2JavaGenerator {
}

private func printEnumCaseInterface(_ printer: inout CodePrinter, _ decl: ImportedNominalType) {
printer.print("public sealed interface Case {}")
if decl.cases.isEmpty {
printer.print("public interface Case {}")
} else {
printer.print("public sealed interface Case {}")
}
printer.println()

let requiresSwiftArena = decl.cases.compactMap {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ extension JNISwift2JavaGenerator {
) { printer in
let selfPointer = self.printSelfJLongToUnsafeMutablePointer(
&printer,
swiftParentName: type.swiftNominal.name,
swiftParentName: type.swiftNominal.qualifiedName,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have found another problem again

error: cannot find type 'Nested' in scope
544 |   assert(selfPointer != 0, "selfPointer memory address was null")
545 |   let selfBits$ = Int(Int64(fromJNI: selfPointer, in: env$))
546 |   guard let self$ = UnsafeMutablePointer<Nested>(bitPattern: selfBits$) else {
    |                                          `- error: cannot find type 'Nested' in scope
547 |     fatalError("self memory address was null in call to \(#function)!")
548 |   }

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hah ouch

selfPointerParam
)
printer.printBraceBlock("switch (\(selfPointer).pointee)") { printer in
Expand Down
Loading