question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Regression: Ambiguous reference error

See original GitHub issue

I am upgrading the community build to use the bootstrapped Dotty version and I’m hitting on an ambiguous reference error in the squants project, see https://travis-ci.org/dotty-staging/squants/builds/230324795#L561

-- [E048] Reference Error: /Users/ollie/dev/squants/shared/src/main/scala/squants/energy/Power.scala:29:24
29 |    with TimeDerivative[Energy]
   |                        ^^^^^^
   |                        reference to `Energy` is ambiguous
   |                        it is both imported by import squants._
   |                        and defined subsequently in module class energ

I had similar errors when upgrading scalatest to use the bootstrapped dotty version. Changing import squants._ to import squants.{Energy => _, _} does fix the error. However, squants.Energy is a type alias to squants.energy.Energy so I think the ambiguous reference error should not be reported. The original code compiles with dotty 20170412 as well as scalac 2.x.

I tried to find a minimal repro in https://github.com/dotty-staging/squants/pull/4/commits/d459a3b8842cdff844ff3a5ed63af45ce2c29592 but with no luck. There must be something I’m missing, help would be very much appreciated. To reproduce

git clone https://github.com/olafurpg/squants.git
cd squants
git checkout d459a3b8842cdff844ff3a5ed63af45ce2c29592
sbt squantsJVM/compile

My efforts to minimize the example are in the shared/src/main/scala/foo/ directory.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
felixmuldercommented, May 9, 2017

Tried to minimize this as well, but ended up crashing the compiler:

// pack.scala
package foo

package object bar {
  type Foo = foo.bar.Foo
}
// Foo.scala
package foo.bar

class Foo
// usage.scala
package boobar

import foo.bar._

object Test {
  val x: Foo = ???
}
0reactions
oderskycommented, Jul 20, 2017

Should be fixed by now. Please re-open if this is not the case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio 2022 Preview 3.0 - error CS0104: ambiguous ...
With new version of Visual Studio we have this error: error CS0104: 'Task' is an ambiguous reference between 'MyDbContext.Model.Task' and 'System.Threading.
Read more >
[SR-7209] Source compatibility regression: error: ambiguous ...
Using the latest nightly swift-DEVELOPMENT-SNAPSHOT-2018-03-14-a , it fails to compile with error: ambiguous reference to member 'min(by:)'.
Read more >
Incorrect Resharper ambiguous invocation error (regression in ...
This is a code pattern we use to have something in the direction of type-classes; specifically so we can multiple generic Tree datastructures,...
Read more >
c# - Ambiguous reference for IdentityUser - Stack Overflow
I'm implementing authentication in -net Core 2 api and I've found this error after this code:.
Read more >
63797 – Bogus ambiguous reference to 'sqrt'
A2=comp-fortran-90;75486336.1411 The following code is rejected with: y = sqrt(x) 1 Error: Name 'sqrt' at (1) is an ambiguous reference to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found