summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* better encapsulation in constructors phaseMiguel Garcia2013-08-081-3/+3
|
* readability for intoConstructors transformerMiguel Garcia2013-08-081-10/+32
|
* separation of concerns: eliding param-accessor fields in constructorsMiguel Garcia2013-08-081-115/+135
| | | | | | | | | | | | | | | | | | | | | | | This commit modularizes TemplateTransformer by moving a few members from TemplateTransformer into the newly added OmittablesHelper. The members in question include - a few methods: # isParamCandidateForElision(Symbol) # isOuterCandidateForElision(Symbol) # mustbeKept(Symbol) - a few vals: # paramCandidatesForElision # outerCandidatesForElision # bodyOfOuterAccessor - class UsagesDetector That way, all trace of rewriting to elide param-accessor fields has vanished from TemplateTransformer and is encapsulated in OmittablesHelper.
* separation of concerns: delayed-init in constructorsMiguel Garcia2013-08-081-134/+137
| | | | | | | | | | | | | | | This commit modularizes TemplateTransformer by moving a few methods from TemplateTransformer into the newly added DelayedInitHelper. The methods in question - delayedInitCall() - delayedInitClosure() - delayedEndpointDef() build trees that rewriteDelayedInit() puts together. That way, all trace of rewriting related to delayed-init have vanished from TemplateTransformer and are encapsulated in DelayedInitHelper.
* method transformClassTemplate() turned into class TemplateTransformerMiguel Garcia2013-08-081-575/+579
| | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, each activation of transformClassTemplate() performed the rewriting that the constructors phase is well-known for. Lots of auxialiary objects were created in the process, with lifetime confined to said activation. The same auxiliary objects (having same lifetimes as before) also are in effect starting with this commit, but now it's an instance of TemplateTransformer that holds them together. In other words, there's a one-to-one correspondence between: - (what used to be) transformClassTemplate() activation - TemplateTransformer initialization After initialization, the result of TemplateTransformer can be found in its `transformed` member val. In fact, the refactoring to get here from the previous commit basically involves taking the body of method transformClassTemplate() as-is to become the template of TemplateTransformer. The TemplateTransformer in question will allow modularizing sub-transformations (e.g., DelayedInit) into dedicated traits (see upcoming commits).
* eliding what the constructor phase elides but with less effort (2 of 2)Miguel Garcia2013-08-081-63/+1
| | | | | Removing the old implementation of elision in constructors in favor of the new one which is both faster, more readable.
* eliding what the constructor phase elides but with less effort (1 of 2)Miguel Garcia2013-08-081-2/+67
| | | | | | For now both old and new implementations of elision coexist, allowing cross-checking their results. In the next commit only the new one will remain.
* how stuff works: elision of param-accessor-fields and outer-accessorsMiguel Garcia2013-08-081-6/+64
|
* handling AnyVal special case early on to simplify logic afterwardsMiguel Garcia2013-08-081-6/+10
| | | | | | This way the contract of `transformClassTemplate()` can focus on non-AnyVal cases, which are more regular from the perspective of transforming their templates in the constructors phase.
* warn about uninitialized reads (in constructors), self-contained checkMiguel Garcia2013-08-081-37/+47
| | | | | | | The check in question relies on helper maps and methods that don't belong outside that check. This commit encapsulates those helpers into the newly added `checkUninitializedReads()` , thus uncluttering `transformClassTemplate()`
* Merge pull request #2741 from retronym/topic/intellij-modularAdriaan Moors2013-08-0815-23/+137
|\ | | | | Scrubbing up the IntelliJ Config
| * Scrubbing up the IntelliJ ConfigJason Zaugg2013-07-2915-23/+137
| | | | | | | | | | | | | | | | | | | | | | | | - Add recently sprouted modules (xml and parser-combinators) - Replace some of the documentation with a setup script - Update Ant build to copy Maven sourced JARs to ./build/deps. These are included in the IntelliJ classpath. - Define the library for Ant at the project level based on ./lib, rather than asking the user to define global library. - Disable Type Aware Highlighting by default. IntelliJ now can build everything within the IDE with CTRL-F9.
* | Merge pull request #2776 from gkossakowski/symbolTable-refactoringsGrzegorz Kossakowski2013-08-0621-217/+293
|\ \ | | | | | | Refactor the cake so SymbolTable does not depend on Global
| * | Address TODOs around SymbolLoaders and SymbolTable.Grzegorz Kossakowski2013-07-309-74/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SymbolTable refactoring introduced some TODOs that were supposed to be addressed after M5 release. The reason I couldn't address those problems right away was a conflict with our plans to modularize Scaladoc and interactive. However, we decided to delay that work until after M5 is released so addressing TODOs is not blocked anymore. This commit introduces the following changes: * Eclipse project definitions for interactive and scaladoc depend on scala-compiler project so they are builded against latest version of the compiler (quick) instead of STARR. This aligns our Eclipse project definitions with build.xml structure. * Introduce GlobalSymbolLoaders class which wires dependencies of SymbolLoaders with assumption of dependency on Global. * Switch to GlobalSymbolLoaders in BrowsingLoaders, interactive Global and ScaladocGlobal; this eliminates all TODO comments introduced before
| * | Fix Platform type in Global to be JavaPlatform.Grzegorz Kossakowski2013-07-273-40/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment we have just one Platform: JavaPlatform in the compiler. The whole Platform abstraction feels dubious and Java backends need to downcast to JavaPlatform to implement some optimizations. It seems like for now it's just better to fix platform declared in Global to be JavaPlatform and get rid of downcasting. I checked that even JavaScript backend declares itself as a subtype of JavaPlatform so it seems like our abstraction is not that useful. If we have an alternative platform with specific requirements we might want to refactor our Platform abstraction again but for now it seems dubious to pay a price for abstraction nobody uses.
| * | The `test-junit` Eclipse project depends on `scala-compiler`Grzegorz Kossakowski2013-07-272-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to write JUnit tests for Scala compiler so we should depend on `scala-compiler` project in `test-junit`. Also, make dependencies of `scala-compiler` project exported so it's enough to depend on `scala-compiler` to get all the transitive dependencies that are needed by the compiler. Otherwise, one would need to copy all dependencies of Scala compiler to all Eclipse projects that depend on the compiler.
| * | Refactor the cake so SymbolTable does not depend on GlobalGrzegorz Kossakowski2013-07-2716-59/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is rather large commit so I'll first explain the motivation behind it and then go through all changes in detail explaining the choices I made. The motivation behind this refactoring was to make SymbolTable unit testable. I wanted a lightweight way of initializing SymbolTable and then writing unit tests for subtyping algorithm, various functionality related to Symbols, etc. All of that should be possible by precisely controlling what we test, e.g., create types and symbols by hand and not have them defined in source code as we normally do in partest (functional) tests. The other motivation was to reduce and clarify dependencies we have in the compiler. Explicit dependencies lead to cleaner design. Also, explicit and reduces dependencies help incremental compilation which is a big problem for us in compiler's code base at the moment. One of the challenges I faced during that refactoring was cyclic dependency between Platform and SymbolLoaders. Platform depended on `SymbolLoaders.SymbolLoader` because it would define a root loader. SymbolLoaders depended on Platform for numerous reasons like deferring decision how to load a given symbol based on some Platform-specific hooks. I decided to break that cycle by removing methods related to symbol loading from Platform interface. One could argue, that better fix would be to make SymbolLoaders to not depend on Platform (backend) concept but that would be much bigger refactoring. Also, we have a new concept for dealing with symbol loading: Mirrors. For those reasons both `newClassLoader` and `rootLoader` were dropped from Platform interface. Note that JavaPlatform still depends on Global so it can access phases defined in Global to implement `platformPhases` method. Both GenICode and BCodeBodyBuilder have some Platform specific logic that requires casting because pattern matcher doesn't narrow types to give them a proper refinement. Check the changes for details. Some logging utilities has been moved from Global to SymbolTable because they are accessed by SymbolTable. Since Global inherits from SymbolTable this should be a source compatible change. The SymbolLoaders has dependency on `compileLate` method defined in Global. The purpose behind `compileLate` is not clear to me but the dependency looks a little bit dubious. At least we made that dependency explicit. ScaladocGlobal and Global defined in interactive has been adapted in a way that makes them compile both with quick.comp and 2.11.0-M4 so my refactorings are not blocking the modularization effort.
| * | Deprecate Platform.BinaryRepr.Grzegorz Kossakowski2013-07-274-26/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 27c8266e introduced `Platform.BinaryRepr` abstract type that was meant to abstract over binary representation of a classfile. The abstraction was needed at the time because we had both jvm backend and msil backend. The msil backend has been removed but the abstraction was kept in place. The type has been deprecated and set to be an alias for AbstractFile. The alias will be removed later in 2.11 milestone cycle. All references to `Platform.BinaryRepr` has been removed in the compiler in favour of using AbstractFile directly. If we ever need to abstract over multiple backends we should do that based on real requirements of given backends. This is a first step towards breaking the cyclic dependency between Platform and SymbolLoaders.
| * | Remove dependency on typer phase in ClassfileParser.Grzegorz Kossakowski2013-07-276-6/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ClassfileParser depends on forcing infos during typer phase. It's not entirely clear why this is needed (git blame doesn't help much) but I decided to preserve the logic. Therefore, I introduced an abstract method called `lookupMemberAtTyperPhaseIfPossible` which preserves the original semantics but is implemented outside of ClassfileParser so the ClassfileParser itself doesn't need to depend on typer phase and phase mutation utilities. I removed `loaders` override in `test/files/presentation/doc`. I would have to update it to implement the `lookupMemberAtTyperPhaseIfPossible` method. However, the override doesn't seem to be doing anything useful so I just removed it.
| * | Move ICodeReader-specific logic out of ClassfileParser.Grzegorz Kossakowski2013-07-273-95/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ClassfileParser contained some ICodeReader-specific logic like `forceMangledName` and `getMemberSymbol` methods. The `getMemberSymbol` method was defined in ConstantPool class because it must access some internal state of ConstantPool. In order to move that method to ICodeReader we had two options: 1. Make all internal state accessible from outside of ConstantPool class so getMemberSymbol could be implemented outside of ConstantPool hierarchy 2. Make it possible to subclass ConstantPool in ICodeReader so getMemberSymbol can be implemented in a subclass and can access internal state of ConstantPool Given the fact that getMemberSymbol mutates ConstantPool's internal state I decided that subclassing is a cleaner approach. It required significant refactoring because we had to make sure that we create an instance of proper class when initializing the `pool` variable. I ended up introducing `ConstantPoolManager` class which is essentially a mutable variable that can be reset multiple times. This change makes ClassfileParser independent from the ICodeReader and its implementation details.
* | | Merge remote-tracking branch 'scala/master' into merge-2.10.xGrzegorz Kossakowski2013-07-2911-375/+543
|\ \ \
| * \ \ Merge pull request #2746 from soc/topic/paulp-typer-debug-outputAdriaan Moors2013-07-2911-375/+543
| |\ \ \ | | | | | | | | | | Improve type printing (toString/debugging)
| | * | | Make -Ytyper-debug output readable.Paul Phillips2013-07-179-299/+481
| | | | |
| | * | | Cleanups in type printing.Paul Phillips2013-07-172-76/+62
| | | |/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | More consistency as to how to understand aliases, singletons, specialized symbols, subclasses. Fewer weird special casings, like normalizing tuples and functions during type printing, but nothing else. I avoid "normalize" entirely now, and do not make special cases for dealiasing, which is already well handled when printing error messages. Look at the change to test/files/neg/t2641.check to get a sense of why we should resist calling normalize during the early days of a compilation run. Anonymous and refinement classes can be printed far more usefully by revealing their parents, and that too is here. Hardened toString against undesirable side effects. Make toString final to discourage any further rogue toString overriders. Make safeToString a little safer.
* | | | Merge remote-tracking branch 'scala/2.10.x' into merge-2.10.xGrzegorz Kossakowski2013-07-298-49/+250
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf src/compiler/scala/reflect/reify/phases/Reshape.scala src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala src/compiler/scala/tools/nsc/transform/Mixin.scala src/compiler/scala/tools/nsc/typechecker/RefChecks.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/library/scala/concurrent/impl/Promise.scala src/reflect/scala/reflect/internal/StdAttachments.scala test/files/neg/macro-override-macro-overrides-abstract-method-b.check test/files/run/t7569.check
| * | | Merge pull request #2750 from retronym/ticket/7455-2.10.xGrzegorz Kossakowski2013-07-271-2/+11
| |\ \ \ | | | | | | | | | | SI-7455 Drop dummy param for synthetic access constructor
| | * | | SI-7455 Drop dummy param for synthetic access constructorJason Zaugg2013-07-281-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Java synthesizes public constructors in private classes to allow access from inner classes. The signature of that synthetic constructor (known as a "access constructor") has a dummy parameter appended to avoid overloading clashes. javac chooses the type "Enclosing$1" for the dummy parameter (called the "access constructor tag") which is either an existing anonymous class or a synthesized class for this purpose. In OpenJDK, this transformation is performed in: langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java (Incidentally, scalac would just emits a byte-code public constructor in this situation, rather than a private constructor / access constructor pair.) Scala parses the signature of the access contructor, and drops the $outer parameter, but retains the dummy parameter. This causes havoc when it tries to parse the bytecode for that anonymous class; the class file parser doesn't have the enclosing type parameters of Vector in scope and crash ensues. In any case, we shouldn't allow user code to see that constructor; it should only be called from within its own compilation unit. This commit drops the dummy parameter from access constructor signatures in class file parsing.
| * | | | Merge pull request #2738 from retronym/ticket/7636Grzegorz Kossakowski2013-07-271-0/+2
| |\ \ \ \ | | | | | | | | | | | | SI-7636 Fix a NPE in typing class constructors
| | * | | | SI-7636 Fix a NPE in typing class constructorsChristopher Vogt2013-07-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we encountered an erroneous super call due to a failure in parent type argument inference, we must avoid inspecting the untyped children of erroneous trees.
| * | | | | Merge pull request #2762 from gourlaysama/t7687Grzegorz Kossakowski2013-07-271-1/+1
| |\ \ \ \ \ | | | | | | | | | | | | | | SI-7687 Handle spaces in %COMSPEC% path in scala.bat.
| | * | | | | SI-7687 Handle spaces in %COMSPEC% path in scala.bat.Antoine Gourlay2013-07-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Double quoted %COMSPEC% to allow for spaces in the path to the default interpreter (cmd.exe or equivalent).
| * | | | | | [backport] SI-7569 Fix end position in PostfixSelect treeFrançois Garillot2013-07-241-1/+1
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | introduced in 5b54681: the end position of Postfix operators should take the operator length into account. review by @som-snytt
| * / / / / SI-7657 clarifies the "macro overrides method" ruleEugene Burmako2013-07-141-2/+2
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we allow macros to override non-abstract methods (in order to provide performance enhancements such as foreach for collections), and we also disallow macros to override abstract methods (otherwise downcasting might lead to AbstractMethodErrors). This patch fixes an oversight in the disallowing rule that prohibited macros from overriding a concrete method if that concrete method itself overrides an abstract method. RefCheck entertains all overriding pairs, not only the immediate ones, so the disallowing rule was triggered. Now macros can override abstract methods if and only if either the base type or the self type contain a matching non-abstract method.
| * | | | Merge pull request #2674 from richdougherty/2.10.x-si7336-try2Adriaan Moors2013-07-122-24/+197
| |\ \ \ \ | | | | | | | | | | | | SI-7336 Link flatMapped promises to avoid memory leaks
| | * | | | SI-7336 - Link flatMapped promises to avoid memory leaksRich Dougherty2013-07-062-24/+197
| | |/ / /
| * | | | Merge pull request #2666 from som-snytt/issue/7265-spec-at-leastAdriaan Moors2013-07-121-10/+25
| |\ \ \ \ | | | | | | | | | | | | SI-7265 General test for spec version
| | * | | | SI-7265 General test for spec versionSom Snytt2013-07-041-10/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test for isJavaAtLeast uses the specification.version. The method argument must have the form "major.minor". The scaladoc is updated to reflect the new reality and a test is added under junit. Note that this implementation aims to be a simple compromise between the functional and imperative camps, that is, to be free of both closures and while loops. And to elicit no cruft like regexes and wrappers for strings. No doubt even more could be done in this department, but we don't wish to spoil the fun on codegolf.stackexchange.com. However, we might decide to sponsor a new site: codereviewpingpong.com For 2.10.x, javaSpecVersion is provided as a private member. The active test is under `run` and the `junit` test must bide its time in `pending`. For 2.11, the private members can be public and the app test replaced with the unit test.
| * | | | | Merge pull request #2721 from retronym/ticket/7649Adriaan Moors2013-07-121-8/+8
| |\ \ \ \ \ | | | | | | | | | | | | | | SI-7649 Fix positions for reshaped tag materializers
| | * | | | | SI-7649 Fix positions for reshaped tag materializersJason Zaugg2013-07-111-8/+8
| | | |/ / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calls to `materializeClassTag[T]` are replaced during reification with `implicitly[ClassTag[T]]` in the `reify` macro. This is done to avoid referring to symbols in scala-compiler.jar. Class- and Type-Tag materialization is treated in the same way. This commit positions the replacement trees to avoid triggering assertions under -Yrangepos.
| * | | | | Merge pull request #2716 from SethTisue/terribly-important-typo-fixAdriaan Moors2013-07-122-2/+2
| |\ \ \ \ \ | | | | | | | | | | | | | | fix typo in BigInt/BigDecimal deprecation messages
| | * | | | | fix typo in BigInt/BigDecimal deprecation messagesSeth Tisue2013-07-082-2/+2
| | |/ / / /
| * | | | | Merge pull request #2689 from scalamacros/ticket/7617Adriaan Moors2013-07-122-3/+37
| |\ \ \ \ \ | | | | | | | | | | | | | | SI-7617 typedAssign no longer expands lhs
| | * | | | | SI-7617 typedAssign no longer expands lhsEugene Burmako2013-07-091-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes sure that setter and updateDynamic macros work as intended rather than in some cases expanding incorrectly or prematurely. Setter invocations are desugared from assignments of values to getters. If a typecheck of an assignment's lhs yields an invocation of a getter, then the assignment is rewritten into an invocation of a setter. However if a getter is a macro, then it just expands, destroying the prerequisite for desugaring. Therefore we need to disable expansion for the typecheck of an lhs. Similar thing happens to updateDynamic that first desugars a getter invocation into q"$target.updateDynamic($fieldName)" and then expects typedAssign to rewrite the corresponding Assign node into an additional application of a partially applied updateDynamic to a rhs. Here we also need to disable the typecheck of an lhs, because macros cannot be partially applied.
| | * | | | | makes it more convenient to work with SuppressMacroExpansionAttachmentEugene Burmako2013-06-282-2/+33
| | | | | | |
| * | | | | | SI-7638 Superaccessor lookup after specializationVlad Ureche2013-07-081-1/+1
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The crash was caused by a symbol lookup to rewire the super calls, done after pickler, but specialization added new traits and new members, thus making the super rewiring impossible. To avoid such problems, this patch moves symbol lookup after specialization, so the changes done by specialization (and miniboxing) become visible to mixin. NOTE: This patch will be followed by a similar patch to master. Review by @adriaanm or @retronym.
* | | | | | Merge pull request #2739 from retronym/ticket/7668Adriaan Moors2013-07-291-0/+3
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-7668 Better return type inheritance for dep. method types
| * | | | | | SI-7668 Better return type inheritance for dep. method typesJason Zaugg2013-07-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Return type inheritance already handles substitution of type parameters of the overriding method for those of the overriding. This commit extends this to do the same for parameter symbols.
* | | | | | | Merge pull request #2737 from retronym/ticket/7669Adriaan Moors2013-07-291-5/+16
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-7669 Fix exhaustivity warnings for recursive ADTs.
| * | | | | | | SI-7669 Fix exhaustivity warnings for recursive ADTs.Jason Zaugg2013-07-171-5/+16
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pattern matcher's analysis was correctly finding models under which the match in the enclosed test could fail. But, when trying to render that model as a counter example, it ran into an internal inconsistency and gave up. That inconsistency arose from VariableAssignment, which: > turn the variable assignments into a tree > the root is the scrutinee (x1), edges are labelled > by the fields that are assigned a node is a variable > example (which is later turned into a counter example) In the process, it notes the unreachable case `V2 = NotHandled`, which can only arise if `V1 = Op`, ie the scrutinee is `Op(NotHandled())`. V2 is assosicated with the path `x1.arg`. The code then looked for any variable assosicated with the prefix `x1` and registered that its field `arg` was assosicated with this variable assignment. However, the assignment for `V1 = NotHandled` (another missing case) is also associated with the path `x1`. Registering this field makes no sense here; we should only do that for `Op`. This commit conditionally registers the fields based on the class of `VariableAssignment#cls`. We no longer hit the inconsistency in `VariableAssignment#allFieldAssignmentsLegal`. This favourably changes the results of two existing tests. I had to tweak the counter example pruning to avoid relying on CounterExample.==, which is flaky in the light of Nil and List(). It is possible to have: A, B where A != B && A.coveredBy(B) && B.coveredBy(A) Luckily it is straightforward to implement pruning entirely with coveredBy.
* | | | | | | Merge pull request #2690 from soc/SI-7620Adriaan Moors2013-07-291-7/+4
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-7620 Remove floating-point-literals-without-digit-after-dot