| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
SI-6736 Range.contains is wrong
|
| |
| |
| |
| |
| |
| | |
Operations are reasonable when they don't require indexing or conversion into a collection. These include head, tail, init, last, drop, take, dropWhile, takeWhile, dropRight, takeRight, span.
Tests added also to verify the new behavior.
|
| |
| |
| |
| | |
Removed once-used private method that was calculating ranges in error and corrected the contains method (plus improved performance).
|
|\ \
| | |
| | | |
SI-6411 SI-7328 value class fixes for runtime reflection
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The `transformedType` method, which is used to bring Scala types to Java
world, was written in pre-valueclass times. Therefore, this method only
called transforms from erasure, uncurry and refChecks.
Now runtime reflection becomes aware of posterasure and as a consequence
methods, which have value classes in their signatures, can be called
without having to wrap them in catch-a-crash clause.
Another facet to this fix was the realization that value classes need
to be unwrapped, e.g. C(2) needs to be transformed to just 2, when they
are used naked in method signatures (i.e. `c` in `def foo(c: C)` needs
to be unwrapped, whereas `cs: List[C]`, `cs: C*` and even `cs: Array[C]`
do not).
|
| |/
|/|
| |
| |
| |
| | |
Changed logic to prevent mutation between hasNext and next from delivering invalid results.
Also fixed superscripts in scaladoc.
|
| |
| |
| |
| |
| |
| | |
Altered getOrElseUpdate to be robust to the map changing out from under it as a result of calling the default value method. Side-effects FTW!
Made a comparable change in LongMap also, as it was also affected. And added a test to SetMapConsistencyTest.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
More penance. Extend the unit test and don't include CR
in the line text.
This is obvious, which shows how dangerous it is to refactor
without unit tests.
My very favorite bugs are off-by-one and EOL handling, followed
closely by off-by-Int.MaxValue.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixing a regression from SI-8015.
The failure mode is kind of amusing: a while loop in `lineToString`
would count all the way to `Int.MaxValue`, and integer overflow
would foil a bounds check when looking for the 'LF' in 'CR'-'LF'.
Given that we're not a style checker to enforce that source files
end in a new-line, this commit accounts for EOF, and fixed the
overflow problem too.
A JUnit test exercises the bug and a few other variations of
`lineContent`.
While i was in the neighbourhood, I opted for a more efficient
means to slice out that line.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Int.MaxValue
Fixed by rewriting the entire logic for the count method. This is necessary because the old code was making all kinds of assumptions about what numbers were, but the interface is completely generic.
Those assumptions still made have been explicitly specified. Note that you have to make some or you end up doing a binary search, which is not exactly fast.
The existing routine is 10-20% slower than the old (broken) one in the worst cases. This seems close enough to me to not bother special-casing Long and BigInt, though I note that this could be done for improved performance.
Note that ranges that end up in Int ranges defer to Range for count. We can't assume that one is the smallest increment, so both endpoints and the step need to be Int.
A new JUnit test has been added to verify that the test works. It secretly contains an alternate BigInt implementation, but that is a lot slower (>5x) than Long.
|
|\
| |
| | |
Quasi-comprehensive BigDecimal soundness/correctness fix.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This fixes issues SI-6153, SI-6173, SI-6456, SI-6699, and SI-8116, along with a number of other similar possible issues.
Relevant changes include
* Changes to avoid heap explosion when working with BigInt
- to isWhole
- to hashCode
- to equals
- to BigInt's equals
* Changes to enable equality matching hashCode
- Only for sufficiently small BigInt
- For identical values with different precision
* Changes to isValidDouble
- Takes precision into account now
- New methods added to test whether even if the Double is not represented exactly, it's a representation of a certain type
- New companion methods added to allow intended expansion of Double (binary/decimal difference)
* Changes to constructor
- Null arguments are not allowed (these can throw NPEs later at awkward/unexpected times)
* New JUnit test to test all these things
* Fixed existing tests to expect new behavior
* Modified scaladocs to explain the issues
* Deprecated problematic methods
* Made application of MathContext more consistent (it is where you expect it and not where you don't)
These changes are coordinated, for the most part, hence the monolithic
commit.
|
|\ \
| |/
|/| |
Add tree-based code generation
|
| | |
|
| |
| |
| |
| |
| | |
1. Problem with multiple parameter lists in annotations is resolved
2. Tests for Annotated trees are added
|
| | |
|
| | |
|
|\ \
| | |
| | | |
Fix (postfix abs for -0.0)
|
| |/
| |
| |
| |
| |
| | |
SI-8102 points out that -0.0.abs returns -0.0 (in error). The same issue
exists for -0.0f. This commit fixes the issue for both by delegating to
math.abs.
|
|\ \
| | |
| | | |
Improved testing framework for sets and maps.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Switched to JUnit testing framework for sets and maps. They now test
broadly against each other for consistency. Tests for mutable.AnyRefMap
and mutable.LongMap are folded in here (originals removed). There is still
lots of redundancy with other tests that has not been removed.
This framework is also designed to enable more robust testing of changes to
implementations of sets and maps; although it's still quite possible to get
a broken implementation through, these tests should make it harder to get
the fundamentals wrong.
|
| |/
|/|
| |
| |
| |
| |
| |
| | |
because the code uses '==' instead of 'equiv'
== instead of equiv (from Ordering) was used by mistake. Fixed.
Also created a test to make sure that == is not used by throwing an exception if it is (as suggested by Jason).
|
|/
|
|
|
|
| |
As discovered in https://groups.google.com/forum/#!topic/scala-user/RckXE90LoXo,
RootClass.sourceModule and EmptyPackageClass.sourceModule used to incorrectly
return NoSymbol instead of RootModule and EmptyPackage. This is now fixed.
|
|\
| |
| | |
SI-8027 REPL double tab regression
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Where did double tab go? "The shadow knows."
The regression was introduced by the last flurry
before we were left to wallow in whatever white
space remained.
Some xs put other xs under erasure.
It's clear that somebody's daughter walked into
the room and asked for a story, because, shockingly,
the case arrows don't line up.
We need a plug-in for Jenkins, or I guess Travis, to
fail the build if arrows and equals don't align,
because it clearly indicates a lapse of some kind.
|
| |
| |
| |
| |
| |
| | |
This allows immutable.Queue to be used conveniently in functional code.
Method is in the spirit of `headOption` on seqs or `get` on maps. Also
adds a unit test for immutable.Queue.
|
|/
|
|
|
| |
Now uses the cached copy instead of the exhausted iterator. Adds a JUnit
test for ++.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The change in ce1bbfe / SI-6406 introduced overloads of
`unapplySeq` with wider static and dynmaic result types
than the now-deprecated alternative that accepted `Any`.
This is subtly source incompatible and the change was noticed
in Specs2.
This commit uses `List` as the static and runtime type for
the new overloads.
For consistency, the same is done for the new method added
in SI-7737 / 93e9623.
|
|\
| |
| | |
SI-7969 REPL -C columnar output
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Extend column formatting to make columns only as wide as
their widest element. This is similar to what `ls` does.
Given the longest and shortest string, which bound the
min and max column count, compute the layout for those
possible column counts, and choose the minimal row count
and minimal column count.
The junit test is under pending because it uses expecty.
(Edit: updated without expectytations.)
Example that really benefits, witness the skinny columns:
```
scala> math.
BigDecimal PartiallyOrdered cosh rint
BigInt Pi exp round
E ScalaNumber expm1 signum
Equiv ScalaNumericAnyConversions floor sin
Fractional ScalaNumericConversions hypot sinh
IEEEremainder abs log sqrt
Integral acos log10 tan
LowPriorityEquiv asin log1p tanh
LowPriorityOrderingImplicits atan max toDegrees
Numeric atan2 min toRadians
Ordered cbrt package ulp
Ordering ceil pow
PartialOrdering cos random
```
more
|
| |
| |
| |
| | |
Make REPL classes testable in junit. Test the Tabulator.
|
|/
|
|
|
|
|
|
|
|
|
| |
1. refactor out FreshNameExtractor out of Quasiquotes cake into
SymbolTable (can’t put it outside due to the fact that names are
path-dependent)
2. add optional parameter to the fresh name creator to cover additional
qq$ prefix needed for quasiquotes
3. add unit tests
|
| |
|
|\
| |
| | |
SI-7883 - don't iterate over all keys in MapWrapper.containsKey()
|
| | |
|
| | |
|
|/
|
|
|
|
|
|
|
| |
- change newTermName to fix negative length names
rather than reject them
- restore the old logic in unspecializedName for names that
result from AnyRef specialized type parameters.
Why does fix the windows build? I remain none the wiser.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Names like `T1$sp`, which can arise from `AnyRef` specialization,
were leading to negative length Names if they ever passed through
`unspecializedName` or `splitSpecializedName`. This code path was
touched when printing the tree of a certain AnyRef specialized
classes after specialization, such as `AbstractPartialFunction`
(which had such specialization until a few commits ago.)
This commit handles that case correctly, and generally hardens
against unexpected names, which could pop up from third party
classes.
The documentation for `splitSpecializedName` transposed the
class and method specializations. The things you discover
when you turn examples in documentation in to test cases!
In addition, we now require non-negative length and offset in
`newTermName`
|
|\
| |
| |
| |
| | |
Conflicts:
src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Not every application will force these in a single thread; we
have to do our best to avoid cycles between them.
The enclosed test was failing every time before the change.
This commit breaks the cycle by avoiding computing `tupleNames`
in the constructor of `ScalaRuntime`. The new version has the
added benefit of including specialized tuple subclasses, which
is verified with a unit test for `isTuple`.
Are there more of these lurking? It seems likely. I'm more than
a little concerned about the way the `ControlThrowable` fires up
`scala.SystemProperties` to check whether or not to suppress
stack traces; there is already an ugly hack in place:
object NoStackTrace {
final def noSuppression = _noSuppression
// two-stage init to make checkinit happy,
// since sys.SystemProperties.noTraceSupression.value
// calls back into NoStackTrace.noSuppression
final private var _noSuppression = false
_noSuppression = sys.SystemProperties.noTraceSupression.value
}
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The handy stack trace truncation in REPL doesn't
show cause like a regular trace.
This commit fixes that and also adds the usual
indicator for truncation, viz, "... 33 more".
The example from the ticket produces:
```
scala> rewrapperer
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: Point of failure
at .rewrapper(<console>:9)
at .rewrapperer(<console>:10)
... 32 elided
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Point of failure
at .wrapper(<console>:8)
... 34 more
Caused by: java.lang.RuntimeException: Point of failure
at .sample(<console>:7)
... 35 more
```
Suppressed exceptions on Java 7 are handled reflectively.
```
java.lang.RuntimeException: My problem
at scala.tools.nsc.util.StackTraceTest.repressed(StackTraceTest.scala:56)
... 27 elided
Suppressed: java.lang.RuntimeException: Point of failure
at scala.tools.nsc.util.StackTraceTest.sample(StackTraceTest.scala:29)
at scala.tools.nsc.util.StackTraceTest.repressed(StackTraceTest.scala:54)
... 27 more
```
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Augment the IOException with the name of the file we're trying
to open.
Motivated by a troubleshooting session with partial downloads
of JARs from Maven central breaking the Scala build on Martin's
laptop.
The test case only tests our part of the error message, so as not
to be platform / JDK specific. Otherwise, it would check that the
correct cause exception was present and accounted for.
|
|\ \
| | |
| | | |
updated SI-7331, SI-6843, SI-7731, parser entry point refactoring, assertThrows utility function
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
1. don't recreate symbol table manually and just let JUnit do it
automatically behind the scenes
2. minor changes to assertThrow's description
3. add one more test case to check that exception's subclasses
are catched too
4. refine rethrow test to ensure that the exception wasn't swallowed
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previously setPos, pos_=, setType, tpe_= all behaved inconsistently
between each other even though they all represent similar
attributes that cannot be changed on CannotHaveAttrs trees.
In order to simplify handling of such trees in compiler code each
of these fields now supports assignment to its current default
value: NoType for tpe and NoPosition for pos. Such assignments
don't mutate underlying trees.
|
| | |
| | |
| | |
| | | |
This is much easier to use than built-in JUnit method-level checks.
|
|\ \ \
| | | |
| | | | |
SI-7737 Regex matches Char
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Enables Char extraction by regex.
```
val r = """(\p{Lower})""".r
"cat"(0) match { case r(x) => true }
val nc = """\p{Lower}""".r
"cat"(0) match { case nc() => true }
```
|
|\ \ \
| |/ /
|/| | |
SI-7265 javaSpecVersion, adjust isJava... tests for 2.11
|