Skip to content

Different error reporting outputs between Bloop and scalac in scala/scala3#22380 reproduction #3430

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
Gedochao opened this issue Jan 16, 2025 · 2 comments
Labels
blocked upstream Issues and changes blocked by something in an external project. Bloop Issues tied with Bloop integration. bug Something isn't working reporting Issues tied with error and warning reporting. scalac compatibility Issues tied with compatibility with the scalac (compiler) command.

Comments

@Gedochao
Copy link
Contributor

Version(s)
1.5.4

Describe the bug
A clear and concise description of what the bug is.

To Reproduce

scala-cli compile repro.scala -S 3.6.3

When compiling the following code with Scala3:

object One:
  def f(): Int = 1
  def f()(using Boolean): Int = 2
  val x1 = f()

object Two:
  given f(): Int = 1
  given f()(using Boolean): Int = 2
  val x2 = f()

object Three:
  given f: Int = 1
  given f(using Boolean): Int = 2
  val x3 = f

object Four:
  given Unit = ()
  given f(using Unit): Int = 1
  given f(using Unit, Boolean): Int = 2
  val x4 = f

We are getting different errors reported when compiling with Bloop and without.

Output with --server=false:

-- [E051] Reference Error: /Users/pchabelski/IdeaProjects/scala-cli-tests-2/untitled/compiler-repro/repro.scala:4:11
4 |  val x1 = f()
  |           ^
  |Ambiguous overload. The overloaded alternatives of method f in object One with types
  | ()(using x$1: Boolean): Int
  | (): Int
  |both match arguments ()
  |
  | longer explanation available when compiling with `-explain`
-- [E172] Type Error: /Users/pchabelski/IdeaProjects/scala-cli-tests-2/untitled/compiler-repro/repro.scala:9:14
9 |  val x2 = f()
  |              ^
  |No given instance of type Boolean was found for parameter x$1 of given instance f in object Two
-- [E051] Reference Error: /Users/pchabelski/IdeaProjects/scala-cli-tests-2/untitled/compiler-repro/repro.scala:20:11
20 |  val x4 = f
   |           ^
   |Ambiguous overload. The overloaded alternatives of given instance f in object Four with types
   | (using x$1: Unit, x$2: Boolean): Int
   | (using x$1: Unit): Int
   |both match expected type <?>
   |
   | longer explanation available when compiling with `-explain`
3 errors found
Compilation failed

Output with Bloop:

Compiling project (Scala 3.6.3, JVM (23))
[error] ./repro.scala:4:12
[error] Ambiguous overload. The overloaded alternatives of method f in object One with types
[error]  ()(using x$1: Boolean): Int
[error]  (): Int
[error] both match arguments ()
[error]   val x1 = f()
[error]            ^
[error] ./repro.scala:9:15
[error] No given instance of type Boolean was found for parameter x$1 of given instance f in object Two
[error]   val x2 = f()
[error]               ^
[error] ./repro.scala:20:12
[error] Ambiguous overload. The overloaded alternatives of given instance f in object Four with types
[error]  (using x$1: Unit, x$2: Boolean): Int
[error]  (using x$1: Unit): Int
[error] both match expected type <?>
[error]   val x4 = f
[error]            ^
Error compiling project (Scala 3.6.3, JVM (23))
Compilation failed

Expected behaviour
Error reports between scala-cli with --server=false, with Bloop and from scalac ought to be the same.

Extra context
Likely a Bloop/zinc issue.
Extracted from:

cc @kyouko-taiga @tgodzik

@Gedochao Gedochao added blocked upstream Issues and changes blocked by something in an external project. Bloop Issues tied with Bloop integration. bug Something isn't working reporting Issues tied with error and warning reporting. scalac compatibility Issues tied with compatibility with the scalac (compiler) command. labels Jan 16, 2025
@tgodzik
Copy link
Member

tgodzik commented Jan 16, 2025

Those are the same errors though just differently formatted, which is expected

@Gedochao
Copy link
Contributor Author

Seems the outputs are actually correct, just confusing.
We may need to improve how errors coming from Bloop are rendered in the future.
Closing this, nothing to do here.

@Gedochao Gedochao closed this as not planned Won't fix, can't repro, duplicate, stale Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked upstream Issues and changes blocked by something in an external project. Bloop Issues tied with Bloop integration. bug Something isn't working reporting Issues tied with error and warning reporting. scalac compatibility Issues tied with compatibility with the scalac (compiler) command.
Projects
None yet
Development

No branches or pull requests

2 participants