summaryrefslogtreecommitdiff
path: root/test/files
Commit message (Collapse)AuthorAgeFilesLines
* Improve test for Stream.withFilter.{map,flatMap}Paolo Giarrusso2012-08-221-10/+40
| | | | Test a wider range of functionality.
* Cleanup testcasePaolo Giarrusso2012-08-202-6/+2
| | | | | No need to check the output - checking programmatically that the produced streams are empty is enough.
* Make Stream.withFilter.{map,flatMap} run in constant stack spacePaolo Giarrusso2012-08-202-0/+16
| | | | | | | | | | | | | | | The included test currently fails because `map` and `flatMap` do not run in constant stack space on a stream returned by `Stream.withFilter`, as I reported here: https://groups.google.com/d/msg/scala-language/WqJR38REXnk/saaSiDdmyqoJ Fix the problem and add a simple testcase. Note that the stack space consumed when producing an element of this stream is proportional to the number of elements failing the test before the next success. The stack space consumed to produce the stream itself is the space needed to produce the first element, that is, is proportional to the number of failures before the first success.
* Merge pull request #1159 from scalamacros/topic/cleanupJosh Suereth2012-08-194-1/+1
|\ | | | | even more cleanup in Macros.scala
| * cleanup for macroExpandEugene Burmako2012-08-184-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Error reporting is moved to ContextErrors to disentangle stuff in Macros.scala. With logics and error reporting intertwined it was an awful mess. Exceptions are used for the same reason. Instead of threading failures through the code polluting it with options/ifs, I outline the success path. It worked much better for typedMacroBody, but I'm also happy with the resulting code of macroExpand. To me a major factor towards applicability of exceptions was that they are short-lived and that there might be max one error per domain, after which we unconditionally bail.
* | Merge pull request #1162 from paulp/aug19-scala-graphPaul Phillips2012-08-182-0/+6
|\ \ | | | | | | Fix for community build blocker.
| * | Fix for community build blocker.Paul Phillips2012-08-182-0/+6
| |/ | | | | | | | | | | | | | | As two character bugfixes go, this was a doozy. I will forego elaborating at length and offer generic instructions for elucidation: % git log --grep=tpeHK
* / SI-5788 correct test and symbol updateVlad Ureche2012-08-191-3/+2
|/ | | | | | Previously I thought it's fixed because I didn't include the correct testcase. Now it's the correct testcase and this prompted me to change the code a bit to make it work properly.
* Merge pull request #1151 from scalamacros/topic/cleanupEugene Burmako2012-08-1718-20/+45
|\ | | | | more cleanup in Macros.scala
| * more cleanup for typedMacroBodyEugene Burmako2012-08-1714-11/+36
| |
| * shaves more than 150 lines off typedMacroBodyEugene Burmako2012-08-174-9/+9
| |
* | Fixes SI-6236.Aleksandar Prokopec2012-08-174-2/+32
| | | | | | | | | | | | | | In separate compilation runs, the static field symbol in the companion class of an object was not being recreated. Given that the singleton object was compiled separately, the static field symbol will be recreated on demand.
* | Fixes SI-6189.Aleksandar Prokopec2012-08-173-0/+60
| | | | | | | | | | | | | | | | Disable @static for the REPL code. The problem is that there are no companion classes generated for objects that contain the top-level declarations in the REPL. When there is no companion class, the selecting a @static field will translate to a getter call, instead of to a field load.
* | Merge pull request #1093 from jsuereth/fix/SI-6208-2.10.xPaul Phillips2012-08-161-0/+4
|\ \ | |/ |/| Fix SI-6208. mutable.Queue now returns mutable.Queue for collection met...
| * Fix SI-6208. mutable.Queue now returns mutable.Queue for collection methods ↵Josh Suereth2012-08-081-0/+4
| | | | | | | | rather than MutableList.
* | Merge pull request #1141 from VladUreche/issue/asmVlad Ureche2012-08-163-0/+34
|\ \ | | | | | | Fixes backend crash due to incorrect consumedTypes
| * | Fixes backend crash due to incorrect consumedTypesVlad Ureche2012-08-153-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This started out as a compiler crash after Greg copied the comprehension methods to List and made them final. The culprit was the dead code elimination phase, which after sweeping pieces of code was unable to restore the stack to its original state, thus causing the ASM backend to crash notifying the resulting bytecode is incorrect. The dead code elimination phase uses the icode Instructions' consumedTypes to determine what needs to be dropped from the stack when an instruction is eliminated, but the consumedTypes were only defined for a handful of instructions. So dce encountered a DUP instruction for which it did not have consumedTypes defined and did not restore the stack correctly. The consumedTypes/producedTypes for icode instructions are redundantly defined in 3 separate places: - Opcodes.scala (consumedTypes/producedTypes) - ICodeCheckers.scala (for checking icode) - TypeFlowAnalysis.scala (for computing types on the stack at each program point) Since the Opcodes types are the only ones visible outside, I suggest we use them in ICodeCheckers.scala and TypeFlowAnalysis.scala too. But we should make such changes after the release, as we're chilling out by the lake with a glass of good wine: SI-6234 The relevant discussion around it can be found at: https://groups.google.com/forum/?fromgroups#!topic/scala-internals/qcyTjk8euUI[1-25] Many thanks to Paul for his help! Review by @magarciaEPFL or @paulp.
* | | macroImplSigs => macroImplSigEugene Burmako2012-08-151-0/+1
| | | | | | | | | | | | | | | We no longer have multiple canonical signatures for macro implementations, so it was time to put the List-List-List-based logic to rest.
* | | cleanup of reflection- and macro-related stuffEugene Burmako2012-08-156-0/+6
|/ / | | | | | | | | | | mostly removes [Eugene] marks that I left back then and reviews related code some of those tokens got left in place, because I don't know to how fix them without imposing risks on 2.10.0
* | Merge pull request #1101 from scalamacros/ticket/5940Josh Suereth2012-08-145-0/+58
|\ \ | | | | | | SI-5940 impls are no longer in macro def pickles
| * | macro implementations must be publicEugene Burmako2012-08-134-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The immediate motivator for this change was the desire to keep things simple during macro expansion. Here's the story. When you expand a macro, you need to reflectively load a macro implementation method and invoke it. However private methods in Scala can sometime have their names mangled, so the reflector has to check multiple variants of the same name (the normal one and the mangled one). The problem is that since the previous commit we don't have an access to a symbol of the macro impl, hence we cannot just use `impl.expandedName` like we did before. Sure I could duplicate the logic of expandedName, but I have a better suggestion. Let's prohibit non-public macro implementations. This doesn't seem to hurt, and it lets us avoid extra bit of complexity in Macros.scala. If this measure turns out to be a hassle during the trial period of macros, non-public macros can always be allowed. In fact, we can even have this feature back for free when we migrate from Java reflection to Scala reflection for invoking macro implementations (because Scala reflection knows how to account for mangled private names). But that's the 2.10.x business.
| * | SI-5940 impls are no longer in macro def picklesEugene Burmako2012-08-131-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first officially released version of macros persisted macro def -> impl bindings across compilation runs using a neat trick. The right-hand side of macro definition (which contains a reference to an impl) was typechecked and then put verbatim into an annotation on macro definition. This solution is very simple, but unfortunately it's also lacking. If we use it then signatures of macro defs become transitively dependent on scala-reflect.jar (because they refer to macro impls, and macro impls refer to scala.reflect.macros.Context defined in scala-reflect.jar). More details can be found in https://issues.scala-lang.org/browse/SI-5940. Therefore we have to avoid putting macro impls into binding pickles and come up with our own serialization format. Situation is further complicated by the fact that it's not enough to just pickle impl's class and method names, because macro expansion needs knowledge about the shape of impl's signature (which we can't pickle). Hence we precompute necessary stuff (e.g. the layout of type parameters) when compiling macro defs.
* | | Merge pull request #1130 from non/si6223-2.10.xJosh Suereth2012-08-132-0/+15
|\ \ \ | | | | | | | | Move side-effecting call out of debuglog(). Fixes SI-6223.
| * | | Move side-effecting call out of debuglog(). Fixes SI-6223.Erik Osheim2012-08-132-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes a situation in which method calls aren't being properly specialized. All the existing tests pass; in addition, it likely fixes other specialization bugs (and improves performance of specialized code). Also includes a small regression test.
* | | | Merge pull request #1100 from adriaanm/ticket-6022bJosh Suereth2012-08-131-0/+20
|\ \ \ \ | |/ / / |/| | | SI-6022 cleaner model of variable equality modulo <:
| * | | SI-6022 cleaner model of variable equality modulo <:Adriaan Moors2012-08-091-0/+20
| |/ / | | | | | | | | | | | | | | | | | | a more conservative "excludes": no need to reason about types (TODO: check we don't get any spurious unreachability errors in the eclipse build, which is a good canary for this kind of thing)
* | | Merge pull request #1125 from hubertp/2.10.x-issue/6214Josh Suereth2012-08-132-0/+11
|\ \ \ | | | | | | | | Fixes SI-6214.
| * | | Fixes SI-6214.Hubert Plociniczak2012-08-122-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | addSynthetics was calling typedStat that caused flushing error buffer. Typically that would result in errors being re-added but addSynthetics was the last thing to run in typedStats. Instead of adding yet another check I used this as an opportunity to cleanup the once necessary workaround for typing stats. Since we are now chaining buffers of contexts manual handling is no longer necessary. Review by @odersky (I recall that you were planning to cleanup that part at some point).
* | | | Merge pull request #1123 from paulp/topic/unpickle-resilience-2Josh Suereth2012-08-131-2/+3
|\ \ \ \ | | | | | | | | | | Topic/unpickle resilience 2
| * | | | More resilience to missing classes.Paul Phillips2012-08-111-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The situation (I don't know how to make partest test this) is package s class A ; class S { def f(): A = ??? } If one compiles this and removes A.class, should references to class S cause the compiler to explode eagerly and fail to load S, or explode lazily if and when it needs to know something about A? This patch takes us from the former strategy to the latter. Review by @xeno-by.
* | | | | Merge pull request #1120 from paulp/ticket-6184-revisedJosh Suereth2012-08-111-0/+7
|\ \ \ \ \ | |/ / / / |/| | | | Ticket 6184 revised
| * | | | SI-6184 don't introduce dummies in checkableTypeAdriaan Moors2012-08-091-0/+7
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | this should fix the crash in asSeenFrom that resulted from calling baseTypeSeq on a type that had an unbound type parameter in it also, simplify widenToClass
* | | | Merge pull request #1118 from scalamacros/ticket/6201Josh Suereth2012-08-111-0/+13
|\ \ \ \ | | | | | | | | | | SI-6201 minor fixes in key points
| * | | | SI-6201 minor fixes in key pointsEugene Burmako2012-08-111-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes several oversights that led to 6201. RootPackage should have been static, refactored implementation of hasSymbolWhich shouldn't have checked hasSymbol. Full discussion is here: http://groups.google.com/group/scala-internals/browse_thread/thread/9500348f273a8aa.
* | | | | Merge pull request #1105 from rklaehn/SI-6197Josh Suereth2012-08-112-0/+21
|\ \ \ \ \ | | | | | | | | | | | | Only create a HashTrieSet if necessary.
| * | | | | Added test to check that removing all but one element from a HashTrieSet ↵Ruediger Klaehn2012-08-112-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | yields a HashSet1 as it should
* | | | | | Merge pull request #1097 from rklaehn/SI-6198Josh Suereth2012-08-112-0/+24
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | Si 6198
| * | | | | Added test for SI-6198Ruediger Klaehn2012-08-112-0/+24
| |/ / / / | | | | | | | | | | | | | | | This tests that ListSet.tail is O(1) as well as testing that a HashSetCollision1 is turned back into a HashSet1 when removing all but one element
* | | | | Merge pull request #1091 from paulp/topic/patmat-error-messagesJosh Suereth2012-08-108-12/+84
|\ \ \ \ \ | | | | | | | | | | | | Better pattern matcher error message.
| * | | | | Better pattern matcher error message.Paul Phillips2012-08-088-12/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the common case when someone hasn't quite grokked the significance of lower case in a pattern match. I'd like to make all the unreachables errors, not warnings, but there may be a bug or two to clear out first. class A { def badEquals(x: Any, y: Any) = x match { case y => true case _ => false } } a.scala:3: warning: patterns after a variable pattern cannot match (SLS 8.1.1) If you intended to match against parameter y of method badEquals, you must use backticks, like: case `y` => case y => true ^ a.scala:4: warning: unreachable code due to variable pattern 'y' on line 3 case _ => false ^ two warnings found
* | | | | | Merge pull request #1094 from scalamacros/ticket/6204Adriaan Moors2012-08-093-0/+25
|\ \ \ \ \ \ | | | | | | | | | | | | | | fixes to existential-related reification problems
| * | | | | | SI-6204 reifier no longer causes cyclic errorsEugene Burmako2012-08-091-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When reifying certain trees/types reifier might decide that it needs to introduce auxiliary symbols to represent non-locatable components of types For example, when reifying a refined type we need to reify the symbols that correspond to its members (aka RefinedType.decls). Since these symbols are not stored in pickles, we can't do the usual staticClass(scala.Int) stuff, and are forced to actually create corresponding symbols inside the reificode (by "create" I mean literally create, by using newXXXSymbol methods). It looks like a generally good idea to not only create those symbols naked, but to also export their type signatures and annotations. However this brings problems with type inference. Say, a type of a method A depends on a type tag. To get a type of a type tag, the compiler needs to expand the corresponding macro (when the macro is being expanded, symbol A is marked as LOCKED). While reification macro expands, it might want to reify certain symbol definitions (as explained above). If one of these definitions is a class that contains method A, we're in trouble, since reifying the corresponding ClassInfoType will eventually call A.info, which will produce a cyclic reference error, because A is LOCKED. An obvious solution is to check whether a reified symbol definition is locked. If the symbol is locked, then the reifier bails (e.g. by reifying NoType instead of the actual type signature of the symbol). Being obvious this solution is also incorrect as illustrated by SI-6204. Sure we can check whether a symbol itself is locked, but we cannot check whether or not we reify someone who refers to the locked symbol. As of such I'm telling the reifier to bail whenever it needs to reify a symbol definition for a symbol that is not yet complete. Therefore reification can no longer cause inference of method result types, which eliminates the underlying problem. This is a harsh measure, but taking into account that we have an RC planned within a week, stability trumps completeness.
| * | | | | | SI-5756 correctly reifies local module classesEugene Burmako2012-08-092-0/+15
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unlike module classes that are going to be pickled (which are reified as `<their module reification>.moduleClass), module classes of local modules need to be reified as symbol defs. Otherwise we get a stack overflow: 1) Local modules are deemed to be free terms, 2) All free symbols are reified together with their type signature (so that they can be a) inspected by anyone interested, b) compiled at runtime), 3) Reifying a type signature of a module involves reifying its module class, 4) Reifying a module class involves reifying a module and calling its module class, <ad infinitum> This stack overflow doesn't happen for locatable modules, because they don't need to have their type signatures reified (these signatures can later be loaded from pickles if it becomes necessary).
* | | | | | Merge pull request #1095 from gkossakowski/inliner-access-levelsVlad Ureche2012-08-093-0/+22
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | Moved inline logic before pickler.
| * | | | | Moved inline logic before pickler.Grzegorz Kossakowski2012-08-093-0/+22
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test case failed due to separate compilation. The problem was that we don't pickle the fact that the field was made public. Original patch by @odersky. Cleaned up by me. Changes I made: * removed stale test-case * reduced whitespace changes Supersedes #1089. Review by @odersky and @moors.
* | | | | Merge pull request #1060 from adriaanm/ticket-5739bAdriaan Moors2012-08-083-43/+133
|\ \ \ \ \ | | | | | | | | | | | | SI-5739 (bis) vals for subpatterns when -g:patmatvars
| * | | | | SI-5739 (bis) vals for subpatterns unless -optimizeAdriaan Moors2012-08-083-43/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To facilitate debugging pattern matches, we store the values for sub-patterns of extractor (synthetic or user-defined) patterns in local variables. When performing an optimized build, and when possible, we don't do store but inline them directly. For soundness, SI-5158, SI-6070, we must always store the values of mutable case class fields. (Specifying -optimize is the only way to suppress emitting these local variables. An unoptimized build will always generate them, which was deemed the right default during the meeting.) (updated flags for t4425 to get consistent runs on optimized and non-optimized partest runs by always passing -optimize)
* | | | | | Merge pull request #1088 from adriaanm/ticket-6205Adriaan Moors2012-08-081-0/+18
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-6205 make pt fully defined before inferTypedPattern
| * | | | | | SI-6205 make pt fully defined before inferTypedPatternAdriaan Moors2012-08-081-0/+18
| | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | refines my fix for SI-2038 (#981) by making pt fully defined before calling inferTypedPattern, instead of making the result of inferTypedPattern fully defined I finally realized my mistake by diffing the -Ytyper-debug output of compiling the variants with: ``` x match {case Holder(k: A[kt]) => (k: A[kt])} ``` and ``` (x: Any) match {case Holder(k: A[kt]) => (k: A[kt])} ```
* | | | | | Merge pull request #1064 from adriaanm/ticket-6145Adriaan Moors2012-08-081-0/+11
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | SI-6145 lax typing of args to synthetic case-labels