Skip to content

Inline methods clash after erasure #6750

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

Closed
bishabosha opened this issue Jun 26, 2019 · 2 comments · Fixed by #8472
Closed

Inline methods clash after erasure #6750

bishabosha opened this issue Jun 26, 2019 · 2 comments · Fixed by #8472

Comments

@bishabosha
Copy link
Member

minimized code

inline def foo(i: => Int)  = ???
inline def foo(l: => Long) = ???

expectation

These should be able to exist in the same scope as Function0[Int] and Function0[Long] are only required at compiletime.

result

error [erasure]:

Double definition:
inline def foo(i: => Int): Nothing in package object package$package at line 1 and
inline def foo(l: => Long): Nothing in package object package$package at line 2
have the same type after erasure.
@nicolasstucki
Copy link
Contributor

Should the following also be accepted? And any other non erased type? Or should it be only an exception for by-name parameters?

inline def foo(i: () => Int)  = ???
inline def foo(l: () => Long) = ???

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 9, 2019
Before `Erasure` the signatures will contain `=>X` instead of `Function0`. This makes signature
clashes of by-name parameters only show up after `Erasure`. This allows for `inline` methods to
have by-name parameter overloads.
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 9, 2019
Before `Erasure` the signatures will contain `=>X` instead of `Function0`. This makes signature
clashes of by-name parameters only show up after `Erasure`. This allows for `inline` methods to
have by-name parameter overloads.
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 11, 2019
Before `Erasure` the signatures will contain `=>X` instead of `Function0`. This makes signature
clashes of by-name parameters only show up after `Erasure`. This allows for `inline` methods to
have by-name parameter overloads.
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 15, 2019
Before `Erasure` the signatures will contain `=>X` instead of `Function0`. This makes signature
clashes of by-name parameters only show up after `Erasure`. This allows for `inline` methods to
have by-name parameter overloads.
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 15, 2019
Before `Erasure` the signatures will contain `=>X` instead of `Function0`. This makes signature
clashes of by-name parameters only show up after `Erasure`. This allows for `inline` methods to
have by-name parameter overloads.
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 16, 2019
Before `Erasure` the signatures will contain `=>X` instead of `Function0`. This makes signature
clashes of by-name parameters only show up after `Erasure`. This allows for `inline` methods to
have by-name parameter overloads.
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 22, 2019
Before `Erasure` the signatures will contain `=>X` instead of `Function0`. This makes signature
clashes of by-name parameters only show up after `Erasure`. This allows for `inline` methods to
have by-name parameter overloads.
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 30, 2019
Before `Erasure` the signatures will contain `=>X` instead of `Function0`. This makes signature
clashes of by-name parameters only show up after `Erasure`. This allows for `inline` methods to
have by-name parameter overloads.
@nicolasstucki nicolasstucki removed their assignment Aug 29, 2019
@nicolasstucki
Copy link
Contributor

nicolasstucki commented Mar 8, 2020

With the new inline parameter semantics, we should use inline instead of by name. This fixed the issue.

inline def foo(inline i: Int)  = ???
inline def foo(inline l: Long) = ???

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 8, 2020
@nicolasstucki nicolasstucki linked a pull request Mar 8, 2020 that will close this issue
liufengyun added a commit that referenced this issue Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants