Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@ class ScReferenceExpressionImpl(node: ASTNode) extends ScReferenceImpl(node) wit
case inf: ScInfixExpr if this == inf.operation || this == inf.getBaseExpr =>
StdKinds.refExprQualRef
case _ =>
StdKinds.refExprLastRef
// Mill files allow direct references to package
// objects, even though normal .scala files do not
if (this.containingScalaFile.exists(_.isMillFile)) StdKinds.refExprQualRef
else StdKinds.refExprLastRef
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.jetbrains.plugins.scala.annotator

/**
* Check customized behavior for Mill build files
*/
class MillHighlightingTests extends ScalaHighlightingTestBase {
//SCL-23198
val code = """package foo{
| object `package`
|}
|
|package bar{
| object qux{
| val reference = foo
| }
|}
|""".stripMargin
def testBuildMillFileAllowsPackageReference(): Unit = {
scala.Predef.assert(errorsFromScalaCode(code, "build.mill").isEmpty)
}
def testPackageFileAllowsPackageReference(): Unit = {
scala.Predef.assert(errorsFromScalaCode(code, "package.mill").isEmpty)
}
def testBuildMillScalaFileAllowsPackageReference(): Unit = {
scala.Predef.assert(errorsFromScalaCode(code, "build.mill.scala").isEmpty)
}
def testNormalScalaFileDisAllowsPackageReference(): Unit = {
scala.Predef.assert(errorsFromScalaCode(code, "build.scala").nonEmpty)
}
}