Commit Graph

4665 Commits

Author SHA1 Message Date
Jason Zaugg 2e5567b816 Avoid CCE when scalac internally uses compileLate. Fixes #2452
For example, when the `--sourcepath` option is provided
and the refchecks phase compiles an annotation found
on a referenced symbol from the sourcepath.

`compileLate` assumes that all non-sentinel compiler
phases can be down cast to `GlobalPhase`.

This commit changes the two phases in SBT to extend
this instead of `Phase`. This has the knock on benefit
of simplifying the phases by letting the `GlobalPhase.run`
iterator over the list of compilation units and feed them
to us one by one.

I checked that the test case failed before making each
change.
2016-02-11 08:25:36 +10:00
eugene yokota d3962a01ff Merge pull request #2441 from Duhemm/wip/fix-2436
Include ONLY nonpublic vars in API hash of traits
2016-02-10 16:26:54 -05:00
Martin Duhem 6576844698 Hash of traits: include private fields, objects and super accessors 2016-02-10 18:15:44 +01:00
eugene yokota 251596ab8f Merge pull request #2448 from timcharper/0.13
add documention for FileFunction.cached
2016-02-09 13:52:06 -05:00
Tim Harper fe0c3df36e add documention for FileFunction.cached 2016-02-09 09:52:19 -07:00
Martin Duhem edc1174468 Extend test `trait-private-var` with vals
Private vars and private vals defined in a trait impact the bytecode
generated for the implementors of these traits. The scripted test
`source-dependencies/trait-private-var` only accounted for private vars.

It now tries the same scenario both with private vars and private vals.
2016-02-09 15:28:35 +01:00
Martin Duhem 7d94251108 Also include private vals 2016-02-09 14:55:30 +01:00
Martin Duhem 8e17269c97 Include non-public vars in API hash of traits 2016-02-09 14:35:12 +01:00
eugene yokota 6f072f8f3b Merge pull request #2443 from eed3si9n/wip/2427
Fixes #2427 inter-project dependency interference with sbt-web
2016-02-05 12:18:36 -05:00
Eugene Yokota bd5453c0b0 Fixes #2427 inter-project dependency interference with sbt-web
sbt-web uses exportedProducts key as an extension point.
This removes exportedProductsAlways from 0.13.10-RC1,
and uses exportedProducts instead.
2016-02-05 08:28:59 -05:00
eugene yokota cdb52e96ca Merge pull request #2430 from Duhemm/wip/fix-2428
Update bridge retrieval in `consoleProject`
2016-02-04 23:40:40 -05:00
eugene yokota 49e801070f Merge pull request #2438 from Duhemm/wip/package-object-filename
Do not rely on filename of package objects
2016-02-04 23:40:07 -05:00
eugene yokota e41859ffe4 Merge pull request #2440 from cunei/toni-output-jars
Do not create dir, if trying to output classes to a jar
2016-02-04 18:38:32 -05:00
Martin Duhem be8ba763fa Include ONLY non-public members in API hash of traits
The previous logic was wrong and included all members of traits in their
API hash, which degraded the performance of the incremental compiler.

This commit changes this logic so that only the non-public members of
traits are included into their API hash.

Fixes #2436
2016-02-04 16:32:36 +01:00
Grzegorz Kossakowski 207dd762f4 Move `trait-member-modified` to source-dependencies
It's not clear what the distinction between compiler-project and
source-dependencies scripted tests is so let's stick to the one that has
the biggest number of tests for incremental compiler.
2016-02-04 16:32:35 +01:00
Grzegorz Kossakowski 74ffe5d064 Add a pending test for a modified member of a trait
The test shows that name hashing optimization is broken for members
defined in traits. The problem is that modification of a member of a trait
triggers change of a hash of trait's name.

The behavior covered by this test regressed in
40ebc82531
The bug is tracked in #2436.
2016-02-04 16:32:35 +01:00
Antonio Cunei 3e50fdc825 Do not create dir, if trying to output classes to a jar 2016-02-04 15:11:55 +01:00
Martin Duhem 34d2aabfa9 Attempt at fixing Codacy's complaints 2016-02-04 13:24:22 +01:00
Grzegorz Kossakowski 6e5082e5a7 Merge pull request #2437 from gkossakowski/nameHashing-trait-regression
Add a pending test for a modified member of a trait
2016-02-03 17:11:51 +01:00
Martin Duhem b7b1f2453d Do not rely on filename of package objects
Add a new field in `Source` that indicates whether this `Source`
represents a package object. This field is used in the incrmental
compiler to perform recompilation of package objects rather than relying
on the file name being `package.scala`.

Mark pending test `source-dependencies/package-object-name` as passing.
2016-02-03 16:32:35 +01:00
Martin Duhem 09bf5255ad Pending test for recompilation of package object
The convention says to place package objects in files named
`package.scala`, but this is not enforced by the scala specification.
The incremental compiler currently offers special treatment for files
whose name is `package.scala`, but it should rather care about whether a
file defines a package object or not.

This test fails because it defines a package object in a file whose name
is not `package.scala`.
2016-02-03 14:49:59 +01:00
Grzegorz Kossakowski d5c719b7f5 Move `trait-member-modified` to source-dependencies
It's not clear what the distinction between compiler-project and
source-dependencies scripted tests is so let's stick to the one that has
the biggest number of tests for incremental compiler.
2016-02-03 14:34:31 +01:00
Martin Duhem a58eff8f5a Merge pull request #2432 from gkossakowski/nameHashing-pkg-objects
Invalidate package objects transitively in name hashing
2016-02-03 14:28:30 +01:00
Grzegorz Kossakowski 0ceb79cff4 Add a pending test for a modified member of a trait
The test shows that name hashing optimization is broken for members
defined in traits. The problem is that modification of a member of a trait
triggers change of a hash of trait's name.

The behavior covered by this test regressed in
40ebc82531
The bug is tracked in #2436.
2016-02-02 16:50:57 +01:00
Grzegorz Kossakowski 65f7958898 Invalidate package objects transitively in name hashing
Modify `invalidatedPackageObjects` to look for package objects that
transitively inherit from an invalidated class instead of just inheriting
directly. This is the correct behavior that should have been implemented
in the first place. The bug comes from a subtle copy&paste mistake. The old
implementation used `publicInherited` relation and new one looks identical
but uses `inheritance` relation. The difference is that `publicInherited`
was a relation that was expanded transitively along inheritance chain but
`inheritance` is not. We have to perform the transitive walk in
`IncrementalNameHashing.invalidatedPackageObjects` implementation.

Mark `pkg-self` test as passing.

Fixes #2326
2016-02-02 01:33:43 +01:00
Grzegorz Kossakowski f78b7112a2 Print both memberRef and inheritance relations.
To aid debugging, modify Relations.toString to include `inheritance` in
addition to already printed `memberRef` relation.

Modify it for both name hashing and old implementation.
2016-02-01 19:23:12 +01:00
Grzegorz Kossakowski c8bf46e893 Expand `pkg-self` scripted test to cover #2326
The previous version of `pkg-self` covered scenario where a package object
inherited directly from a class that is being modified and recompiled in
subsequent steps. The #2326 shows that name hashing fails to handle
a package object that inherits indirectly from a modified class. In that
case, name hashing fails to invalidate the source file that defines the
package object.
This commit expands `pkg-self` with a class B that inherits from modified
class `A` and makes package object inherit from B. We mark that test as
pending to show that this indeed trigger the bug in name hashing.
2016-02-01 19:14:44 +01:00
Martin Duhem 6cabb9b4cb Update bridge retrieval in `consoleProject`
Fixes sbt/sbt#2428
2016-01-31 17:09:56 +01:00
Dale Wijnand a92e50929c Merge pull request #2419 from eed3si9n/wip/2415
Fixes #2415. Hide global setting fix behind sbt.globalsettingfix
2016-01-25 23:00:44 +00:00
Eugene Yokota 9da5fc871b Changed the flag name to "sbt.global.autoimport" per review. 2016-01-26 03:05:30 +09:00
Martin Duhem e966329776 Merge pull request #2414 from smarter/fix/duplicate-defs
[0.13.10] ExtractAPI: avoid unnecessary duplication of defs with primitive types
2016-01-25 09:26:29 +01:00
Dale Wijnand 03524e3329 Merge pull request #2413 from smarter/fix/vc-return-type
[0.13.10] Always invalidate API when return type is a value class
2016-01-25 07:02:20 +00:00
Guillaume Martres 726b5c8a30 ExtractAPI: avoid unnecessary duplication of defs with primitive types
If a method's type contains a non-primitive value class then it has two
signatures: one before erasure and one after erasure. Before this
commit, we checked if this was the case using `isAnyValSubtype`, but
this is too crude since primitive value classes are also subtypes of
`AnyVal` but do not change signature after erasure.

