Skip to content

Allow customizing root imports #474

Closed
@lrytz

Description

@lrytz

Summary of the discussion in scala/scala#5350:

  • Remove (not deprecate) -Ysysdef and -Ypredef and -Yno-predef and -Yno-imports
  • -Yimports:scala._,scala.Predef._, requires fully qualified imports (like if they all started with _root_.). -Yimports:_ for none. Colon-syntax using MultiStringSetting.
  • An explicit import of Predef.x in a source file removes the implicit scala.Predef._ import from that file. This is current behavior, and it will stay.
    • This special treatment also applies if -Yimports is present and includes scala.Predef._ -- this can still be debated (comment)
    • TODO: find a way to declare which root imports get predef-style treatment -- this is why the PR initially had the split between -Ysysdef and -Ypredef
    • Imports listed in -Yimports cannot be un-imported in individual files (things like import Predef.{_ => _} or import scala.{util => _, _}) -- maybe this can still be considered. For predefy-style imports it can be done by importing a single member that's not actually used.

Aftermath:

  • Notify IDE developers about the change (comment)
  • Update warn-unused (comment)

It also sounds like an export feature as outlined here is universally welcomed. There is (probably?) still a chance to get this in 2.13 if someone takes the lead. It should be coordinated with #442 (ideas to simplify imports).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions