Skip to content
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

scala.reflect.internal.FatalError: no context found for source file #6781

Open
unlsycn opened this issue Sep 17, 2024 · 1 comment
Open

scala.reflect.internal.FatalError: no context found for source file #6781

unlsycn opened this issue Sep 17, 2024 · 1 comment
Labels
needs more information Use if we need more information for a specific ticket

Comments

@unlsycn
Copy link

unlsycn commented Sep 17, 2024

Describe the bug

The type inference and error reports stop working.
Reports:


file://<WORKSPACE>/elaborator/src/ACLINT.scala
### scala.reflect.internal.FatalError: no context found for source-file://<WORKSPACE>/elaborator/src/ACLINT.scala,line-2,offset=84

occurred in the presentation compiler.

presentation compiler configuration:
Scala version: 2.13.14
Classpath:
<HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/mainargs_2.13/0.5.0/mainargs_2.13-0.5.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.14/scala-library-2.13.14.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.13.14/scala-reflect-2.13.14.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/os-lib_2.13/0.10.0/os-lib_2.13-0.10.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/upickle_2.13/3.3.1/upickle_2.13-3.3.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/chipsalliance/firtool-resolver_2.13/2.0.0/firtool-resolver_2.13-2.0.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-native_2.13/4.0.7/json4s-native_2.13-4.0.7.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/github/alexarchambault/data-class_2.13/0.2.6/data-class_2.13-0.2.6.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/commons/commons-text/1.12.0/commons-text-1.12.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/scopt/scopt_2.13/4.1.0/scopt_2.13-4.1.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-collection-compat_2.13/2.11.0/scala-collection-compat_2.13-2.11.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/geny_2.13/1.1.0/geny_2.13-1.1.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/ujson_2.13/3.3.1/ujson_2.13-3.3.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/upack_2.13/3.3.1/upack_2.13-3.3.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/upickle-implicits_2.13/3.3.1/upickle-implicits_2.13-3.3.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-xml_2.13/2.2.0/scala-xml_2.13-2.2.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-core_2.13/4.0.7/json4s-core_2.13-4.0.7.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-native-core_2.13/4.0.7/json4s-native-core_2.13-4.0.7.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.14.0/commons-lang3-3.14.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_2.13/3.3.1/upickle-core_2.13-3.3.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-ast_2.13/4.0.7/json4s-ast_2.13-4.0.7.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-scalap_2.13/4.0.7/json4s-scalap_2.13-4.0.7.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/thoughtworks/paranamer/paranamer/2.8/paranamer-2.8.jar [exists ], <WORKSPACE>/out/chisel/compile.dest/classes [exists ], <WORKSPACE>/out/foreign-modules/dependencies/chisel/build/svsim/2.13.14/compile.dest/classes [exists ], <WORKSPACE>/out/foreign-modules/dependencies/chisel/build/firrtl/2.13.14/compile.dest/classes [exists ], <WORKSPACE>/out/foreign-modules/dependencies/chisel/build/core/2.13.14/compile.dest/classes [exists ], <WORKSPACE>/out/foreign-modules/dependencies/chisel/build/macros/2.13.14/compile.dest/classes [exists ], <WORKSPACE>/out/panamaconverter/compile.dest/classes [exists ], <WORKSPACE>/out/foreign-modules/dependencies/chisel/build/chisel/2.13.14/compile.dest/classes [exists ], <WORKSPACE>/out/foreign-modules/dependencies/chisel/build/panamalib/2.13.14/compile.dest/classes [exists ], <WORKSPACE>/out/foreign-modules/dependencies/chisel/build/panamaom/2.13.14/compile.dest/classes [exists ], <WORKSPACE>/out/foreign-modules/dependencies/chisel/build/circtpanamabinding/compile.dest/classes [exists ], <WORKSPACE>/out/gcd/compile.dest/classes [exists ], <WORKSPACE>/out/aclint/compile.dest/classes [exists ], <WORKSPACE>/out/axi4/compile.dest/classes [exists ], <WORKSPACE>/out/regrouter/compile.dest/classes [exists ], <WORKSPACE>/out/plic/compile.dest/classes [exists ], <WORKSPACE>/out/dm/compile.dest/classes [exists ], <WORKSPACE>/out/clic/compile.dest/classes [exists ], <WORKSPACE>/out/aia/compile.dest/classes [exists ], <WORKSPACE>/out/iommu/compile.dest/classes [exists ]
Options:
-Ymacro-annotations


action parameters:
offset: 84
uri: file://<WORKSPACE>/elaborator/src/ACLINT.scala
text:

package org.chipsalliance.ACLINT.elaborator

import mainargs._
import org.chipsalliance.ACLINT.elaborator.Elaborator

object ACLINTMain extends Elaborator {
  @main
  case class ACLINTParameterMain(
    @arg(name = "xLen") xLen:                   Int,
    @arg(name = "useAsyncReset") useAsyncReset: Boolean,
    @arg(name = "target-dir") targetDir:        os.Path) {
    def convert: ACLINTParameter =
      ACLINTParameter(xLen, useAsyncReset)
  }

  implicit def ACLINTParameterMainParser: ParserForClass[ACLINTParameterMain] =
    ParserForClass[ACLINTParameterMain]

  @main
  def config(@arg(name = "parameter") parameter: ACLINTParameterMain) =
    os.write.over(targetDir / s"${getClass.getSimpleName.replace("$", "")}.json", configImpl(parameter.convert))

  @main
  def design(
    @arg(name = "parameter") parameter:  os.Path,
    @arg(name = "target-dir") targetDir: os.Path
  ) =
    designImpl[ACLINT, ACLINTParameter](os.read(parameter))

  def main(args: Array[String]): Unit = ParserForMethods(this).runOrExit(args)
}

Error stacktrace:

scala.tools.nsc.interactive.CompilerControl.$anonfun$doLocateContext$1(CompilerControl.scala:100)
	scala.tools.nsc.interactive.CompilerControl.doLocateContext(CompilerControl.scala:100)
	scala.tools.nsc.interactive.CompilerControl.doLocateContext$(CompilerControl.scala:99)
	scala.tools.nsc.interactive.Global.doLocateContext(Global.scala:114)
	scala.meta.internal.pc.PcDefinitionProvider.definitionTypedTreeAt(PcDefinitionProvider.scala:151)
	scala.meta.internal.pc.PcDefinitionProvider.definition(PcDefinitionProvider.scala:68)
	scala.meta.internal.pc.PcDefinitionProvider.definition(PcDefinitionProvider.scala:16)
	scala.meta.internal.pc.ScalaPresentationCompiler.$anonfun$definition$1(ScalaPresentationCompiler.scala:393)

Short summary:

scala.reflect.internal.FatalError: no context found for source-file:///elaborator/src/ACLINT.scala,line-2,offset=84

Expected behavior

No response

Operating system

Linux

Editor/Extension

VS Code

Version of Metals

v1.3.5

Extra context or search terms

No response

@tgodzik
Copy link
Contributor

tgodzik commented Sep 20, 2024

Thanks for reporting! Does this continue to be the case? Was there any other issues reported for example in .metals/metals.log ? Would you be able to provide a reproduction?

Looks like the issue is in the compiler itself somehow, maybe the compiled artifacts are broken?

Did reloading the window help? Or alternatively running clean compile?

@tgodzik tgodzik added the needs more information Use if we need more information for a specific ticket label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more information Use if we need more information for a specific ticket
Projects
None yet
Development

No branches or pull requests

2 participants