Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Associated Types with matching names will conflict #334

Open
stephen-hawley opened this issue Mar 24, 2020 · 0 comments
Open

Associated Types with matching names will conflict #334

stephen-hawley opened this issue Mar 24, 2020 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@stephen-hawley
Copy link
Contributor

If I have these two PATs:

public protocol getter {
    associatedtype value
    func get () -> value
}
public protocol setter {
    associatedtype value
    func set (newValue: value)
}
// and a function like this:
public func doAThing<T:setter, U:getter> (a: T, b: U) {
}

There will be a name conflict in the generated C# function:

public void DoAThing<T, U, ATvalue, ATvalue> (T:a, U: b) where T: IGetter<ATvalue>, U: ISetter<ATvalue> {
}

There will be two ATvalue generics.
There is a single entry point to generate the C# generic name for an associated type in OverrideBuilder. Currently it selects ATName where Name is the name of the associated type. To avoid name conflicts, this should be set instead to something like ATModule_Proto_Name where Module is the module name, Proto is the protocol name and Name is the associated type name.

@stephen-hawley stephen-hawley added enhancement New feature or request good first issue Good for newcomers labels Mar 24, 2020
@stephen-hawley stephen-hawley added this to the Future milestone Mar 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant