aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Symbols.scala
Commit message (Collapse)AuthorAgeFilesLines
* Take SourceFile annotations into account when computing sourceFileMartin Odersky2016-04-071-12/+16
| | | | | | | If a file was loaded from TASTY, it can not still have a non-null source file, since the source file is unpickled into the annotation of a top-level class. Also, fix typo in previous commit.
* Do not report data races between symbols defined in class and its selftypeMartin Odersky2015-12-141-1/+1
| | | | | | | Analogous to the previous situation where we do not report a data race if the previous symbol comes from a superclass, we now do the same if the previous symbol comes from a given self type. Makes overrideDataRace.scala pass, and finally enables stdlib test with TraverableViewLike.scala added.
* Standardize requiredMethod callsMartin Odersky2015-11-091-8/+0
| | | | | Remve versions in Symbols, always go through version in Denotations. Avoids having two equivalent ways to do the same thing.
* First versions of Definitions based on TypeRefs not Symbols.Martin Odersky2015-11-091-2/+13
| | | | | | | | | | | | | | | Symbols are not stable between runs, so if some symbol referred to from Definitions gets recompiled, there are then two Symbols that are both visible, one referenced from Definitions, the other the one that got compiled. Thos led to a crash when e.g. compiling scala.Short, because the newly compiled symbol was not recognized as a primitive value class. The present commit tries to make systematic changes without regard to simplicity or aesthetics. This will be polished in future commits. // ### comments signal areas that need further attention.
* remove unused codeSarunas Valaskevicius2015-09-251-7/+0
|
* Applied review commentsMartin Odersky2015-08-041-1/+1
| | | | Added suggested changes by myself and @smarter.
* Address review comments of #693Dmitry Petrashko2015-07-201-1/+1
|
* Make symbols have predictable hash codes.Dmitry Petrashko2015-07-131-0/+2
|
* Eliminate global _nextId field in SymbolsMartin Odersky2015-07-061-18/+12
| | | | | | | | | _nextId is used to set Symbol's id fields. That field is actually used for more than priunting. In LambdaLift, it determines Symbol ordering when constructing (tree-) sets of symbols. Instead of a thread-unsafe global counter, we not use existing infrastructure in ConetxtState.
* Avoid spurious StaleSymbol error in <refinement> membersMartin Odersky2015-06-161-1/+1
| | | | | | | Refinement classes and their members could give spurious stale symbol errors if the symbol is loaded in a different run than the classfile containing it. The problem is that refinement classes do not form part of the scope of their owners. The fix assumes that refinement classes are always "stillValid".
* Correct a large number of typos.Jason Zaugg2015-05-141-1/+1
| | | | | I scanned the main sources with IntellIJ's spell checker and corrected what showed up.
* Make isTerm/isType not force the denotation of a symbols defined in this run.Dmitry Petrashko2015-05-081-2/+6
| | | | See discussion in #544
* Make isTerm/isType not force the denotation of a symbol to be up-to-date.Martin Odersky2015-05-071-2/+2
| | | | | | Symbols never change betwene terms and types. So we do not need to the current denotation to decide what they are. Less forcing -> less potential for cyclic references.
* New symbol creation method: `newNormalizedClassSymbol`.Martin Odersky2015-05-021-0/+24
| | | | | | It's common that one wants to create class symbols with arbitary parent types, not just TypeRefs. But for the casual user it's non-obvious how to do it. Hence the new creation method.
* Erasure: properly erase value classesGuillaume Martres2015-05-011-8/+0
| | | | | | | | | | | | | | | | | | | | There are three ways to erase a value class: - In most case, it should be semi-erased to an ErasedValueType, which will be fully erased to its underlying type in ElimErasedValueType. This corresponds to semiEraseVCs = true in TypeErasure. - In a few cases, it should be erased like a normal class, so far this seems to be necessary for: * The return type of a constructor * The underlying type of a ThisType * TypeTree nodes inside New nodes * TypeApply nodes * Arrays In these cases, we set semiEraseVCs = false - When calling `sigName` it should be erased to its underlying type. This commit implements all these cases. Note that this breaks most tests because ElimErasedValueType has not been implemented yet, it is part of the next commit.
* Merge pull request #495 from dotty-staging/refactor/SuperAccessorsDmitry Petrashko2015-04-281-4/+8
|\ | | | | Refactor/super accessors
| * Remove trailing whitespaceMartin Odersky2015-04-231-1/+1
| | | | | | | | | | I have figured out how to make this the default in Eclipse, so hopefully we won't see many repeats of this.
| * Anchor import symbols at current ownerMartin Odersky2015-04-221-2/+2
| | | | | | | | | | Needed to harmonize behavior of Typer/Namer and tpd. This is needed for making pickling, then unpickling the identity.
| * Make currentClass available from SymbolsMartin Odersky2015-04-221-2/+6
| | | | | | | | | | | | | | | | It's needed beyond MacroTransform, and its definition is independent. Also, make `defn` in Symbols not implicit. (I think its implicitness was an oversight).
* | Implement getClassIfDefined.Dmitry Petrashko2015-04-201-0/+6
|/
* Companion methods should have Method flag.Dmitry Petrashko2015-04-151-1/+3
|
* Ensure spaces after `if` in Dotty source.Dmitry Petrashko2015-04-091-1/+1
|
* Add spaces around + in dotty source.Dmitry Petrashko2015-04-091-1/+1
|
* Merge pull request #436 from dotty-staging/linked-classDmitry Petrashko2015-04-021-0/+9
|\ | | | | use methods to find companion class
| * Simplify methods implemented in #436Dmitry Petrashko2015-04-021-12/+6
| |
| * Do not synthesizeCompanionMethod twice, and do not rewrite the existing symbol.Dmitry Petrashko2015-03-301-5/+11
| |
| * Guard against absent symbols in synthesizeCompanionMethod.Dmitry Petrashko2015-03-281-1/+1
| |
| * Remove code duplication between Namer, ClassfileParser and UnPicklerDmitry Petrashko2015-03-261-0/+9
| |
* | Fix TreeTypeMap and mapSymbols to create a copy of decls for duplicated classes.Dmitry Petrashko2015-04-021-1/+1
|/ | | | | | | Without this fix the duplicated classes and the original ones share the same reference to a scope, instead of having each a separate one. @alexsikia this should fix your problems
* Have derivedValueClass run at initial stageMartin Odersky2015-03-221-1/+4
| | | | | | Fixes #412, by calling derivesFrom in isDerivedValueClass at initial phase. Rewrite of 789dc0c070bde6ce8634aa89e73e31ec1233a6f8 by @smarter. Does the same thing in Symbol#isDerivedValueClass.
* Merge pull request #331 from dotty-staging/fix/refined-subtypingodersky2015-01-311-0/+3
|\ | | | | Fix/refined subtyping
| * Cleanups prompted by reviews.Martin Odersky2015-01-281-2/+2
| |
| * Allow to merge TypeBounds and ClassInfos in |, &Martin Odersky2015-01-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | There seems to be no reason why we should not merge a class and an abstract type that has the class within its bounds. I.e. Assume class A { type T } class B { class T } Then (A | B) # T should be legal and refer to type T, and (A & B) # T should be legal and refer to class T.
* | make NoSymbol.associatedFile return NoSource.fileOndrej Lhotak2015-01-081-1/+3
| | | | | | | | Otherwise, associatedFile calls topLevelClass, which fails for NoSymbol.
* | Merge pull request #310 from dotty-staging/fix/#305-annot-bootstrapDmitry Petrashko2014-12-311-1/+1
|\ \ | |/ |/| Fix/#305 annot bootstrap
| * More careful usage of unforced decls in classes.Martin Odersky2014-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | 1) Rename `decls` to `unforcedDecls` to make it clear that it is danegrous to use. 2) Prefer `info.decls` over `unforcedDecls`. This fixes the problem reported in #305 where the primary constructor was not found.
* | Fixed #264 - failure to typecheck GADTsMartin Odersky2014-12-161-25/+0
|/ | | | | | | | | | | | The previous scheme derived the right bounds, but then failed to use them because a TypeRef already has a set info (its bounds). Changing the bounds in the symbol by a side effect does not affect that. This is good! But it showed that the previous scheme was too fragile because it used a sneaky side effect when updating the symbol info which failed to propgate into the cached info in TypeRef. We now keep GADT computed bounds separate form the symbol info in a map `gadt` in the current context.
* Change phase handling in enteredAfterMartin Odersky2014-12-141-8/+9
| | | | | This makes it more consistent with related methods ensureFreshScopeAfter, installAfter.
* Fix to TreeTypeMapMartin Odersky2014-10-261-3/+3
| | | | | | | Now handles the case where a class symbol itself is not changed by the map, but one of its declarations is. In this case we need to back out, and create new symbols for the class and all other symbols that are defined in the same scope as the class.
* TreeTypeMap needs to map declarations of mapped classesMartin Odersky2014-10-261-1/+1
| | | | | | | | ... and these mappings have to be part of the applied substitutions. Without the patch, the postCondition of FirstTransform fails for TreeInfo.scala and others, because it selects symbols which are not defined in the mapped class. Unrelated bugfix: JavaArray derives from Object.
* Better TreeTypeMapsMartin Odersky2014-09-131-4/+15
| | | | | | | | | | | | | | | | 1. They now keep track of changed constructors in templates, updating the class scope as for other members. 2. Any changed members are now entered into the new class scope at exactly the same position as the old one. That ensures that things like caseAccessors still work. 3. ChangeOwners now is reflected in the prefixes of any named types. 4. Newly created classes now get their own ClassInfo type. 5. TreeTypeMaps always crete "fresh" symbols. Fresh symbols do not share a NamedType reference with an existing reference to some other symbol. This obviates b2e0e7b4, which will be reverted. To make it work, the interface of TreeMap changed from an ownerMap function to a substitution-like data structure working with two lists.
* Refactored TreeTypeMapMartin Odersky2014-08-181-20/+12
| | | | Goes into a separate source files. Several simplifying refactorings.
* Fixes to TreeTypeMapMartin Odersky2014-08-181-8/+21
| | | | | | | | | (1) Template nodes have to be treated specially. They contain primary constructors, self definitions and local dummys, all of which have to be properly mapped and re-integrated. (2) Symbol substitutions have ot be done all together instead of one after the other. (3) When creating new symbols, need to create ClassSymbols for ClassSymbols.
* Package denotations are never transformedMartin Odersky2014-08-131-1/+5
| | | | | | | | | | | | Packages should always have a single denotation, which is invariant for all transformations. Package members should always be entered in the first phase, and should never be entered after a given phase. This reflects the fact that package members correspond to classfiles. Once you create a classfile, it stays around and is available from the start of the next run. Also, we need to prevent multiple denotation versions of packages from hanging on to stale symbols. It would not be enough to replace a package member by a newly compiled one; if packages had multiple denotations we'd have to do this for all of them.
* Fixed problem with missing denotations in polyDefDefMartin Odersky2014-07-171-0/+4
| | | | Problem was reported by @darkdimius. Test case will come in next commit.
* Make TypeParamCreation flags depend on ownerMartin Odersky2014-07-171-1/+1
| | | | | | Type params should have different flags, depending on whether they are owned by a method or a class. Only class type parameters are marked Deferred, protected, and Local.
* Move valueclass functionality into its own ValueClass module.Martin Odersky2014-07-171-8/+2
|
* Various cleanups and utility additionsMartin Odersky2014-07-171-4/+2
| | | | | | | - Some new functionality in tpd and in Symbols. - Added `sm` interpolator to print nicely. - Make use of nestedMap where possible. - Add IdentityDenotTransformer as a convencience class
* Added phase: SuperAccessorsMartin Odersky2014-07-171-0/+12
| | | | | Rewrote SuperAccessors (more to be done; see comments), and added stuff here and there to make it work smoother.
* Allow closures to take type parameters.Dmitry Petrashko2014-04-111-2/+2
| | | | | | | | This shouldn't require any changes to backend, as all type parameters will be erased in erasure Conflicts: src/dotty/tools/dotc/core/Symbols.scala