Skip to content

SI-9834 Improve error on failed op=#5254

Closed
som-snytt wants to merge 1436 commits intoscala:2.11.xfrom
som-snytt:issue/9834
Closed

SI-9834 Improve error on failed op=#5254
som-snytt wants to merge 1436 commits intoscala:2.11.xfrom
som-snytt:issue/9834

Conversation

@som-snytt
Copy link
Contributor

If rewriting x += y fails to typecheck, emit error messages
for both the original tree and the assignment.

If rewrite is not attempted because x is a val, then say so.

@scala-jenkins scala-jenkins added this to the 2.11.9 milestone Jun 28, 2016
@som-snytt
Copy link
Contributor Author

Consider s"Can't assign to $qual2". Similarly for s"Missing update method.".

@sbromberger
Copy link

Thank you for this PR!

lrytz and others added 26 commits July 20, 2016 16:41
The constructor of scala.tools.asm.Handle now takes an additional
boolean parameter to denote whether the owner is an interface.
- Use sbt in `integrate/windows`: This essentially combines the Unix CI
  jobs `validate/publish-core` and `validate/test`, first publishing a
  local release built with STARR and then building a new version with
  that and running all tests on it.

- Unify repository handling across build scripts: A new function
  `generateRepositoriesConfig` in `common`, based on the existing code
  in `integrate/bootstrap`, writes the `repositories` file for sbt,
  either with or without an extra bootstrap repository for resolving a
  previously built version. It is used in all CI scripts to ensure that
  artifacts are only resolved through the sanctioned proxies and
  upstream repositories.

- The repository URL arguments in `setupPublishCore` and
  `setupValidateTest` are now optional as well. These commands are used
  without a URL from `integrate/windows`, which publishes to `local`
  instead of a temporary remote repository.

- `testAll` is now a task instead of a command. It runs the same
  sequence of sub-tasks as before but does not propagate failures
  immediately. It always runs all subtasks and reports errors at the
  end.

- The `generateBuildCharacterPropertiesFile` task now includes all
  properties from `versions.properties` (whose values have potentially
  been overwritten with `-D` options) in `buildcharacter.properties`.
Concrete, non private methods in traits are translated into a static
method with an explicit `$this` parameter. After this translation,
the references to `$this` (subistuted for `this` in user written code)
where being positioned at the position of the method, which makes
debugging unpleasant.

This commit leaves the `Ident($this)` trees unpositioned. This is
analagous to what we do in the body of extension methods, which
is the other user of `ThisSubstitutor`.

It would be more correct to copy the position of each `This`
tree over to the substituted tree. That would let us set a breakpoint
on a line that _only_ contained `this`. But in 99% of cases users
won't be able to spot the difference, so I've opted for the tried
and tested approach here.
When we create a class symbols from a classpath elements, references
to other classes that are absent from the classpath are represented
as references to "stub symbols". This is not a fatal error; for instance
if these references are from the signature of a method that isn't called
from the program being compiled, we don't need to know anything about them.
A subsequent attempt to look at the type of a stub symbols will trigger a
compile error.

Currently, the creation of a stub symbol incurs a warning. This commit
removes that warning on the basis that it isn't something users need
to worry about. javac doesn't emit a comparable warning.

The warning is still issued under any of `-verbose` / `-Xdev` / `-Ydebug`.
Instead, we follow the example set by javac, and predicate serializability
of bot anon-class and invokedynamic-based lambdas on whether or not the
SAM type extends java.io.Serializable.

Fixes scala/scala-dev#120
Also update a few example IDE files for Eclipse and IntelliJ.

This drops the dependency by integrating the bare minimum functionality
to keep things working.
Non specialized functions can directly use `scala.FunctionN` as the
functional interface, now that mixin generates default methods in
the new trait encoding.

Unfortunately we can't do this for specialized functions as things
stand: specialization leaves the wrong method abstract. In principle,
we could/should amend the specialization transform to fix this. But
my earlier attempts at this weren't sucessful, so for now we have
to stick with the fallback plan of keeping some hand rolled functional
interfaces around.

