Skip to content

protected class definition is visible in inner scopes via import statement #12589

Open
@unkarjedy

Description

@unkarjedy

related https://youtrack.jetbrains.com/issue/SCL-20190
might be related: #11554

Reproduction steps

ThisBuild / version := "0.1.0-SNAPSHOT"

ThisBuild / scalaVersion := "2.12.15"

lazy val root = (project in file("."))
  .settings(
    name := "untitled9",
    libraryDependencies ++= Seq(
      "org.apache.spark" %% "spark-sql" % "3.2.1",
    )
  )

org.apache.spark.sql.types.AtomicType is protected[sql]
Note, it's companion object is public.

These examples are expectedly not compiled, producing compilation error:

object Main {
  val a: org.apache.spark.sql.types.AtomicType = ???
}
import org.apache.spark.sql.types.AtomicType

object Main {
  val a: AtomicType = ???
}

These are unexpectedly compiled fine without any compilation errors:

import org.apache.spark.sql.types.AtomicType

object Main {
  {
    val a: AtomicType = ???
  }
}
import org.apache.spark.sql.types.AtomicType

object Main {
  def foo = {
    val a: AtomicType = ???
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions