-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Description
Hello, I'm doing my first steps with Swift so I hope that I'm not doing things wrong but rather reporting an actual bug.
platform: Linux
I'm trying to create a collation and get a crash with this minimal example:
import SQLite
let db = try Connection(.inMemory);
try db.createCollation("NOTHING_SPECIAL") { lhs, rhs in
return lhs.compare(rhs)
}Crash log:
💣 Program crashed: Bad pointer dereference at 0x0000000000000040
Thread 0 "test" crashed:
0 0x00007f828e0de8d7 swift_initEnumMetadataSinglePayload + 23 in libswiftCore.so
1 0x00007f828df57c0c type metadata completion function for ClosedRange<>.Index + 59 in libswiftCore.so
2 0x00007f828e1038bf swift::MetadataCacheEntryBase<(anonymous namespace)::GenericCacheEntry, void const*>::doInitialization(swift::MetadataWaitQueue::Worker&, swift::MetadataRequest) + 270 in libswiftCore.so
3 0x00007f828e0f4144 _swift_getGenericMetadata(swift::MetadataRequest, void const* const*, swift::TargetTypeContextDescriptor<swift::InProcess> const*) + 2755 in libswiftCore.so
4 0x00007f828df692b3 __swift_instantiateCanonicalPrespecializedGenericMetadata + 34 in libswiftCore.so
5 0x00007f828dfa75fe Dictionary.subscript.setter + 45 in libswiftCore.so
6 Connection.createCollation(_:_:) + 851 in test at ..../.build/checkouts/SQLite.swift/Sources/SQLite/Core/Connection.swift:659:31
657│ }
658│ }, nil /* xDestroy */))
659│ collations[collation] = box
│ ▲
660│ }
661│ fileprivate typealias Collation = @convention(block) (UnsafeRawPointer, UnsafeRawPointer) -> Int32
7 test_main + 140 in test at .../Test/test.swift:4:8
2│
3│ let db = try Connection(.inMemory);
4│ try db.createCollation("NOTHING_SPECIAL") { lhs, rhs in
│ ▲
5│ return lhs.compare(rhs)
6│ }
8 0x00007f828c95c6b5 <unknown> in libc.so.6
9 0x00007f828c95c769 <unknown> in libc.so.6
By the way, I've found the syntax .order(collate(.custom("NODIACRITIC"), name)) in the docs but couldn't get it to work. Isn't it .order(name.collate(.custom("NODIACRITIC"))) now ?
Metadata
Metadata
Assignees
Labels
No labels