Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend Signatures to have multiple type parameter clauses #2450

Open
tanishiking opened this issue Aug 13, 2021 · 0 comments
Open

Extend Signatures to have multiple type parameter clauses #2450

tanishiking opened this issue Aug 13, 2021 · 0 comments

Comments

@tanishiking
Copy link
Member

In Scala3, there could be a MethodSignature that has multiple type parameter clauses.
For example, in the following code snippet, the extension method map has two type parameter clauses [T] and [U].

extension [T](t: F[T]) def map[U](f: T => U): F[U]

However, the current SemanticDB schema is incapable of expressing multiple type parameter clauses in Signatures https://scalameta.org/docs/semanticdb/specification.html#signature

To work around this problem, in the current implementation, we express such type param clauses by merging into one type param clause:
map[T, U] instead of map[T][U] scala/scala3#12885


This workaround could be a problem when U is a dependent type based on T, and this signature is inaccurate.

We can't pretend that F[T][U] is F[T, U] as that breaks the arity of F, this will need a new semanticdb message to support, dotty captures this in TypeRef which just has the prefix and symbol fields, and then AppliedType has a tycon field, the type being applied and could be a nested AppliedType, and the args field
scala/scala3#12885 (comment)

We should extend the signature so they can have multiple type parameter clauses (however this requires a breaking change in SemanticDB schema), or maybe we should change the representation of extension methods in Scala3 so we can express accurate signature in SemanticDB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant