Skip to content

E161 naming error during second compilation of project #23043

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

Open
rssh opened this issue Apr 24, 2025 · 3 comments · May be fixed by #23044
Open

E161 naming error during second compilation of project #23043

rssh opened this issue Apr 24, 2025 · 3 comments · May be fixed by #23044

Comments

@rssh
Copy link
Contributor

rssh commented Apr 24, 2025

Compiler version

Scala-3.3.5
alse reproduced at the latest master

Minimized code

Unfortunelly, I was unhappy to minimize (because after any significatn minimization issue is gone), but here is a 'long way':

git clone git@github.com:nau/scalus.git
cd scalus
git checkout dotty-naming-issue-2024-04-24

sbt scalusJVM/test:compile   ## success. [wait a minute or two]

echo // >> shared/src/test/scala/scalus/prelude/DerivingSpec.scala

sbt scalusJVM/test:compile  ## failure

Output

[error] -- [E161] Naming Error: /Users/rssh/tests/dotty/naming-issue-scalus-report/scalus/shared/src/test/scala/scalus/prelude/DerivingSpec.scala:18:7 
[error] 18 |object DerivingSpecScope {
[error]    |^
[error]    |DerivingSpecScope is already defined as package scalus.prelude.DerivingSpecScope
[error] 19 |    enum AE1 derives ToData, FromData:
[error] 20 |        case A extends AE1
[error] 21 |        case B(b: BigInt) extends AE1
[error] 22 |        case C(b: BigInt, bs: ByteString) extends AE1
[error] 23 |}
[error] -- [E006] Not Found Error: /Users/rssh/tests/dotty/naming-issue-scalus-report/scalus/shared/src/test/scala/scalus/prelude/DerivingSpec.scala:36:51 
[error] 36 |            val a = summon[scalus.prelude.FromData[AE1]](d)
[error]    |                                                   ^^^
[error]    |                                                   Not found: type AE1
[error]    |----------------------------------------------------------------------------
[error]    | Explanation (enabled by `-explain`)
[error]    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]    | Each identifier in Scala needs a matching declaration. There are two kinds of
[error]    | identifiers: type identifiers and value identifiers. Value identifiers are introduced
[error]    | by `val`, `def`, or `object` declarations. Type identifiers are introduced by `type`,
[error]    | `class`, `enum`, or `trait` declarations.
[error]    |
[error]    | Identifiers refer to matching declarations in their environment, or they can be
[error]    | imported from elsewhere.
[error]    |
[error]    | Possible reasons why no matching declaration was found:
[error]    |  - The declaration or the use is mis-spelt.
[error]    |  - An import is missing.
[error]     ----------------------------------------------------------------------------
[error] -- [E006] Not Found Error: /Users/rssh/tests/dotty/naming-issue-scalus-report/scalus/shared/src/test/scala/scalus/prelude/DerivingSpec.scala:38:21 
[error] 38 |                case AE1.A        => BigInt(1)
[error]    |                     ^^^
[error]    |                     Not found: AE1
[error]    |----------------------------------------------------------------------------
[error]    | Explanation (enabled by `-explain`)
[error]    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]    | Each identifier in Scala needs a matching declaration. There are two kinds of
[error]    | identifiers: type identifiers and value identifiers. Value identifiers are introduced
[error]    | by `val`, `def`, or `object` declarations. Type identifiers are introduced by `type`,
[error]    | `class`, `enum`, or `trait` declarations.
[error]    |
[error]    | Identifiers refer to matching declarations in their environment, or they can be
[error]    | imported from elsewhere.
[error]    |
[error]    | Possible reasons why no matching declaration was found:
[error]    |  - The declaration or the use is mis-spelt.
[error]    |  - An import is missing.
....

Expectation

The second time should also compile.

@rssh rssh added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 24, 2025
@rssh
Copy link
Contributor Author

rssh commented Apr 24, 2025

Here is a fix which at least make all compile: #23044

rssh added a commit to rssh/dotty that referenced this issue Apr 24, 2025
@Gedochao Gedochao linked a pull request Apr 24, 2025 that will close this issue
@Gedochao Gedochao added area:typeclass-derivation and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 24, 2025
@rssh
Copy link
Contributor Author

rssh commented Apr 24, 2025

oops, looks like fix is not enough

@rssh
Copy link
Contributor Author

rssh commented Apr 25, 2025

fix updated

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