| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
Collect bindings in casedefs unless "@-bound to _".
Also minor refactor to make it easier to see the cases
of `id @ _`. Tupled matching is supposed to be efficient
either now or soon.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce `-Ywarn-unused:x,y,z` and exploit `-Ywarn-unused:patvars`.
Although the tree attachment for shielding patvars from warnings
is not structural, sneaking the settings flag into the reflection
internal TreeGen is awkward.
Add test to ensure isolation of patvars warning from others.
`-Ywarn-unused-import` is an alias for `-Ywarn-unused:imports`.
`-Xlint:unused` is an alias for `-Ywarn-unused`, but not enabled
yet. The help text advises to use `-Ywarn-unused`. The future can
decide if `-Xlint:unused-imports` is warranted.
|
|
|
|
|
|
|
| |
Polish notation, as in shoe-shine, as recommended by
the warning.
Minor clean-ups as advocated by `Ywarn-unused` and `Xlint`.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Warn for unused `case X(x) =>` but, as an escape hatch,
not for `case X(x @ _) =>`. The latter form is deemed
documentary. (Named args could serve a similar purpose,
`case X(x = _) =>`.)
An attachment is used to mark the bound var, and the
symbol position is used to correlate the identifier
with the variable that is introduced. This mechanism
doesn't work yet when only a single var is defined.
|
|\
| |
| | |
SI-10148 Follow Java for float literals
|
| |
| |
| |
| |
| | |
Use `Float.parseFloat` instead of converting from Double.
Error when a value rounds to zero.
|
| |
| |
| |
| |
| |
| | |
For 2.12 migration, insert missing case class param section,
strip caseaccessor from implicit paramsection,
and deprecate the adaptation.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Current semantics are that leading implicit param
turns the parameter section into an implicit section
(though without making other params implicitly
implicit).
Warn if more than one head of a param section is
implicit, since that results in multiple implicit
param sections.
|
| |
| |
| |
| |
| |
| |
| | |
Instead of aborting when a class def has extra
parameter section, take all parameter sections
and sanity check the use of leading implicit
to indicate an implicit parameter section.
|
|/
|
|
|
|
|
|
|
|
| |
Case class must have a non-implicit param list.
Error early, error often.
Also update spec to say that class implicitly gets
a non-implicit parameter section if it doesn't
have one, and that a case class must have one.
|
|\ |
|
| |
| |
| |
| |
| |
| | |
Fixed the warning when main module is accompanied by snippets.
Minor clean-up so even I can follow what is returned.
|
| |
| |
| |
| |
| |
| | |
It's pretty confusing when your script object becomes a local
and then nothing happens. Such as when you're writing a test and
it takes forever to figure out what's going on.
|
| |
| |
| |
| |
| |
| |
| | |
In an unwrapped script, where a `main` entry point is discovered
in a top-level object, retain all top-level classes.
Everything winds up in the default package.
|
| |
| |
| |
| | |
Scripting knows it by name.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Cheap name test: if the script object extends "App",
take it for a main-bearing parent.
Note that if `-Xscript` is not `Main`, the default,
then the source is taken as a snippet and there is
no attempt to locate an existing `main` method.
|
| | |
|
|\ \
| | |
| | | |
SI-8044 Allow binding backquoted varid in patterns
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Allows arbitrary identifier in `X @ pat`, including
non-varids. This goes to regularity.
Users of this syntax are not likely to be confused
by the "backquoted var id is stable" rule.
Also for sequence pattern, `X @ _*`.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previously, a varid could not be backquoted, so that it was not
possible to introduce variables with names such as `type` in a
match expression.
This commit allows backquoted varids in `case x @ _` and
`case x: Int`. In neither position is a stable id accepted,
that is, an id with leading uppercase.
Therefore, this commit merely relaxes the backquoted varid to
be taken as a normal varid in these contexts.
|
|\ \ \
| |/ /
|/| | |
SI-9665 Backquoted vbar in extractor pattern
|
| | |
| | |
| | |
| | | |
Allow an infix extractor named `|`, when backquoted.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The body of `def delay[T](v: => T) = (v _): F0[T]`
becomes `() => v` during `typedEta`, and then uncurry
considers whether to strip the function wrapper since
`v` is known to be a `Function0` thunk. Stripping is sound
when the expected type is `Function0` for this expression,
but that's no longer a given, since we could be expecting any
nullary SAM.
Also sweep up a bit around `typedEta`.
Encapsulate the, erm, creative encoding of
`m _` as `Typed(m, Function(Nil, EmptyTree))`.
|
|/ /
| |
| |
| |
| |
| | |
Added a deprecation warning for `-optimize`.
Later we'll also graduate `-Yopt` to `-opt`, probably for 2.12.0-M5.
|
|\|
| |
| |
| |
| |
| | |
Conflicts:
build.sbt
scripts/jobs/integrate/bootstrap
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit adds explicit checks with syntax errors for tuple literals
and types of more than 22 elements. An alternative approach to fixing
SI-9572 would be to revert to the old failure mode of Scala 2.10 where
references to arbitrary `scala.TupleXY` would be generated in the
parser, which then leads to “type/object not found” errors in the
typechecker. This fix here is more intrusive but arguably provides a
better user experience.
Methods `stripParens` and `makeBinop` are moved from `TreeBuilder` to
`Parsers` because they can now generate syntax errors. New methods
`makeSafeTupleType` and `makeSafeTupleTerm` implement the error checking
on top of `makeTupleType` and `makeTupleTerm`. They are overridden with
no-op versions in the quasiquotes parser because it also overrides `makeTupleType` and `makeTupleTerm` in a way that supports arbitrary tuple sizes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Language imports are preceding other imports
- Deleted empty file: InlineErasure
- Removed some unused private[parallel] methods in
scala/collection/parallel/package.scala
This removes hundreds of warnings when compiling with
"-Xlint -Ywarn-dead-code -Ywarn-unused -Ywarn-unused-import".
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A trio of problems were hampering autocompletion of annotations.
First, given that that annotation is written before the annotated
member, it is very common to end parse incomplete code that has a
floating annotation without an anotatee.
The parser was discarding the annotations (ie, the modifiers) and
emitting an `EmptyTree`.
Second, the presetation compiler was only looking for annotations
in the Modifiers of a member def, but after typechecking annotations
are moved into the symbol.
Third, if an annotation failed to typecheck, it was being discarded
in place of `ErroneousAnnotation`.
This commit:
- modifies the parser to uses a dummy class- or type-def tree,
instead of EmptyTree, which can carry the annotations.
- updates the locator to look in the symbol annotations of the
modifiers contains no annotations.
- uses a separate instance of `ErroneousAnnotation` for each
erroneous annotation, and stores the original tree in its
`original` tree.
|
| |
| |
| |
| | |
Since it's a private method, it's safe to just rename it.
|
| |
| |
| |
| |
| |
| |
| |
| | |
only trivial merge conflicts here.
not dealing with PR #4333 in this merge because there is a substantial
conflict there -- so that's why I stopped at
63daba33ae99471175e9d7b20792324615f5999b for now
|
|\|
| |
| |
| | |
merge/2.11.x-to-2.12.x-20150501
|
| |
| |
| |
| |
| | |
This commit corrects many typos found in scaladocs and comments.
There's also fixed the name of a private method in ICodeCheckers.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Added `since` to deprecation statement
- Added unit to parameter list
- Removed usage of deprecated method polyType
- Replaced deprecated `debugwarn` with `devWarning`
- Changed switch statement to if else in order to remove a warning
- Switched implementation of `init` and `processOptions` to prevent
warning
- Replaced deprecated `Console.readLine` with `scala.io.StdIn.readLine`
- Replaced deprecated `startOrPoint` with `start`
- Replaced deprecated `tpe_=` with `setType`
- Replaced deprecated `typeCheck` with `typecheck`
- Replaced deprecated `CompilationUnit.warning` with `typer.context.warning`
- Replaced deprecated `scala.tools.nsc.util.ScalaClassLoader` with `scala.reflect.internal.util.ScalaClassLoader`
- Replaced deprecated `scala.tools.ListOfNil` with `scala.reflect.internal.util.ListOfNil`
- Replaced deprecated `scala.tools.utils.ScalaClassLoader` with `scala.reflect.internal.util.ScalaClassLoader`
- Replaced deprecated `emptyValDef` with `noSelfType`
- In `BoxesRunTime` removed unused method and commented out unused values. Did not delete to keep a reference to the values. If they are deleted people might wonder why `1` and `2` are not used.
- Replaced deprecated `scala.tools.nsc.util.AbstractFileClassLoader` with `scala.reflect.internal.util.AbstractFileClassLoader`
|
|/
|
|
|
|
|
|
| |
Allow +,-,!,~ to be used as unprefixed identifiers.
As prefix operators, they must be followed by
a simple expression, so otherwise, consume the
id itself as the start of a simple expression.
|
|
|
|
| |
'&' isn't a prefix operator, perhaps to the chagrin of the C crowd.
|
|
|
|
|
|
| |
The mentioned issue is a presentation compiler issue, but its root cause is a bug in the parser which incorrectly assigned positions to incomplete selection trees (i.e. selections that lack an indentifier after dot and have some whitespace instead).
In detail: for such incomplete selection trees, the "point" of the position should be immediately after the dot but instead was at the start of next token after the dot. For range positions, this caused a pathological situation where the "point" was greater than the "end" of the position. This position is later used by the typechecker during resolution of dynamic calls and causes it to crash. Of course, because a syntactically incorrect code is required for the bug to manifest, it only happens in the presentation compiler.
|
|\
| |
| | |
part 2 of the big error reporting refactoring
|
| |
| |
| |
| |
| |
| | |
Create a trait Parsing, which, like Reporting,
factors our functionality from Global (aka. "the cake"),
that is related to global aspects of configuring parsing.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Strictly trivial updates for readability.
I used to prefer procedure syntax, but since it was
scheduled for removal, I can't scan a def without an
equals sign.
|
|/
|
|
| |
And adjust the test.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Inline the forwarders from CompilationUnit, which should not affect behavior.
Since all forwarders lead to global.reporter, don't first navigate
to a compilation unit, only to then forward back to global.reporter.
The cleanup in the previous commits revealed a ton of confusion
regarding how to report an error.
This was a mechanical search/replace, which has low potential for messing
things up, since the list of available methods are disjoint between
`reporter` and `currentRun.reporting`. The changes involving `typer.context`
were done previously.
Essentially, there are three ways to report:
- via typer.context, so that reporting can be silenced (buffered)
- via global.currentRun.reporting, which summarizes (e.g., deprecation)
- via global.reporter, which is (mostly) stateless and straightforward.
Ideally, these should all just go through `global.currentRun.reporting`,
with the typing context changing that reporter to buffer where necessary.
After the refactor, these are the ways in which we report (outside of typer):
- reporter.comment
- reporter.echo
- reporter.error
- reporter.warning
- currentRun.reporting.deprecationWarning
- currentRun.reporting.incompleteHandled
- currentRun.reporting.incompleteInputError
- currentRun.reporting.inlinerWarning
- currentRun.reporting.uncheckedWarning
Before:
- c.cunit.error
- c.enclosingUnit.deprecationWarning
- context.unit.error
- context.unit.warning
- csymCompUnit.warning
- cunit.error
- cunit.warning
- currentClass.cunit.warning
- currentIClazz.cunit.inlinerWarning
- currentRun.currentUnit.error
- currentRun.reporting
- currentUnit.deprecationWarning
- currentUnit.error
- currentUnit.warning
- getContext.unit.warning
- getCurrentCUnit.error
- global.currentUnit.uncheckedWarning
- global.currentUnit.warning
- global.reporter
- icls.cunit.warning
- item.cunit.warning
- reporter.comment
- reporter.echo
- reporter.error
- reporter.warning
- reporting.deprecationWarning
- reporting.incompleteHandled
- reporting.incompleteInputError
- reporting.inlinerWarning
- reporting.uncheckedWarning
- typer.context.unit.warning
- unit.deprecationWarning
- unit.echo
- unit.error
- unit.incompleteHandled
- unit.incompleteInputError
- unit.uncheckedWarning
- unit.warning
- v1.cunit.warning
All these methods ended up calling a method on `global.reporter`
or on `global.currentRun.reporting` (their interfaces are disjoint).
Also clean up `TypeDiagnostics`: inline nearly-single-use private methods.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a follow-up to SI-5702 which enabled use of
`*` in infix notation in patterns.
Most of the work is in distinguishing infix from a
sequence pattern.
Also, do not take backticked star as the repeated
parameter marker in postfix position. That is,
`Int``*``` is not `Int*` -- I hope double-tick
renders as tick. There is not a special use case
except that backticks mean "I am an identifier, as
is, and not a keyword."
|
|
|
|
|
|
| |
Was caused by the ordering of parser cases. Need to check for definition
first due to the fact that modifiers unquote looks like identifier from
parser point of view.
|
|\
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/compiler/scala/reflect/macros/compiler/Resolvers.scala
src/compiler/scala/reflect/macros/contexts/Typers.scala
src/compiler/scala/tools/reflect/ToolBoxFactory.scala
src/reflect/scala/reflect/api/BuildUtils.scala
|
| |\
| | |
| | | |
Fix SI-8202 and improve support for splicing patterns into vals
|
| | | |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Take away `argv` and make `args` the standard parameter name.
This is a quick fix to avoid "unused local" lint error. All
the examples use `args`; in particular, "Step 4. Write some
Scala scripts" in "Programming in Scala" uses `args`.
I see the footnote there is also where Odersky concatenation is
specified, `"Hello, "+ args(0) +"!"` with no space next to the
literals.
Also removes `argv` from `StdNames`. Was torn whether just to
add `argc`. Maybe start a new project to house Names, emeritus.
|