Skip to content

E161 naming error during second compilation of project #23043

Open
@rssh

Description

@rssh

Compiler version

Scala-3.3.5
alse reproduced at the latest master

reproduction

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

git clone [email protected]: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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions