skiptools / skiptools/skip

Conforming to a generic type with associated type error: Type parameter ID of 'Identifiable' has inconsistent values: Long, [Error type: Unresolved type for ID]

Open
#47 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
3.2k
Forks
106
Avg merge
6d 13h
Merged PRs (30d)
1

Description

The swift:

protocol SQLRow : Identifiable {
}

public struct DataItem : Identifiable {
    public typealias ID = Int64
    public let id: ID
    public init(id: ID) {
        self.id = id
    }
}

extension DataItem : SQLRow {
}

transpiles to the Kotlin:

class DataItem: Identifiable<Long>, SQLRow<ID>, MutableStruct {
    override val id: Long
}

internal interface SQLRow<ID>: Identifiable<ID> {
}

Which fails to compile:

Type parameter ID of 'Identifiable' has inconsistent values: Long, [Error type: Unresolved type for ID]
Screenshot 2023-11-18 at 09 40 21

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Swift example and inspecting the generated Kotlin for DataItem, SQLRow, and Identifiable. Trace how the associated ID type is translated, then verify that the generated declarations compile without the inconsistent type-parameter error.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin, swift
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.