| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|\
| |
| | |
Fix a typo in the `scala` man page
|
| | |
|
|\ \
| | |
| | | |
SI-7280 Scope completion not returning members provided by imports
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Updates localeContext() to return the best context possible when there are none directly
associated with the given position. It happens when an expression cannot be
successfully typed, as no precise ContextTree covers the expression location, or if the
position is not inside any expression.
Adds corresponding tests
|
| | |
| | |
| | |
| | |
| | | |
Adds a new marker /*_*/ to trigger scope completion test.
Original type completion test oracles update for the tweaked output
|
|\ \ \
| | | |
| | | | |
SI-7915 Corrected range positions created during default args expansion
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The tree created during expansion of default arguments contained trees with the
wrong type of positions. Let's discuss this with an example. Below is the tree
generated for the `foo` method in the test class included in this commit.
Before this commit:
```
[54:94]def foo(): [58]Unit = <70:90>{
[70:79]<artifact> val qual$1: [70]Bar = [70:79][70:79][70:79]new [74:77]Bar();
[80]<artifact> val x$1: [80]Int = [80]qual$1.bar$default$1;
<70:90><70:83>qual$1.bar([80]x$1)
}
```
Now:
```
[54:99]def foo(): [58]Unit = <70:95>{
<70:84><artifact> val qual$1: [70]Bar = [70:84][70:84][70:84]new [74:77]Bar();
[85]<artifact> val x$1: [85]Int = [85]qual$1.bar$default$1;
<70:95>[84:88]qual$1.bar([85]x$1)
}
```
Here are the list of changes:
* The synthetic `qual$1` has a transparent position, instead of a range position.
* The new Select tree (i.e., `qual$1.bar`) should always have a range position,
because `selected` (i.e., the called method) is always visible in the source
(in fact, this is the whole point of the fix, we need a range position or
hyperlinking request from the Scala IDE won't work).
* The Block that contains the expanded default arguments is forced to have a
transparent position, as it never exist in the original source.
The tricky part of the fix is the position assigned to the new Select tree,
which needs to respect the range position's invariants. In the specific case,
we ought to make sure that range positions don't overlap. Therefore, the position
assigned to the new Select tree is computed by intersecting the original Select
position (i.e., `baseFun`'s position) and the original qualifier's position
(i.e., `qual`'s position).
If you take a closer look at the range positions assigned in the tree after this
commit, you'll notice that the range position of the `qual$1`'s rhs (i.e.,
[70:84]), and `qual$1.bar` (i.e., [84:88]) might seem to overlap, because the
former ends where the latter begins. However, this not the case because of the
range position's invariant 2, which states:
> Invariant 2: in a range position, start <= point < end
Hence, the above two positions aren't overlapping as far as the compiler is
concerned.
One additional aspect (that may look like a detail) is that we make sure to
never generate a position such that its start is after its end. This is why we
take the position with the smallest end point.
Furthermore, calling `withStart` would turn any position in a range position,
which isn't desiderable in general (and, even worse, this can lead to
generation of invalid positions - bad offsets - if the computation is performed
on offset positions). Hence, the position's computation is only performed when
both `baseFun` and `qual` positions are range positions. Indeed, I expect this to
be always the case if the compiler is started with -Yrangepos.
|
|\ \ \ \
| | | | |
| | | | | |
New mutable hash map with Long keys: partially solves SI-5263 and is relevant to SI-6825.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
An open addressing hash map based on a similar scheme to mutable.LongMap.
It delivers performance equivalent to Java's HashMap for pretty much all
AnyRefs, plus it works nicely with Scala's collections.
Revisions made sure that all return types in the public API are specified.
Also switched to a leading-zeros method of calculating the initial mask (to
save a few ns). Also edited out java.util comparison numbers and moved
constants to companion.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
to SI-6825.
The hash map is based on an open addressing scheme that provides
dramatically faster (mostly due to specialization) get and contains
operations than either the standard Java HashMap or any of the existing
Scala hash maps. It doesn't work well above 500,000,000 elements as
the arrays cannot scale past 2^30 elements. Maps are not faster in
general due to the lack of specialization of Function1[Long, V].
Revisions made sure that all return types in the public API are specified.
Also switched to a leading-zeros method of calculating the initial mask (to
save a few ns), and used an occasionally-more-efficient version of
seekEntryOrOpen. Also edited out specific performance numbers and moved
constants to companion.
|
|\ \ \ \ \
| |_|_|_|/
|/| | | | |
fix IntMap#foreachValue and LongMap#foreachValue scaladoc
|
| | |_|/
| |/| | |
|
|\ \ \ \
| | | | |
| | | | | |
fix typo
|
| | | | | |
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
SI-7961 Fix false positive procedure warnings
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Two issues are fixed in this commit:
- `def foo: Unit` was detected as missing a return type
- The warning was emitted for constructors, but
`def this(...): Unit = ...` is not valid Scala syntax
|
| |/ / /
|/| | | |
|
|\ \ \ \
| | | | |
| | | | | |
Revert "temporarily disables run/reflection-sync-subtypes"
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This reverts commit 04e2dbb29830d0e511cdfa8c132a9fad91d657ed,
by avoiding the ill-fated attempt to short-circuit the global
reflection lock.
I think we can do better performance wise, but lets at least
get something correct to start with.
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
Updated Eclipse .classpath for partest and scaladoc projects
|
| | | | | |
|
|\ \ \ \ \
| |_|_|_|/
|/| | | | |
Merge 2.10
|
| |\ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Conflicts:
src/interactive/scala/tools/nsc/interactive/Global.scala
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
`List(1, 2, 3).map(f).<ctrl-space>` now works; before
the tree had the type `(bf: CanBuildFrom[...]):...` and
did not contribute completions from the result type.
This commit checks if the tree has an implicit method
type, and typechecks it as a qualifier. That is enough
to get to `adaptToImplicitMethod` in the type checker,
infer the implicit arguments, and compute the final result
type accordingly.
|
| | | | | | | |
| | \ \ \ \ | |
| |\ \| | | | |
|
| | |/ / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
At issue is that the optimizer would eliminate closure classes
completely, then neglect to eliminate those classes from the
container's InnerClasses attribute. This breaks tooling which
expects those entries to correspond to real classes.
The code change is essentially mgarcia's - I minimized it and
put the caches in perRunCaches, and added the test case which
verifies that after being compiled under -optimise, there are
no inner classes. Before/after:
7,8d6
< InnerClasses:
< public final #22; //class A_1$$anonfun$f$1
37,45c35,40
< #21 = Utf8 A_1$$anonfun$f$1
< #22 = Class #21 // A_1$$anonfun$f$1
< #23 = Utf8 Code
---
> #21 = Utf8 Code
|
| | |\ \ \ \
| | | | | | |
| | | | | | | |
[nomaster] SI-7519 Less brutal attribute resetting in adapt fallback
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Prefers `resetLocalAttrs` over `resetAllAttrs`. The latter loses
track of which enclosing class of the given name is referenced by
a `This` node which prefixes the an applied implicit view.
The code that `resetAllAttrs` originally landed in: https://github.com/scala/scala/commit/d4c63b#L6R804
Cherry picked from 433880e91cba9e1e926e9fcbf04ecd4aeb1d73eb
Conflicts:
src/compiler/scala/tools/nsc/typechecker/Typers.scala
|
| | |\ \ \ \ \
| | | | | | | |
| | | | | | | | |
[nomaster] SI-6026 backport getResource bug fix
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Submitted to master under SI-4936, this fix allows :javap
to work when tools.jar is discovered by REPL.
|
| | |\ \ \ \ \ \
| | | |_|/ / / /
| | |/| | | | | |
SI-6026 REPL checks for javap before tools.jar
|
| | | |/ / / /
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
If javap is already available, don't go hunting for tools.jar
This avoids the getResource bug in AbstractFileClassLoader.
|
| |\| | | | |
| | |_|_|/ /
| |/| | | | |
|
| | |/ / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
In command scripts, substitution of `FOO` in `if cond ( %FOO% )` happens
*before* the condition is evaluated. One can use delayed expansion with
`if cond (!FOO!)` to get a saner behaviour. Or, as I ended up doing here,
use a goto in the body of the if rather than referring directly to variables
there.
Here's a cut down version to demonstrate the old problem:
C:\Users\IEUser>type test.cmd
@echo off
setlocal enableextensions enabledelayedexpansion
if [%~1]==[-toolcp] (
set CP=%~2
shift
shift
)
echo -toolcp %CP%
echo %~1 %~2
C:\Users\IEUser>test.cmd a b
-toolcp
a b
C:\Users\IEUser>test.cmd -toolcp "c:\program files" a b
-toolcp c:\program files
a b
C:\Users\IEUser>test.cmd -toolcp "c:\program files" "a()b" "c()d"
-toolcp c:\program files
a()b c()d
C:\Users\IEUser>test.cmd "a()b" "c()d"
d was unexpected at this time.
I don't understand exactly why the parentheses only mess things
up in this situation. But regardless, lets find another way.
My first attempt to fix this was based on the suggestion in the ticket.
But, as shown below, this fails to capture the -toolcp.
C:\Users\IEUser>type test.cmd
@echo off
setlocal enableextensions enabledelayedexpansion
if [%~1]==[-toolcp] (
set CP=!2!
shift
shift
)
echo -toolcp %CP%
echo %~1 %~2
C:\Users\IEUser>test.cmd "a()b" "c()d"
-toolcp
a()b c()d
C:\Users\IEUser>test.cmd -toolcp "c:\program files" "a()b" "c()d"
-toolcp
a()b c()d
Last stop was the goto you'll find in this patch.
With this patch applied, I tested on Windows 8 with the following:
C:\Users\IEUser>type Desktop\temp.cmd
::#!
@echo off
call scala %0 %*
goto :eof
::!#
println("hello, world")
println(argv.toList)
C:\Users\IEUser>scala Desktop\temp.cmd "foo(bar)baz"
"java" -Xmx256M -Xms32M -Dscala.home="C:\PROGRA~3\scala\bin\.."
-Denv.emacs="" -Dscala.usejavacp=true -cp "..."
scala.tools.nsc.MainGenericRunner Desktop\temp.cmd "foo(bar)baz"
hello, world
List(foo(bar)baz)
C:\Users\IEUser>scala -toolcp "c:\program files" Desktop\temp.cmd "foo(bar)baz"
"java" -Xmx256M -Xms32M -Dscala.home="C:\PROGRA~3\scala\bin\.."
-Denv.emacs="" -Dscala.usejavacp=true -cp "...;c:\program files"
scala.tools.nsc.MainGenericRunner -toolcp "c:\program files" Desktop\temp.cmd "foo(bar)baz"
hello, world
List(foo(bar)baz)
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
RajivKurian/OpenHashMap-nextPowerOfTwo-implementation
Use an intrinsic for the next power of two calculation.
|
| | |_|_|/
| |/| | |
| | | | |
| | | | | |
input as is if it is already a power of two
|
|\ \ \ \ \
| |_|/ / /
|/| | | | |
[rebase] blackbox and whitebox macros
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
When an application of a blackbox macro is used as an extractor in a
pattern match, it triggers an unconditional compiler error,
preventing customizations of pattern matching implemented with macros.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
When an application of a blackbox macro is used as an implicit candidate,
no expansion is performed until the macro is selected as the result of
the implicit search.
This makes it impossible to dynamically calculate availability of
implicit macros.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
When an application of a blackbox macro still has undetermined type
parameters after Scala’s type inference algorithm has finished working,
these type parameters are inferred forcedly, in exactly the same manner
as type inference happens for normal methods.
This makes it impossible for blackbox macros to influence type inference,
prohibiting fundep materialization.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
When an application of a blackbox macro expands into a tree `x`,
the expansion is wrapped into a type ascription `(x: T)`, where `T` is
the declared return type of the blackbox macro with type arguments and
path dependencies applied in consistency with the particular macro
application being expanded.
This invalidates blackbox macros as an implementation vehicle
of type providers.
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This is the first commit in the series. This commit only:
1) Splits Context into BlackboxContext and WhiteboxContext
2) Splits Macro into BlackboxMacro and WhiteboxMacro
3) Introduces the isBundle property in the macro impl binding
Here we just teach the compiler that macros can now be blackbox and whitebox,
without actually imposing any restrictions on blackbox macros. These
restrictions will come in subsequent commits.
For description and documentation of the blackbox/whitebox separation
see the official macro guide at the scaladoc website:
http://docs.scala-lang.org/overviews/macros/blackbox-whitebox.html
Some infrastructure work to make evolving macros easier:
compile partest-extras with quick so they can use latest library/reflect/...
|
|\ \ \ \
| | | | |
| | | | | |
Add support for For loops to quasiquotes
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
1. q"for (..$enums) $body", q"for (..$enums) yield $body"
2. fq"..." quote to construct/deconstruct enumerators
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This effectively reconstructs a sequence of enumerators and body
from the tree produced by mkFor. This lets to define bi-directional
SyntacticFor and SyntacticForYield constructors/extractors to work
with for loops.
Correctness of the transformation is tested by a scalacheck test
that generates a sequence of random enumerators, sugars them into
maps/flatMaps/foreach/withFilter calls and reconstructs them back.
|
| | | | | |
|