forked from scala/scala
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-Wconf compiler flag for configuring compiler warnings
Warnings are assigned a category. Warnings can be filtered by category, by message regex, by site where they are issued, and by source path. Deprecations can additionally be filtered by origin (deprecated definition) and `since` version. Filtered warnings can be reported as error, warning, info, summary (like deprecations) or silent. Adds a `-rootdir` compiler flag. It is used to relativize file paths when using source filters (`-Wconf:src=some/source/File.scala:s`). There might be other uses for it in the future. Unchecked warnings are now all shown by default (they were summarized like deprecations before). The `-deprecation`, `-feature` and `-unchecked` settings are no longer directly used in the compiler, they are shortcuts for specific `Wconf` configurations. The compiler only looks at `-Wconf`. Message filtering is performed in `global.currentRun.reporting`, not in the `Global.reporter`. The reasons are: - Separation of concerns: `Reporter`s worry about how to do reporting, removing duplicate messages. - Custom `Reporter`s are used by sbt, silencer, REPL, etc. It's too hard to do the necessary changes to the `Reporter` interface. - The `Wconf` setting could change between compiler runs. `currentRun.reporting` respects those changes. So all warnings in the compiler should go through `global.runReporting` (which is the same as `global.currentRun.reporting`). This method takes four parameters: pos, msg, category (new), site (new). The site is usually `context.owner` (in the frontend) or `currentOwner` (in transformations). `Context` has a `warn` method with 3 parameters (pos, msg, category) and inserts the `owner` as `site`, so this is used in the frontend (context reporters are also used to support silent mode / trying twice). The `global.warning` method is deprecated and no longer used. There are a few calls to `Reporter.warning` left in the codebase where no `runReporting` is reachable, I think they are all OK not to categorize / allow filtering. E.g., when running Scaladoc ``` reporter.warning(null, "Plugins are not available when using Scaladoc") ```
- Loading branch information
Showing
103 changed files
with
1,532 additions
and
382 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.