| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Due to the fact that blocks in cases are implicit one might expect to be
able to extract its contents with `..$`.
|
| |
|
|\
| |
| | |
Revert "SI-7624 Fix -feature warnings in scala/tools/scalap"
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit f2de2c4ec43180351ef1f306bcc5f24643ba5477 because it
broke both lift-json and json4s libraries that depend on scalap's APIs.
Arguably, those libraries shouldn't depend on unofficial APIs but they do
because they had no better alternative at the time (no Scala reflection).
The cost of breaking them is not worth minor change of the package.
The f2de2c4ec43180351ef1f306bcc5f24643ba5477 mixed two things:
1. Fixing feature warnings
2. Changing package name
When reverting (and resolving conflicts) I tried to keep 1. and revert just
2. However, there were also some questionable changes related to 1. that
got reverted. In particular, a package object with implicit members that
enable language features is an anti-pattern because members of package
object are visible both _within_ and _outside_ of the package. Therefore,
user could use wildcard import for importing everything from scalap
package and enabled postfixOps language feature unknowingly. I went for
just adding imports in just those few files where they were needed.
Amended by Adriaan:
To allow faster turn around, I re-enabled resolving partest from sonatype,
as its version needs to be bumped and I don't want to wait for maven central synch.
Conflicts:
src/partest/scala/tools/partest/nest/Runner.scala
src/scalap/scala/tools/scalap/scalax/rules/Memoisable.scala
src/scalap/scala/tools/scalap/scalax/rules/Rule.scala
src/scalap/scala/tools/scalap/scalax/rules/Rules.scala
src/scalap/scala/tools/scalap/scalax/rules/scalasig/ClassFileParser.scala
src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSig.scala
|
|\ \
| |/
|/| |
Revert "SI-8315 Better debugging facility for ICode"
|
| |
| |
| |
| |
| |
| | |
This reverts commit 0561dd084b5f3c2678eb032a40b85cb25bb6d589,
because appending the phase name to the icode filename breaks
the windows build. Only doing it under -Ydebug.
|
|\ \
| |/
|/| |
SI-4728 test case
|
|/ |
|
|\
| |
| | |
SI-8197 clarify overloading resolution with default args
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit was co-authored with Lukas. His analysis is below.
If there are multiple applicable alternatives, drop those
that use default arguments. This is done indirectly by
checking applicability based on arity.
TODO: this `namesMatch` business is not spec'ed, and is
the wrong fix for SI-4592. We should instead clarify what
the spec means by "typing each argument with an undefined expected type".
What does typing a named argument entail when we don't know what
the valid parameter names are? (Since we're doing overload resolution,
there are multiple alternatives that can define different names.)
Luckily, the next step checks applicability to the individual alternatives,
so it knows whether an assignment is:
- a valid named argument
- a well-typed assignment (which doesn't necessarily have type `Unit`!)
- an error (e.g., rhs does not refer to a variable)
I propose the following solution (as a TODO):
check whether a named argument (when typing it in `doTypedApply`)
could be interpreted as an assign; `infer.checkNames` should use
the type of the well-typed assignment instead of `Unit`.
Lukas's analysis:
990fa04 misunderstood the spec of overloading resolution with
defaults. it should not discard applicable alternatives that define
defaults, but only those that use defaults in the given invocation.
bugs were shadowed because the refactoring used `alt.hasDefault` to
check whether the alternative has some parameters with defaults, but
this never worked.
d5bb19f fixed that part by checking the flags of parameters, which
fixed some but but un-shadowed others:
```
object t { def f(x: String = "") = 1; def f(x: Object) = 2 }
scala> t.f("") // should return 1, but returns 2 after d5bb19f
```
The commit message of d5bb19f also mentions that its test "should
fail to compile according to SI-4728", which is another
misunderstanding.
```
class A; class B extends A
object t { def f(x: A = null) = 1; def f(x: B*) = 2 }
t.f()
```
This should return `2`: both alternatives are applicable, so the one
that uses a default is eliminated, and we're left with the vararg one.
SI-4728 is different in that it uses explicit parameters,
`t.f(new B)` is ambiguous.
|
|\ \
| | |
| | | |
SI-3235 math.round() returns wrong results for Int and Long
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Minimal fix for SI-3235.
This minimal fix includes deprecation messages to aid detection of probable errors.
Test verifies behavior: the correct values are returned, and deprecation messages are emitted.
|
|\ \ \
| | | |
| | | | |
SI-8240 Consider rolling back optimizations for List
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Some compiler-specific optimizations turn out to be very helpful for Lists in general.
* List map can be a lot faster (up to 5x!)
* List collect can be considerably faster (up to 3x)
* List flatMap can be a bit faster (2x)
* List take can be slightly faster (1.1x) and have better structural sharing
These appear to be unqualified wins (tested), even in a scenario with mixed collections. This is expected: detecting the builder is faster than the otherwise mandatory object creation, and multiple dispatch is mostly a wash since it was already multiple dispatch in getting to the builder.
With -optimize, map is not always such a big win, but is never slower.
Also added @noinline to map to work around an optimizer bug (SI-8334) and added a test to check that the pattern that triggers the optimizer bug does not affect any of the map-like methods.
|
|\ \ \
| | | |
| | | | |
Add ScalaDoc to Quasiquotes and Liftables parts of api
|
| | | | |
|
| | | | |
|
|\ \ \ \
| |_|/ /
|/| | | |
SI-8251 deprecate `ListBuffer::readOnly`
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is the first step towards fixing the unexpected behavior of `ListBuffer`.
Many of `ListBuffer`'s operations are forwarded to the underlying `List`,
essentially leaking that abstraction to clients that call e.g., `toIterable`.
When the buffer changes, the `Iterable` obtained through `toIterable` will
reflect that change.
To avoid this exposure, call `toList` to obtain an immutable copy.
See also:
https://groups.google.com/d/msg/scala-internals/g_-gIWgB8Os/kWazrALbLKEJ
https://gist.github.com/paulp/9081797
|
|\ \ \
| |/ /
|/| | |
SI-6455 no longer rewrite .withFilter to .filter
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
This has been deprecated for two major releases now,
but `filter`'s still preferred over `withFilter` in the wild.
|
|\ \ \
| |_|/
|/| | |
SI-8330: Mismatch in stack heights
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The SI-8233 / 9506d52 missed one case when we need to DROP a null from
a stack: when unboxed Unit is an expected type. If we forgot to do that
in a context where two branches were involved we could end up with
unbalanced stack sizes.
Let's fix that omission and a test covering that specific case to the
original test for SI-8233.
Fixes SI-8330.
|
|\ \
| | |
| | | |
SI-8324 fix permutation in test filename
|
| | | |
|
|\ \ \
| | | |
| | | | |
SI-1503 don't assume unsound type for ident/literal patterns
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The fix only kicks in under -Xfuture. We also warn under -Xlint.
What type should a variable bound to the value matched by a pattern have?
To avoid CCEs, it should be a type that's implied by the matching
semantics of the pattern.
Usually, the type implied by a pattern matching a certain value
is the pattern's type, because pattern matching implies instance-of checks.
However, Stable Identifier and Literal patterns are matched using `==`,
which does not imply a type for the binder that binds the matched value.
The change in type checking due to this fix is that programs that used to crash with a CCE
(because we blindly cast to the type of the pattern, which a `==` check does not imply)
now get a weaker type instead (and no cast). They may still type check, or they may not.
To compensate for this fix, change `case x@Foo => x` to `case x: Foo.type => x`,
if it's important that `x` have type `Foo.type`.
See also:
- SI-4577: matching of singleton type patterns uses `eq`,
not `==` (so that the types are not a lie).
- SI-5024: patmat strips unused bindings, but affects semantics
|
|\ \ \ \
| | | | |
| | | | | |
SI-8321 bundles can't be whitebox
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Now when SI-7507 is fixed in starr, we can actually remove a workaround
and make a 10 line reduction in the size of Resolvers.scala.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Given the recent glaring oversight in macro bundles, I have to have more
tests in order to make sure that things are going to work as they should.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
At the moment, bundle selection mechanism is pretty picky. If a candidate
bundle's parameter isn't either blackbox.Context, whitebox.Context or
PrefixType refinement thereof, then it's not a bundle and the user
will get a generic error.
However we can be a bit more helpful and admit classes that are almost
like bundles (looksLikeMacroBundleType), have them fail isMacroBundleType,
and then emit a much prettier error message to the user that would tell them
that bundles must be monomorphic and their sole parameter should not just
be any subtype of blackbox.Context or whitebox.Context.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
It's not like they were inducing bugs, but I can't see how polymorphism
can be useful for macro bundles, hence imho it's better to reduce the
number of degrees of freedom of the system.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Vanilla macros only allow blackbox.Context, whitebox.Context and
PrefixType refinements thereof. Bundles should behave in the same way.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
whitebox.Context <: blackbox.Context, so in order to check for blackboxity
it's not enough to check whether the context used is <: blackbox.Context.
|
| | | | | |
|
|\ \ \ \ \
| |_|_|/ /
|/| | | | |
SI-7962 Scalac runner does not work within Emacs's terminal
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | | |
- Always set the env.emacs system property - scalac only cares
about whether the system property has a non-empty value, not
whether it is set or not. Fixes 7962
|
|\ \ \ \
| | | | |
| | | | | |
Fix ./build/<stage>/bin/scaladoc
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Was:
./build/quick/bin/scaladoc -version
Exception in thread "main" java.lang.NoClassDefFoundError: scala/tools/nsc/ScalaDoc
Caused by: java.lang.ClassNotFoundException: scala.tools.nsc.ScalaDoc
Now:
% for tool in ./build/quick/bin/{fsc,scala,scalac,scaladoc,scalap}; do $tool -version; done
Fast Scala compiler version 2.11.0-20140222-144307-b0dcf79875 -- Copyright 2002-2013, LAMP/EPFL
Scala code runner version 2.11.0-20140222-144307-b0dcf79875 -- Copyright 2002-2013, LAMP/EPFL
Scala compiler version 2.11.0-20140222-144307-b0dcf79875 -- Copyright 2002-2013, LAMP/EPFL
Scaladoc version 2.11.0-20140222-144307-b0dcf79875 -- Copyright 2002-2013, LAMP/EPFL
Scala classfile decoder version 2.0.1 -- (c) 2002-2013 LAMP/EPFL
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-8324 Fix regression in override checks for sealed classes
|
| | |/ / /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
adeffda25 changed `Symbol#isEffectivelyFinal` to help the optimizer
by inferring finality within sealed class hierarchies.
However, this change wasn't neccesarily welcome for other clients of
that method. In the enclosed test case, we see that overriding checks
in `RefChecks` regressed.
This commit moves the enhanced version into a new method and
selectively uses it in the optimizer (and the tail call optimizer).
|
|\ \ \ \ \
| |_|/ / /
|/| | | | |
SI-8197 Only consider immediate params for defaults, overloading
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
A recent commit fixed the behaviour of overloading with regards
to discarding candiates that include default arguments. The old
check was checking the wrong flag.
But, the new code is actually checking all parameter lists for
defaults, which led to a regression in scala-io, which is distilled
in the enclosed test case. Applications are typechecked one
parameter list at a time, so a holistic check for defaults doesn't
seem to make sense; only defaults in the first parameter list
ought to count.
|
|\ \ \ \
| | | | |
| | | | | |
SI-5479 deprecate DelayedInit outside of App
|
| | | | | |
|
| | |_|/
| |/| |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
DelayedInit's semantics are way too surprising.
For example, it delays initialization of fields,
so that fields on objects that extend `App`
(which `extends DelayedInit`) are not initialized
until the `main` method is called.
For more details and a proposed alternative,
see https://issues.scala-lang.org/browse/SI-4330?jql=labels%20%3D%20delayedinit%20AND%20resolution%20%3D%20unresolved.
Support for `App` will continue -- we'll special case it.
|
|\ \ \ \
| |_|/ /
|/| | | |
SI-8315 Fix crash in dead code elimination
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
It was a cache invalidation bug.
We need to mark the Code as touched to invalidate the caches
behind `predecessors` and `successors`.
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Suffix the phase name to avoid clobbering files.
% qbin/scalac -Xprint-icode -Xprint:inline -Yinline -Ydead-code sandbox/test.scala 1>/dev/null 2>/dev/null
% ls *.icode
A$$anonfun$crash$1_icode.icode Listt_icode.icode
A$$anonfun$crash$1_inliner.icode Listt_inliner.icode
A_icode.icode Nill$_icode.icode
A_inliner.icode Nill$_inliner.icode
|