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

Regression in inkytonik/kiama #18276

Closed
WojciechMazur opened this issue Jul 24, 2023 · 1 comment · Fixed by #18288
Closed

Regression in inkytonik/kiama #18276

WojciechMazur opened this issue Jul 24, 2023 · 1 comment · Fixed by #18288
Assignees
Labels
area:implicits related to implicits area:typer itype:bug regression This worked in a previous version but doesn't anymore
Milestone

Comments

@WojciechMazur
Copy link
Contributor

WojciechMazur commented Jul 24, 2023

Based on Open CB failure, build logs: https://github.com/VirtusLab/community-build3/actions/runs/5626149769/job/15248249692

Compiler version

Fails in 3.3.2-RC1-bin-20230720-98b452d-NIGHTLY
Works with: 3.3.1-RC4
Bisect points to: 0f7c3ab

Minimized code

import scala.language.implicitConversions

case class Assign(left: String, right: String)
class SyntaxAnalyser extends ParsersBase {
  val x: Parser[String ~ String] = ???
  val y: Parser[Assign] = x.map(Assign.apply)
}

class ParsersBase {
  trait ~[+T, +U]
  abstract class Parser[+T]:
    def map[U](f: T => U): Parser[U] = ???

  given [A, B, X]: Conversion[(A, B) => X, (A ~ B) => X] = ???
}

Output

-- [E086] Syntax Error: /Users/wmazur/projects/sandbox/main.scala:6:32 ---------
6 |  val y: Parser[Assign] = x.map(Assign.apply(_,_))
  |                                ^^^^^^^^^^^^^^^^^
  |                                Wrong number of parameters, expected: 1
1 error found

Expectation

Should be able to compile code, by applying the implicit conversion

@WojciechMazur WojciechMazur added itype:bug area:typer area:implicits related to implicits regression This worked in a previous version but doesn't anymore labels Jul 24, 2023
@nicolasstucki
Copy link
Contributor

Minimized

import scala.language.implicitConversions

def foo(a: Int): Int = ???
def bar(f: () => Int): Int = ???

given f: Conversion[Int => Int, () => Int] = ???

def test1: Int = bar(foo) // error: implicit conversion not triggered
def test2: Int = bar(f(foo)) // ok

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 25, 2023
nicolasstucki added a commit that referenced this issue Jul 26, 2023
This was accidentally moved before of the `if (!param.tpt.isEmpty)`
guard in
0f7c3ab#diff-8c9ece1772bd78160fc1c31e988664586c9df566a1d22ff99ef99dd6d5627a90R1534.
`protoFormal` has a side effect (error reporting) that caused this
issue.

Fixes #18276
@Kordyjan Kordyjan added this to the 3.4.0 milestone Aug 1, 2023
Kordyjan pushed a commit that referenced this issue Aug 16, 2023
Kordyjan pushed a commit to dotty-staging/dotty that referenced this issue Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:implicits related to implicits area:typer itype:bug regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants