| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
SI-4563 friendlier behavior for Ctrl+D in the REPL
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Closing the REPL with Ctrl+D does not issue a newline, so the user's
prompt displays on the same line as the `scala>` prompt. This is bad.
We now force a newline before closing the interpreter, and display
`:quit` while we're at it so that people know how to exit the REPL
(since `exit` doesn't exist anymore).
The tricky part was to only add a newline when the console is
interrupted, and *not* when it is closed by a command (like `:quit`),
since commands are processed after their text (including newline) has
been sent to the console.
|
|\ \
| | |
| | | |
SI-6476 Improve error on escapement
|
| | |
| | |
| | |
| | | |
And adjust the test.
|
| |/
|/|
| |
| |
| |
| | |
Orphaned by the override check reversion that deleted the test source.
2524fdde3edc7b668fdb4bf68e990141d3ec18d6
|
| |
| |
| |
| |
| |
| | |
Let's not scare people, and try to give them some advice.
PS: we should really come up with a better mechanism for testing errors/warnings
|
|/
|
|
|
|
| |
Missed the case of comparing a non-empty range to an empty one. Fixed by checking nonEmpty/isEmpty on other collection.
Added a test to verify the behavior.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Also clarify usage of -Xlint flag.
Align more with javac -Xlint:all,-flag,flag where once a flag is
explicitly enabled it cannot be disabled, but where the wildcard
is a backstop only. (There is no all option yet here.)
-Xlint and -Xlint:_ just set a flag which is consulted by any
unset lint warning.
Xlint warnings consult the state of Xlint when they are unset.
Individual -Ywarn-ings do not.
Other warnings are explicitly set to false. They can only be
enabled programmatically.
Some tests are corrected. Also, option order is no longer
significant, see the unit test.
|
|\
| |
| | |
SI-8525 -Xlint:nowarn-missing-interpolator
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Turn anonymous references to `settings.lint` into named settings.
After that, trust to Adriaan to make them filterable.
There are a few remaining top-level -Y lint warnings that are
deprecated.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Turn off lint warnings with negating prefix, and add a lint-only
warning for the infamously nagging "Did you forget the interpolator?"
That message is made more dignified.
Without `-Xlint:false`, there is no mechanism to turn off
anonymous linters once `-Xlint` is selected.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Make -Xlint a "multichoice" option for purposes of option parsing.
This allows turning on "lint with these warnings" instead of only
"turn off these warnings but enable other lint warnings".
```
$ scalac -Xlint:warn-adapted-args linty.scala # lint plus a warning
$ scalac -Xlint warn-adapted-args linty.scala # same
$ scalac -Xlint linty.scala # same as now
$ scalac -Xlint -- linty.scala # ok, not necessary
$ scalac -Xlint _ -- linty.scala # another funky underscore
```
This would also enable Xlint options that are not standalone options,
although that is not implemented in this commit. For example,
`-Xlint:no-missing-interpolator` could be used to disable that
warning. (There is no `-Xoption:flavor=off` syntax.) (`no-` switches
would not be enabled by `_`.)
|
|\ \
| | |
| | | |
SI-5919 TypeTags and Exprs should be serializable
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
- Make TypeCreator and TreeCreator extend Serializable.
- When replacing a SerializedTypeTag with a TypeTag or WeakTypeTag,
do not use scala.reflect.runtime.universe.rootMirror, since
it is unlikely to find user classes; instead, create a runtime
mirror using the context ClassLoader of the current thread.
Use the same logic for SerializedExpr.
- Remove writeObject/readObject methods from SerializedTypeTag
and SerializedExpr since they are unused.
- Add @throws annotation on writeReplace and readResolve methods.
- Handle SecurityException if the current thread cannot access the
context ClassLoader.
- To make type tags of primitive value classes serializable, make
PredefTypeCreator a top-level class. Otherwise, it would
retain a reference to the enclosing Universe,
rendering the TypeCreator non-serializable.
Binary compatibility:
- Keep nested PredefTypeCreator class to avoid backward binary
incompatible change.
- Keep `var` modifiers on the class parameters of
SerializedTypeTag for backward binary compatibility.
- Adds filter rules to forward binary compatibility whitelist:
- `TypeCreator`, `PredefTypeCreator`, and `TreeCreator` must now
extend from `Serializable`.
- Must have new class `scala.reflect.api.PredefTypeCreator`
to avoid problematic outer reference.
|
|\ \ \
| | | |
| | | | |
relaxes attachment-matching rules
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
It came as a surprise recently, but attachments.contains/get/update/remove
require the class of the payload to match the provided tag exactly, not
taking subclassing into account. This commit fixes the oversight.
|
|\ \ \ \
| |_|/ /
|/| | | |
prevents c.internal.subpatterns from destroying rangeposes
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This commit continues the work started in fcb3932b32.
As we've figured out the hard way, exposing internally maintained trees
(e.g. macro application) to the user is dangerous, because they can mutate
the trees in place using one of the public APIs, potentially corrupting our
internal state.
Therefore, at some point we started duplicating everything that comes from the user
and goes back to the user. This was generally a good idea due to the reason
described above, but there was a problem that we didn't foresee - the problem
of corrupted positions.
It turns out that Tree.duplicate focuses positions in the tree being processed,
turning range positions into offset ones, and that makes it impossible for macro
users to make use of precise position information.
I also went through the calls to Tree.duplicate to see what can be done
to them. In cases when corruptions could happen, I tried to replace duplicate
with duplicateAndKeepPositions.
Some notes:
1) Tree rehashing performed in TreeGen uses duplicates here and there
(e.g. in mkTemplate or in mkFor), which means that if one deconstructs
a macro argument and then constructs it back, some of the positions in
synthetic trees might become inaccurate. That's a general problem with
synthetic trees though, so I don't think it should be addressed here.
2) TypeTree.copyAttrs does duplication of originals, which means that
even duplicateAndKeepPositions will adversely affect positions of certain
publicly accessible parts of type trees. I'm really scared to change this
though, because who knows who can use this invariant.
3) Some methods that can be reached from the public API (Tree.substituteXXX,
c.reifyXXX, c.untypecheck, ...) do duplicate internally, but that shouldn't be
a big problem for us, because nothing is irreversibly corrupted here.
It's the user's choice to call those methods (unlike with TypeTree.copyAttrs)
and, if necessary, they can fixup the positions themselves afterwards.
4) Macro engine internals (macro impl binding creation, exploratory typechecking
in typedMacroBody) use duplicate, but these aren't supposed to be seen by the user,
so this shouldn't be a problem.
5) Certain parser functions, member syntheses and typer desugarings also duplicate,
but in those cases we aren't talking about taking user trees and screwing them up,
but rather about emitting potentially imprecise positions in the first place.
Hence this commit isn't the right place to address these potential issues.
|
|\ \ \
| | | |
| | | | |
SI-8608 f interpolator emits constant strings
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
When invoking `format` is obviated by a lack of
formatting fields, then just degenerate to an
unenhanced constant string.
This means it doesn't cost anything to use
f"$$ordinary" in place of "$ordinary", which
may cause warnings under -Xlint.
Note that certain format literals, in particular
for line separator %n, are not actually literals and
can't be replaced at compile time.
|
|/ / /
| | |
| | |
| | |
| | |
| | | |
The method `missingParams` which returns undefined parameters of
a given invocation expression still assumed that named arguments can
only appear after positional ones.
|
|\ \ \
| |_|/
|/| | |
SI-8708 Fix pickling of LOCAL_CHILD child of sealed classes
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When a sealed class or trait has local children, they are not pickled
in as part of the children of the symbol (introduced in 12a2b3b to fix
Aladdin bug 1055). Instead the compiler adds a single child class
named LOCAL_CHILD. The parents of its ClassInfoType were wrong: the
first parent should be a class. For sealed traits, we were using the
trait itself.
Also, the LOCAL_CHILD dummy class was entered as a member of its
enclosing class, which is wrong: it represents a local (non-member)
class, and it's a synthetic dummy anyway.
|
|/ / |
|
|/
|
|
|
|
|
| |
mkString is overriden in BufferedSource for performance, but the
implementation always used the wrong reader. This seems to be a typo
(`allReader` is declared 5 lines earlier but never used, `charReader`
is used in its place).
|
|\
| |
| | |
adds MacroPlugin.pluginsIsBlackbox
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is an important omission in the current macro plugin API, which was
designed before the blackbox vs whitebox separation was implemented.
Even if one overrides pluginsTypedMacroBody and pluginsMacroExpand,
that would still be not enough to write a custom macro expander, because
typedImplicit1 uses isBlackbox, which is tightly coupled with the standard
way of reading/writing macro signatures.
|
|\ \
| | |
| | | |
macro args now correctly preserve range positions
|
| |/
| |
| |
| |
| |
| |
| |
| | |
Somewhen in the 2.11.0 development cycle we started duplicating macro arguments
for increased robustness. What wasn't taken into account though is that
Tree.duplicate destroys range positions. This commit fixes the problem.
2.10.x is unaffected by this bug, because it doesn't duplicate the args yet.
|
|\ \
| | |
| | | |
SI-8657 don't miss tailrec defs in more positions
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
1) First operand of boolean expression using `&&` or `||`. Second operands of
those boolean exprs were already treated specially here but handling for first
operands was missing.
2) Condition of `If`. Also added a test for guards.
|
|\ \ \
| | | |
| | | | |
SI-8185 Correct grammar for single-warning compilation run
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
SI-7372 fix wrong insertion point for binary & linear search.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
It should return the position the value would have if it was a part of
the sequence. Somehow even the test was wrong.
|
|\ \ \ \ \
| |_|_|/ /
|/| | | | |
SI-6967 Fix ClassTag unapply for primitives
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This commit fixes the behavior of ClassTag's Any-accepting unapply
overload. Previously, ClassTag had overloads of unapply that accepted
all of the Java primitive aliases (language-supported magic classes
extending AnyVal), as well as an implementation that accepted an Any.
All of the AnyVal-accepting (more specific) versions of the methods
worked correctly. However, the Any-accepting version incorrectly handled
these types. For example, ClassTag.Int.unapply(3) would return Some(3)
(through the Int-accepting overload), while ClassTag.Int.unapply(3: Any)
would return None (through the Any-accepting overload). This commit
unifies these behaviors, making ClassTag.Int.unapply(3: Any) return
Some(3). It accomplishes this by adding a pattern match on the type of
that method's argument, which will delegate to one of the
more-specifically-typed overloads if possible. It also improves the
formatting of the code a bit.
One thing to note (though I doubt anyone will ever do this based on this
message) is that the AnyVal-subtype-accepting overloads should be
removed in Scala 2.12, as they are unneeded. I placed a note to this
effect into the code.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-8611 Avoid accidental patmat unification with refinement types
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
In the enclosed test, t8611a.scala, the patterns `O.{A, B}` were
incorrect treated as equivelent by the combination of
`uniqueTpForTree` and `Const.uniqueTpForTree`.
`uniqueTpForTree` used `Type#narrow` to try to create a distinct
type for each new pattern tree it encountered. However, narrowing a
`RefinedType` does not create a distinct type as we are used to
when narrowing, e.g. a class type.
// Type
def narrow: Type =
if (phase.erasedTypes) this
else {
val cowner = commonOwner(this)
refinedType(this :: Nil, cowner, EmptyScope, cowner.pos).narrow
}
// CompoundType
override def narrow: Type = typeSymbol.thisType
This commit creates a fresh existential type symbol rather than
trying to use `narrow`.
I've included a unit test to show the sublteties of narrowing
refinment types.
|
|\ \ \ \ \ \
| |/ / / / /
|/| | | | | |
SI-5905 Clarify test case
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
The language feature options are discovered reflectively, but it
is nice to enforce that expected options are supplied.
Short of that, the code string includes a rowdy postfix operator.
It still does enforce that at least one option was discovered.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Just adding the java 8 output.
No attempt to finesse anything.
But the partest mechanism does still need auto-update of these
conditional check files, plus expression evaluation of the condition.
|
| | | | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Allows the test to pass on both backends
|
| |_|/ / /
|/| | | |
| | | | |
| | | | | |
This makes it pass under -Ybackend:GenBCode
|
|\ \ \ \ \
| |_|/ / /
|/| | | | |
SI-8637 fixes toolbox phase corruption
|
| | |_|/
| |/| |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
It turns out, Toolbox.typecheck hasn't been properly re-initializing its state
between requests.
In particular, globalPhase was left untouched, which made the compiler
think that it's past typer, and that in turn disabled implicits.
This commit applies a symptomatic fix to this problem.
|
|\ \ \ \
| | | | |
| | | | | |
SI-8607 Fix erasure for value class inheriting from private class
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
In the previous commit, we avoided an awkward chain of casts
by exploiting the knowledge that Scala defined classes will
by JVM accessible, and as such immune to `LinkageError`s when
used as the target of a cast.
This commit generalized this to the entire fix for SI-4283,
rather than just for derived value classes.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The fix for SI-4283 added a pre-emptive cast of the qualifier of
a selection `qual.a` to avoid later casting to the owner of `a`
if that owner might be inaccessible at the call site. This fixed
a `LinkageError`.
In the enclosed test, this cast led to the following diff in the
tree shapes (with respect to a version with a public base class).
[erasure]
- new p1.C.<init>(c.$asInstanceOf[scala.this.Int]()).a();
+ new p1.C.<init>(new p1.C.<init>(c.$asInstanceOf[scala.this.Int]()).$asInstanceOf[ErasedValueType( class C, scala.this.Int)]().$asInstanceOf[scala.this.Int]()).a();
[posterasure]
- new p1.C.<init>(c).a();
+ new p1.C.<init>(new p1.C.<init>(c).$asInstanceOf[scala.this.Int]().$asInstanceOf[scala.this.Int]()) .a();
()
What we really wanted to end up with is:
new p1.C.<init>(c).$asInstanceOf[C]().a();
The stray cast leads to the crash:
error: should have been unboxed by erasure: new p1.C.<init>(c).$asInstanceOf[scala.this.Int]()
Rather than trying to fix this in erasure/posterasure, this commit
instead relies on the fact the owner of `a` cannot be Java defined
if `qual`s type is a derived value class. This follows from the
restrictions we place on value classes.
With this knowledge, we elide the cast altogether in this case.
|