Conversation
Trait implementation classes and specialized classes are always considered top-level in terms of the InnerClass / EnclosingMethod attributes. These attributes describe source-level properties, and such classes are a compilation artifact. Note that the same is true for delambdafy:method closure classes (they are always top-level).
Members of value classes are moved over to the companion object early.
This change ensures that closure classes nested in value classes
appear that way to Java reflection.
This commit also changes the EnclosingMethod attribute for classes
(and anonymous functions) nested in anonymous function bodies. Before,
the enclosing method was in some cases the function's apply method.
Not always though:
() => { class C ... val a = { class D ...} }
The class C used to be nested in the function's apply method, but not
D, because the value definition for a was lifted out of the apply.
After this commit, we uniformly set the enclosing method of classes
nested in function bodies to `null`. This is consistent with the
source-level view of the code.
Note that under delambdafy:method, closures never appear as enclosing
classes (this didn't change in this commit).
Run a number of Java reflection operations on all classes in scala library / reflect / compiler. The test is based on a draft by Jason.
The test is corrected (inverted) and the extractor is made more succinct. Succinctness isn't enforced by the test, but I checked it manually.
Now both of the overloaded variants have a parameter list. This seems to make type inference happier. Or it makes someone happier. The user is unaware whether `subsets()` takes a default arg. But happily, empty application still kicks in.
Updated documentation of + and ++ in SetLike to explicitly state that duplicate elements are not added to the set.
build.sbt
Outdated
There was a problem hiding this comment.
This will likely cause significant issues for IDEs. They definitely want each project to live in a different directory, don't they? Or is baseDirectory not use by, say, sbteclipse?
There was a problem hiding this comment.
Good point! The baseDirectory shows up in this search: https://github.com/typesafehub/sbteclipse/search?utf8=%E2%9C%93&q=baseDirectory
It's definitively a goal to provide good experience for both Eclipse and IntelliJ users. I added this as a task to PR description.
|
I'm interesting in working on getting partest working. |
|
Having problems with the project not loading in sbt, though: https://gist.github.com/michaelpigg/9cacd81ed43780fefa7d |
|
hey @michaelpigg! Assigned to you! We have an implementation of sbt's testing interface for partest already: https://github.com/scala/scala-partest-interface |
|
What sbt plugins do you have enabled? I think one of them might not be compatible with sbt's |
|
For the record, we use a fork of scala-partest-interface in Scala.js: |
|
Thanks! What was the reason for forking? |
|
At least, we had to replace I don't remember if there were other things we needed to change. Btw: the Scala.js build is much more complex than the tiny build this PR currently contains, so
made me smile a bit :-p |
|
@gkossakowski You're right, good time to trim those plugins down a bit. |
|
Thanks for references! I created scala/scala-partest#30 for future reference. This build is pretty complicated for what it does (really just building and packaging). I'm pretty sure we'll be growing down the road. |
Users of German & Swedish keyboards can again type `]` in the REPL without crazy acrobatics. Fixed upstream in jline/jline2#175
|
I'm going to start work on making partest more configurable soon so it can also be used for Dotty, and it makes sense to integrate the scala.js work and possibly other requests too. |
|
Thanks @vsalvis! Please keep us in the loop when this happens. |
Improve attribute parsing and propagate errors across event thread. Otherwise tests just hang. This is tested, right? This is an upstream port of scala-xml 5f2cfadeb9e8574ed66f37dc7a7a868eb129a8a9
SI-8759 bump jline: support alt-gr-based keyboards
SI-8841 report named arg / assignment ambiguity also in silent mode.
Use `j.l.Class.isInstance` for Scala.js, so that `unapply` works correctly when referencing raw JavaScript classes.
Inline overloaded calls to `unapply`, so we can get rid of them in 2.13. Note that theres a lot of `box(unbox(x))` going on behind the scenes. Is this needed?
Static resources are stored along source files in our current layout. Therefore we set resourceDirectory to be sourceDirectory but make sure that includeFilter includes nothing by default. Subprojects like library or compiler set their own include filters. The include filters have been ported from the Ant build definition.
As it turns out, we generate properties files only for those three subprojects.
We mimic what Ant build does.
Before this commit, we used to have common way of handling names of subproject. We would construct the name by prepending "scala-" suffix to project id (which is simply the name of directory in src/). It turns out, our projects are not named uniformly. For example, we have just "repl" and not "scala-repl". In this commit, we give up on central naming logic and have manual settings for each subproject that requires special handling.
Let's override `sources` task to return empty collections of sources to compile. Otherwise, sbt by default would pick up sources in the root directory which is not what we want.
Actors get properties files generated so we need to add settings for that. Also, the jar is called "scala-actors.jar" so we need to tweak the name of the project.
Shell scripts are generated with `mkBin` sbt task that calls ScalaTool. ScalaTool is defined in project/ and is a port of Ant task that lives in scala.tools.ant.ScalaTool. While porting, we've simplified the code significantly. The `mkBin` task is defined in a new subproject: dist. This subproject will become responsible for building the distribution in the future.
This way we don't need to worry about mixing classes for Scala compiler that sbt is invoking and the one we just built. For an example of possible problem, check out: #2 (comment)
Those jars are put by Ant build in build/pack/lib but they are not needed to be there.
Common library dependencies are extracted into vals. Those dependencies define "scala-library" as an excluded transitive dependency so we don't get eviction warnings during `update`. Lastly, version numbers for dependencies are obtained from `versions.properties` file.
- Explicitly set [un]managed[re]sourceDirectories for all projects to improve the import into IntelliJ - Add partest extras project, that contains scala/scala specific extensions to partest for use in partest and junit tests. - Add junit project, which contains unit tests for the compiler and library.
All partests pass. Partest tests are defined in Integration configuration. This means you need to run them with `test/it:test` command. We put them in separate configuration because they are slow to run so user needs to ask explicitly for partest to run.
Introduce a common way of setting jar location so it can be reused between `scalaSubprojectSettings` and `partestJavaAgent`. This reduces code duplication.
The 6e6632e introduced a junit test for scaladoc. We need to take that into account in sbt build.
Change pattern in .gitignore file so git ignores all target directories.
Add welcome message that is shown at sbt's startup. The message clearly indicates experimental status of sbt build. Also, add a short paragraph to README.md explaining status of sbt build.
This way we don't need to worry about mixing classes for Scala compiler that sbt is invoking and the one we just built. For an example of possible problem, check out: gkossakowski#2 (comment)
This way we don't need to worry about mixing classes for Scala compiler that sbt is invoking and the one we just built. For an example of possible problem, check out: gkossakowski#2 (comment)
The log messages intented to chronicle implicit search were always being filtered out by virtue of the fact that the the tree passed to `printTyping` was already typed, (e.g. with an implicit MethodType.) This commit enabled printing in this case, although it still filters out trees that are deemed unfit for typer tracing, such as `()`. In the context of implicit search, this happens to filter out the noise of: ``` | | | [search #2] start `()`, searching for adaptation to pt=Unit => Foo[Int,Int] (silent: value <local Test> in Test) implicits disabled | | | [search #3] start `()`, searching for adaptation to pt=(=> Unit) => Foo[Int,Int] (silent: value <local Test> in Test) implicits disabled | | | \-> <error> ``` ... which I think is desirable. The motivation for this fix was to better display the interaction between implicit search and type inference. For instance: ``` class Foo[A, B] class Test { implicit val f: Foo[Int, String] = ??? def t[A, B](a: A)(implicit f: Foo[A, B]) = ??? t(1) } ``` ```` % scalac -Ytyper-debug sandbox/instantiate.scala ... | |-- t(1) BYVALmode-EXPRmode (site: value <local Test> in Test) | | |-- t BYVALmode-EXPRmode-FUNmode-POLYmode (silent: value <local Test> in Test) | | | [adapt] [A, B](a: A)(implicit f: Foo[A,B])Nothing adapted to [A, B](a: A)(implicit f: Foo[A,B])Nothing | | | \-> (a: A)(implicit f: Foo[A,B])Nothing | | |-- 1 BYVALmode-EXPRmode-POLYmode (site: value <local Test> in Test) | | | \-> Int(1) | | solving for (A: ?A, B: ?B) | | solving for (B: ?B) | | [search #1] start `[A, B](a: A)(implicit f: Foo[A,B])Nothing` inferring type B, searching for adaptation to pt=Foo[Int,B] (silent: value <local Test> in Test) implicits disabled | | [search #1] considering f | | [adapt] f adapted to => Foo[Int,String] based on pt Foo[Int,B] | | [search #1] solve tvars=?B, tvars.constr= >: String <: String | | solving for (B: ?B) | | [search #1] success inferred value of type Foo[Int,=?String] is SearchResult(Test.this.f, TreeTypeSubstituter(List(type B),List(String))) | | |-- [A, B](a: A)(implicit f: Foo[A,B])Nothing BYVALmode-EXPRmode (site: value <local Test> in Test) | | | \-> Nothing | | [adapt] [A, B](a: A)(implicit f: Foo[A,B])Nothing adapted to [A, B](a: A)(implicit f: Foo[A,B])Nothing | | \-> Nothing ```
The new, sbt-based build definition for Scala
This is a PR submitted against my own fork. I'll move it over to scala/scala when it matures a bit.
What you see here is very much work-in-progress. Basics like compiling and packaging jars (into the right location) work. Everything else is missing.
Tasks up for grabs
doctask produces errors at the moment)build/pack/bin(so you can run the compiler or repl easily) (@adriaanm)asmandforkjoinlibrary-auxand how to plug it into sbt build.propertiesfiles that are placed in jars (see for examplelibrary.properties) (@dumpstate, Generating .properties files that are placed in jars. #3)compiler/runandrepl/runwork (@gkossakowski)If you would like to grab any of those tasks just drop a comment below. I'll update the list with your github id.
You'll notice that this build definition is much more complicated than your typical sbt build. The main reason is that we are not benefiting from sbt's conventions when it comes project layout. For that reason we have to configure a lot more explicitly. I've tried explain in comments the less obvious settings.
This nicely leads me to explaning goal and non-goals of this build definition.
Goals
Non-goals
It boils down to
Simple rules
Note on bootstrapping
Let's start with reminder what bootstrapping means in our context. It's an answer to this question: which version of Scala are using to compile Scala? The fact that the question sounds circular suggests trickiness. Indeed, bootstrapping Scala compiler is a tricky process.
The Ant build used to have involved system of bootstrapping Scala. It would consist of three layers: starr, locker and quick. The sbt build for Scala ditches layering and strives to be as standard sbt project as possible. This means that we are simply building Scala with latest stable release of Scala. See this discussion for more details behind this decision.