Skip to content

Nonsensical imports treated cause weird error messages #19413

Closed
@keynmol

Description

@keynmol

Compiler version

3.3.1

Minimized code

import hello.bla.*

@main def hello = 
  test(1)

object kla:
  def ra = ???

import kla.bla.ra1
@main def test = 
  ra1()

Output

Compiling project (Scala 3.3.1, JVM (17))
[error] ./test.scala:10:12
[error] Cyclic reference involving val <import>
[error] import kla.bla.ra1
[error]            ^
Error compiling project (Scala 3.3.1, JVM (17))

Expectation

I would expect hello.bla import highlighted first, as it makes no sense - import from a function
But if you comment out everything after the hello function, you get only "test not found" error.

The "Cyclic reference" error is also confusing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:reportingError reporting including formatting, implicit suggestions, etcbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesitype:bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions