Skip to content

Module name, type name aliasing conflict #396

@ulitiy

Description

@ulitiy

New Issue Checklist

Issue Description

ParseSwift module is named the same as the ParseSwift class, that makes it impossible to write a fully qualified type in case of the naming conflict. And ParseSwift.Subscription already has a conflict with Combine.Subscription.

Steps to reproduce

This means I cannot even specify EnvironmentObject:

// 'Subscription' is ambiguous for type lookup in this context
// Cannot specialize non-generic type 'Subscription'
    @EnvironmentObject var lessons: Subscription<Lesson>
    var cancellables = [AnyCancellable]()
// 'Subscription' is not a member type of struct 'ParseSwift.ParseSwift'
    @EnvironmentObject var lessons: ParseSwift.Subscription<Lesson>
    var cancellables = [AnyCancellable]()

If the module name was different from the class name it could be possible to have
Maybe another option is to have typealiases for conflicting names but it doesn't resolve conflicts with local project names.

AFAIK there's no tool like :: in Swift. The only way I see it can be fixed now by the library user is by importing and aliasing specific types from Combine, and never import Combine when I want to use Subscription. Like this:

typealias MyAnyCancellable = AnyCancellable

Actual Outcome

Errors

Expected Outcome

No errors

Environment

Client

  • Parse Swift SDK version: 4.9.0
  • Xcode version: 13.4.1 (13F100)

Logs

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions