Unknown [Int].Type in Swift code?

I’m trying to incorporate AgileDB into a new Swift/macOS project using the Fire IDE on Mac. I downloaded the source code from here: GitHub - AaronBratcher/AgileDB: Easy way to save and retrieve full object graphs from a SQLite DB

Adding the files to the project and compiling gives me 3 errors. (I think they’re all basically derived from the same issue)

E: comma or closing parenthesis expected, got dot [/Users/aaronbratcher/Library/Mobile Documents/com~apple~CloudDocs/Fire Projects/MacApp/AgileDB/DBObjectDecoder.swift (156)]
E: Implementation for method "decodeArray" is missing [/Users/aaronbratcher/Library/Mobile Documents/com~apple~CloudDocs/Fire Projects/MacApp/AgileDB/DBObjectDecoder.swift (156)]
E: closing bracket expected, got dot [/Users/aaronbratcher/Library/Mobile Documents/com~apple~CloudDocs/Fire Projects/MacApp/AgileDB/DBObjectDecoder.swift (156)]

This is the line of code causing the problem:
func decodeArray(_ type: [Int].Type, forKey key: K) throws -> [Int] {

Again, this is a Swift package that already works. Just trying to use it in the Fire IDE.


Can i see a complete project that shows this? That said, i’m not sure what

_ type: [Int].Type

is supposed to accomplish as a parameter declaration?

Is there a way to attach a small zip? If not here are my steps:

Create new macOS Project
Download AgileDB
Create new Physical Folder in IDE… name it AgileDB
Copy the files from downloaded AgileDB Sources into new physical folder in Finder
Drag files in new physical folder onto Fire project AgileDB folder so they’re in project

Sure. Just drag it into the reply field. :pray:t3:

MacApp.zip (540.1 KB)

Reproduced, and will log — but I’m still unclear pin what _ type: [Int].Type is supposed to mean.

Logged as bugs://E25862.

Interestingly, the [Double].Type and [String].Type appear to be interpreted properly.


Not for me. it looks like it just gives up on the first one,

writeLn("The magic happens here.")

func test1(a: [Double].Type) { // E374 comma or closing parenthesis expected, got dot
							   // E504 Semicolon (;) required to separate two statements on the same line
							   // E477 Declaration expected
							   // E51 Implementation for method "method test1 a(a: not nullable array of Double)" is missing
func test2(a: [Int].Type) {

ah, okay

1 Like

The encoder and decoder classes make use of several .Type parameters. This is for custom encoding/decoding. I would recommend whomever works on this bug use the AgileDB package as a way of testing.

1 Like

FTR, We’re working on making the compiler understand .Type and .Protocol, but note that on all our current object platforms (Cocoa, Island, .NET and Java), meta classes are generated “on demand” by our compiler, and cannot be created for types outside of the current project (unless that project turned them on) or for code generated by other compilers. They also are not supported for protocols.

So, this will happen:

public class Foo {

var x: Foo.Type // will work
var y: Int.Type // will fail with "meta class not available for external type Int"
var z: IFoo.Protocol // will fail with a clean error "meta class not supported for protocols"

As such, your test case project will never compile as is, against current platforms. But really those parameters are useless anyways. Structs can’t be inherited, so a parameter of type [Int].Type will always receive the same value. it’s a useless parameter, IDK what’s tried to be comp;iished by that code.

Once we support Swift ABI object model, in expect meta classes for external Swift types will be accessible, ie SwiftUI.View.Type.

Essentially “.Type” will work same as “class of” does in Oxygene, with the same limitations.

Perhaps when you support the Swift ABI object model, you can help me rework AgileDB so it can compile here.

Sure thing.

FWIW< I notice that none of the decode* methods actually use the type parameter, so for now maybe just replace it with Any?

func decodeArray(_ type: [Double].Type, forKey key: K) throws -> [Double] {


func decodeArray(_ type: Any, forKey key: K) throws -> [Double] {


FWIW, when I do that, I get an internal error, which is definitely a bug; will log.

Logged as bugs://E25870.

bugs://E25870 was closed as fixed.

bugs://E25862 was closed as fixed.