This commit replaces `isAnyValSubtype` by `isDerivedValueClass` which
excludes primitive value classes.

In practice, for an empty class, this reduces the size of the output of
`DefaultShowAPI` from 65 lines to 25 lines.
Before:
https://gist.github.com/smarter/cf1d6fe58efda88d6ee6#file-old-api
After:
https://gist.github.com/smarter/cf1d6fe58efda88d6ee6#file-new-api
2016-01-25 02:53:52 +01:00
Guillaume Martres 0993c1c7cc Always invalidate API when return type is a value class
Before this commit, we did not do the invalidation for methods with
multiple parameter list, the comment above `hasValueClassAsReturnType`
said:

  Note: We only inspect the "outermost type" (i.e. no recursion) because
  we don't need to inspect after erasure a function that would, for
  instance, return a function that returns a subtype of AnyVal.

But this is wrong: a method with signature:
  def foo(a: A)(b: B): C
is erased to:
  def foo(a: A, b: B): C
and not, as the comment in the code suggest, to:
  def foo(a: A): B => C
so we do need to inspect the final result type of methods, because they
can be value classes that will be erased to their underlying value.
2016-01-25 02:53:34 +01:00
Eugene Yokota ceccbf2d5a Fixes #2415. Hide global setting fix behind sbt.globalsettingfix
We are hiding a bug fix on global setting that was not importing auto
imports because fixing this via sbt/sbt#2399 breaks the source
compatibility: sbt/sbt#2415
I've split out the relevant portion of the scripted test into
global-settings, and marked it pending.
2016-01-24 16:50:21 -08:00
Eugene Yokota e64b01142b Merge branch '0.13' into 0.13.10 2016-01-24 15:57:53 -08:00
eugene yokota 14dcca6a31 Merge pull request #2418 from Duhemm/fix-2411
Fix #2411
2016-01-24 15:56:21 -08:00
Martin Duhem 1ebe86b704 Restore compiler bridge source for Scala < 2.10 2016-01-24 18:54:03 +01:00
Martin Duhem a93f1e50c8 Add second test case for sbt/sbt#2411
Thanks @smarter, see sbt/sbt#2416
2016-01-24 09:42:01 +01:00
Adriaan Moors 49431eb6f8 determine bytecode type with transformedType
... not exitingPostErasure, as this phase-travel crashes the compile
(it's only really meant for going back in time, right?)
2016-01-24 09:31:53 +01:00
Eugene Yokota 27039e2b3c Reproduce #2411 2016-01-24 08:56:46 +01:00
Guillaume Martres bc3d2268ed CONTRIBUTING.md: Fix error in scripted test command 2016-01-23 17:39:17 +01:00
Dale Wijnand 395851147c Merge pull request #2409 from dwijnand/tweak-0.13.10-notes
[0.13.10] Tweak the release notes
2016-01-23 02:51:37 +00:00
Dale Wijnand 26b9d9c1ab Notes: Collapse an improvement into its fix 2016-01-22 23:19:03 +00:00
Dale Wijnand 8a12edbfa0 Notes: Reword some passages 2016-01-22 23:18:31 +00:00
Dale Wijnand 899ac9eb98 Notes: Fix links 2016-01-22 23:14:27 +00:00
Dale Wijnand 223cb2632e Notes: Sort issues, move ivy/jline to the top 2016-01-22 23:11:43 +00:00
Eugene Yokota 06658661a1 Hand merged notes 2016-01-22 14:47:37 -05:00
eugene yokota afa8603ef7 Merge pull request #2407 from eed3si9n/wip/2347
Adds CompatibilityWarningOptions
2016-01-22 13:24:41 -05:00
Eugene Yokota a9dc9be83b Adds CompatibilityWarningOptions. Fixes #2347
This addresses 0.13.10 regression, which currently warns users about
Maven incompatibility on a private configuration. This adds a config
class so the build user can control the level of the warning as well as
the target configuration to be monitored.
By default, we are only going to look at `Compile` and `Runtime`.
2016-01-22 01:39:00 -05:00