This commit reduces the surface area of `scala.runtime.java8` to
the minimal requiremnt: one functional interface for each specialized
variant of `Function{0,1,2}`.
SD-121 Remove now-unneeded J{Function,Proc}N functional interfaces
SD-120 Non FunctionN lambdas should not be universally serializable
SD-186 Fix positions in trait method bytecode
Deprecate and rename Left#a/Right#b to Left#value/Right#value
Use File.pathSeparator when processing classpath instead of just :
to don't end up with classpath like "C:\sth\a.jar:C:\sth\b.jar" what
was causing problems after split(":").

Display questions first and then wait for user input. I tested on 3
computes and without flush the printed questions were always displayed
just after user replied - never before.
SI-8774 Null link fields in mutable LinkedHashMap (and friends) on remove
  - Avoid calling NoSymbol.owner when checking whether we're
    dealing with a case class constructor pattern or a general
    extractor. Tested manually with the test case in the ticket,
    no more output is produced under `-Xdev`.
  - Be more conservative about the conversion to a case class
    pattern: rather than looking just at the type of the pattern
    tree, also look at the tree itself to ensure its safe to
    elide. This change is analagous to SI-4859, which restricted
    rewrites of case apply calls to case constructors.

I've manually tested that case class patterns are still efficiently
translated:

```
object Test {
  def main(args: Array[String]) {
    Some(1) match { case Some(x) => }
  }
}

```

```
% qscalac -Xprint:patmat sandbox/test.scala
[[syntax trees at end of                    patmat]] // test.scala
package <empty> {
  object Test extends scala.AnyRef {
    def <init>(): Test.type = {
      Test.super.<init>();
      ()
    };
    def main(args: Array[String]): Unit = {
      case <synthetic> val x1: Some[Int] = scala.Some.apply[Int](1);
      case4(){
        if (x1.ne(null))
          matchEnd3(())
        else
          case5()
      };
      case5(){
        matchEnd3(throw new MatchError(x1))
      };
      matchEnd3(x: Unit){
        x
      }
    }
  }
}
```
SI-9560 Remove dependency on parser-combinators/json
Disable stub warning by default.
…tion

Improve sbt-based IntelliJ integration in case of Windows
SI-4914 Addition of tests resolves as fixed
SD-183 Make refinement classes ineligible as SAMs
SD-167 Fine tuning constructor pattern translation

Fixes scala/scala-dev#167
SethTisue and others added 25 commits September 28, 2016 13:07
not dl.bintray.com, it's an implementation detail that they're
our current provider
for two reasons:
* to facilitate warning-free cross-compilation between Scala 2.11
  and 2.12
* because it's not clear that .swap is a good replacement for .left

Either.right seems almost certain to be deprecated in 2.13.
Either.left's future is uncertain; see discussion (and links to
additional discussions) at scala#5135
It'd be good to use the latest version. From sbt-jmh version 0.2.10,
Flight Recorder / Java Mission Control is available[1], which would be nice.

[1] https://github.com/ktoso/sbt-jmh#using-oracle-flight-recorder
The motivation is to use the new fine-grained lock scoping that
local lazies have since scala#5294.

Fixes scala/scala-dev#235

Co-Authored-By: Jason Zaugg <jzaugg@gmail.com>
A local lazy val and a local object are expanded in the same way.
…right

don't deprecate Either.left and Either.right yet
Emit local module like lazy val
make the 2.12 spec available on scala-lang.org
bump version number in spec from 2.11 to 2.12
So that we can rsync to the 2.12 spec directory.

(also updated the forced command in scalatest@chara.epfl.ch:~/.ssh/authorized_keys2)
use proper lightbend.com and scala-sbt.org URLs
SI-9936 SeqLike.indexWhere starts at zero
expunge a stray reference to sbaz in the Scala man page
Make output of errors in testAll less verbose
…ep-24

merge 2.12.0 onto 2.12.x [ci: last-only]
If rewriting `x += y` fails to typecheck, emit error messages
for both the original tree and the assignment.

If rewrite is not attempted because `x` is a val, then say so.
When there are already errors, don't attempt mechanical rewrites.
@som-snytt som-snytt closed this Oct 12, 2016
@SethTisue SethTisue removed this from the 2.11.9 milestone Oct 18, 2016
@som-snytt som-snytt deleted the issue/9834 branch November 29, 2016 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.