Skip to content

fix #11583: skip typarams of right assoc ext meth #11584

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

Merged
merged 1 commit into from
Mar 3, 2021

Conversation

bishabosha
Copy link
Member

@bishabosha bishabosha commented Mar 3, 2021

skip the first type parameter list of a right associative extension method before checking for a single non given parameter
fixes #11583

@odersky odersky merged commit 0be4099 into scala:master Mar 3, 2021
@odersky odersky deleted the fix-11583 branch March 3, 2021 15:42
rjolly added a commit to rjolly/dotty that referenced this pull request Mar 4, 2021
@rjolly
Copy link
Contributor

rjolly commented Mar 8, 2021

The fix is broken. The test compiles, but not into what you want:

extension (s: String)
  def :*:[T <: Tuple](that: T) : String *: T = ???

def res = "foo":*:(1, 2)
//             ^^^^^^^^^
//      value :*: is not a member of (Int, Int).
//      An extension method was tried, but could not be fully constructed:

//          :*:[T](Tuple2.apply[Int, Int](1, 2))    failed with

//              Found:    (Int, Int)
//              Required: String

def res = (1, 2):*:"foo"
// compiles

@neko-kai
Copy link
Contributor

neko-kai commented Mar 8, 2021

@rjolly
Are extension methods supposed to be exempt from reversal on operators ending with :? Since a :+: b is desugared to b.:+:(a) (in Scala 2 at least) that would lead to the behavior in your code sample.

@rjolly
Copy link
Contributor

rjolly commented Mar 8, 2021

a :+: b is desugared to :+:(b)(a) and resugared to a :+: b (so to speak).

@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

can't define right associative extension method with type parameter
5 participants