summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala
Commit message (Collapse)AuthorAgeFilesLines
* SI-8040 Warn unused flagsSom Snytt2017-03-111-1/+1
| | | | | | | | | | | | | | | | Introduce `-Ywarn-unused:x,y,z` and exploit `-Ywarn-unused:patvars`. Although the tree attachment for shielding patvars from warnings is not structural, sneaking the settings flag into the reflection internal TreeGen is awkward. Add test to ensure isolation of patvars warning from others. `-Ywarn-unused-import` is an alias for `-Ywarn-unused:imports`. `-Xlint:unused` is an alias for `-Ywarn-unused`, but not enabled yet. The help text advises to use `-Ywarn-unused`. The future can decide if `-Xlint:unused-imports` is warranted.
* SI-7707 SI-7712 Exclude unused warnings from -XlintJason Zaugg2014-02-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | Experience building open source projects like Specs that use `-Xlint` suggests that this warning is too noisy to lump in with the others. We are lacking in more fine-grained control of these things, so simply turning of `-Xlint` in favour of its underlying `-Y` options ends up *losing* some other important warnings that are predicated directly on `-Xlint`. Furthermore, bug reports against M8, SI-7707 SI-7712, show that unused private/local warnings, while far less noisy, are still in need of polish. This commit moves these warnings to a pair of new -Y options, neither of which is part of `-Xlint`.. Let's ask people to opt in for 2.11, and as it stabilizes, we can consider adding it to Xlint (or the desirable evolution of that) in the next release.
* SI-7174 Fix initialization issuesSimon Ochsenreither2013-07-061-4/+7
| | | | | | | | | | | | | Without constant inlining, the compiler would not even bootstrap because it depends on constant inlining hiding initialization issues which would cause a NPE otherwise. In this case, global is null at runtime, but no NPE is happening despite accessing members of global (see SubComponent), because constant inlining has copied the values of those members to the call-sites and eliminated the dereference of global. This commit fixes the initialization order.
* SI-7261 Implicit conversion of BooleanSetting to Boolean and BooleanFlagSom Snytt2013-03-271-2/+2
| | | | | | | This commit shortens expressions of the form `if (settings.debug.value)` to `if (settings.debug)` for various settings. Rarely, the setting is supplied as a method argument. The conversion is not employed in simple definitions where the Boolean type would have to be specified.
* Merge commit 'f3cdf146709e0dd98533ee77e8ca2566380cb932'Lukas Rytz2013-02-041-0/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/typechecker/Contexts.scala src/compiler/scala/tools/nsc/typechecker/Namers.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala src/reflect/scala/reflect/internal/AnnotationCheckers.scala src/reflect/scala/reflect/internal/Symbols.scala
| * Analyzer PluginsLukas Rytz2013-02-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AnnotationCheckers are insufficient because they live outside the compiler cake and it's not possible to pass a Typer into an annotation checker. Analyzer plugins hook into important places of the compiler: - when the namer assigns a type to a symbol (plus a special hook for accessors) - before typing a tree, to modify the expected type - after typing a tree, to modify the type assigned to the tree Analyzer plugins and annotation checker can be activated only during selected phases of the compiler. Refactored the CPS plugin to use an analyzer plugin (since adaptToAnnotations is now part of analyzer plugins, no longer annotation checkers).
* | Moved Variances into SymbolTable.Paul Phillips2013-01-091-1/+0
| | | | | | | | So I can centralize all the redundant variance code.
* | Merge commit 'refs/pull/1574/head' into merge-210Paul Phillips2012-11-051-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'refs/pull/1574/head': (24 commits) Fixing issue where OSGi bundles weren't getting used for distribution. Fixes example in Type.asSeenFrom Fix for SI-6600, regression with ScalaNumber. SI-6562 Fix crash with class nested in @inline method Brings copyrights in Scaladoc footer and manpage up-to-date, from 2011/12 to 2013 Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013 SI-6606 Drops new icons in, replaces abstract types placeholder icons SI-6132 Revisited, cleaned-up, links fixed, spelling errors fixed, rewordings Labeling scala.reflect and scala.reflect.macros experimental in the API docs Typo-fix in scala.concurrent.Future, thanks to @pavelpavlov Remove implementation details from Position (they are still under reflection.internal). It probably needs more cleanup of the api wrt to ranges etc but let's leave it for later SI-6399 Adds API docs for Any and AnyVal Removing actors-migration from main repository so it can live on elsewhere. Fix for SI-6597, implicit case class crasher. SI-6578 Harden against synthetics being added more than once. SI-6556 no assert for surprising ctor result type Removing actors-migration from main repository so it can live on elsewhere. Fixes SI-6500 by making erasure more regular. Modification to SI-6534 patch. Fixes SI-6559 - StringContext not using passed in escape function. ... Conflicts: src/actors-migration/scala/actors/migration/StashingActor.scala src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala src/compiler/scala/tools/nsc/settings/AestheticSettings.scala src/compiler/scala/tools/nsc/transform/Erasure.scala src/library/scala/Application.scala src/library/scala/collection/immutable/GenIterable.scala.disabled src/library/scala/collection/immutable/GenMap.scala.disabled src/library/scala/collection/immutable/GenSeq.scala.disabled src/library/scala/collection/immutable/GenSet.scala.disabled src/library/scala/collection/immutable/GenTraversable.scala.disabled src/library/scala/collection/mutable/GenIterable.scala.disabled src/library/scala/collection/mutable/GenMap.scala.disabled src/library/scala/collection/mutable/GenSeq.scala.disabled src/library/scala/collection/mutable/GenSet.scala.disabled src/library/scala/collection/mutable/GenTraversable.scala.disabled src/library/scala/collection/parallel/immutable/ParNumericRange.scala.disabled
| * Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013Heather Miller2012-11-021-1/+1
| |
* | Warn about unused private members.Paul Phillips2012-11-011-3/+6
| | | | | | | | | | | | | | | | Warnings enabled via -Xlint. It's one of the most requested features. And it is hard to argue we don't need it: see the 99 methods removed in the next commit. This should close SI-440.
* | Merge remote-tracking branch 'origin/2.10.x' into merge-210Paul Phillips2012-09-151-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * origin/2.10.x: (68 commits) Eliminate breaking relative names in source. "Hot fix" for broken build. Fix SI-4813 - Clone doesn't work on LinkedList. Made 'def clone()' consistent with parens everywhere. accommodates pull request feedback SI-6310 redeploys the starr SI-6310 AbsTypeTag => WeakTypeTag SI-6323 outlaws free types from TypeTag SI-6323 prohibits reflection against free types improvements for reification of free symbols removes build.newFreeExistential SI-6359 Deep prohibition of templates in value class Fixes SI-6259. Unable to use typeOf in super call of top-level object. Fixes binary repo push for new typesafe repo layouts. Better error message for pattern arity errors. Rescued TreeBuilder from the parser. Pending test for SI-3943 Test case for a bug fixed in M7. Fix for SI-6367, exponential time in inference. SI-6306 Remove incorrect eta-expansion optimization in Uncurry ... Conflicts: src/compiler/scala/tools/nsc/transform/AddInterfaces.scala src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
| * Eliminate breaking relative names in source.Paul Phillips2012-09-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These things are killing me. Constructions like package scala.foo.bar.baz import foo.Other DO NOT WORK in general. Such files are not really in the "scala" package, because it is not declared package scala package foo.bar.baz And there is a second problem: using a relative path name means compilation will fail in the presence of a directory of the same name, e.g. % mkdir reflect % scalac src/reflect/scala/reflect/internal/util/Position.scala src/reflect/scala/reflect/internal/util/Position.scala:9: error: object ClassTag is not a member of package reflect import reflect.ClassTag ^ src/reflect/scala/reflect/internal/util/Position.scala:10: error: object base is not a member of package reflect import reflect.base.Attachments ^ As a rule, do not use relative package paths unless you have explicitly imported the path to which you think you are relative. Better yet, don't use them at all. Unfortunately they mostly work because scala variously thinks everything scala.* is in the scala package and/or because you usually aren't bootstrapping and it falls through to an existing version of the class already on the classpath. Making the paths explicit is not a complete solution - in particular, we remain enormously vulnerable to any directory or package called "scala" which isn't ours - but it greatly limts the severity of the problem.
* | Clear undo log after each unit has been type-checked to prevent 300M memory ↵Eugene Vigdorchik2012-09-031-4/+4
|/ | | | lost in scaladoc. Review by @adriaanm.
* Made all statistic code disappear unless built with Statistics.canEnable = trueMartin Odersky2012-08-201-2/+2
|
* update and normalize copyright noticeAdriaan Moors2012-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are the regexp replacements performed: Sxcala -> Scala Copyright (\d*) LAMP/EPFL -> Copyright $1-2012 LAMP/EPFL Copyright (\d*)-(\d*)(,?) LAMP/EPFL -> Copyright $1-2012 LAMP/EPFL Copyright (\d*)-(\d*) Scala Solutions and LAMP/EPFL -> Copyright $1-2012 Scala Solutions and LAMP/EPFL \(C\) (\d*)-(\d*) LAMP/EPFL -> (C) $1-2012 LAMP/EPFL Copyright \(c\) (\d*)-(\d*)(.*?)EPFL -> Copyright (c) $1-2012$3EPFL The last one was needed for two HTML-ified copyright notices. Here's the summarized diff: Created using ``` git diff -w | grep ^- | sort | uniq | mate git diff -w | grep ^+ | sort | uniq | mate ``` ``` - <div id="footer">Scala programming documentation. Copyright (c) 2003-2011 <a href="http://www.epfl.ch" target="_top">EPFL</a>, with contributions from <a href="http://typesafe.com" target="_top">Typesafe</a>.</div> - copyright.string=Copyright 2002-2011, LAMP/EPFL - <meta name="Copyright" content="(C) 2002-2011 LAMP/EPFL"/> - * Copyright 2002-2011 LAMP/EPFL - * Copyright 2004-2011 LAMP/EPFL - * Copyright 2005 LAMP/EPFL - * Copyright 2005-2011 LAMP/EPFL - * Copyright 2006-2011 LAMP/EPFL - * Copyright 2007 LAMP/EPFL - * Copyright 2007-2011 LAMP/EPFL - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL - * Copyright 2009-2011 Scxala Solutions and LAMP/EPFL - * Copyright 2010-2011 LAMP/EPFL - * Copyright 2012 LAMP/EPFL -# Copyright 2002-2011, LAMP/EPFL -* Copyright 2005-2011 LAMP/EPFL -/* NSC -- new Scala compiler -- Copyright 2007-2011 LAMP/EPFL */ -rem # Copyright 2002-2011, LAMP/EPFL ``` ``` + <div id="footer">Scala programming documentation. Copyright (c) 2003-2012 <a href="http://www.epfl.ch" target="_top">EPFL</a>, with contributions from <a href="http://typesafe.com" target="_top">Typesafe</a>.</div> + copyright.string=Copyright 2002-2012 LAMP/EPFL + <meta name="Copyright" content="(C) 2002-2012 LAMP/EPFL"/> + * Copyright 2002-2012 LAMP/EPFL + * Copyright 2004-2012 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL + * Copyright 2010-2012 LAMP/EPFL + * Copyright 2011-2012 LAMP/EPFL +# Copyright 2002-2012 LAMP/EPFL +* Copyright 2005-2012 LAMP/EPFL +/* NSC -- new Scala compiler -- Copyright 2007-2012 LAMP/EPFL */ +rem # Copyright 2002-2012 LAMP/EPFL ```
* Statistics reorganizationMartin Odersky2012-06-191-3/+4
| | | | | Statistics were broken since the move to reflect.internal. They are now re-organized, made more robost and modular.
* fixes SI-5693Eugene Burmako2012-04-251-0/+1
|
* Use context for buffering errors that cannot/shouldn't be reported in the ↵Hubert Plociniczak2012-01-251-0/+1
| | | | | | | | given moment (instead of throwing type errors). This avoids previous problems where we were creating fake error trees in some incorrect places like in type completers in Namers etc. Implicits relied heavily on type errors being thrown but performance should stay the same due to some explicit checks/returns. Some of the problems involved how ambiguous error messages were collected/reported because it was very random (similarly for divergent implicits). This should be more explicit now. Reduced the number of unnecessary cyclic references being thrown (apart from those in Symbols/Types which don't have a context and need to stay for now as is). Review by @paulp, @odersky.
* Experimental version of macro definitions.Martin Odersky2011-11-281-0/+1
|
* Back to square one.Hubert Plociniczak2011-09-231-1/+0
| | | | | | | | | | | | | | Current design of error trees complicates the design of reflection library, and introduces sometimes unnecessary boilerplate and since I do not want to stall that work I am reverting all the changes related to error trees. A different design is currently under consideration but work will be done on separate branch on github. Revisions that got reverted: r25705, r25704 (partially), r25673, r25669, r25649, r25644, r25621, r25620, r25619 Review by odersky and extempore.
* First refactoring related to Error trees.Hubert Plociniczak2011-09-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There are no more direct calls to context.error from Typers and Infer, so more work needs to be done to finish it for Implicits and Namers. I am pushing it to trunk so that all of you can share my pain (and complain). Please do not add any more context.error randomly in that code, instead deal with it appropriately (by creating specific error tree). I was trying to be as informative when it comes to error tree names as possible, but if you feel like changing names to something more appropriate then feel free to do so. When it comes to printing error messages I tried to follow test suite as closily as possible but obviously there were few changes to some tests (mostly positive, I believe). On my machine performance drawback was neglible but I am working on more aggressive caching to reduce the penalty of containsError() calls even more. Any suggestions welcome. At the moment the code supports both styles i.e. throwing type errors for the cases that are not yet handled and generating error trees. But in the future we will drop the former completely (apart from cyclic errors which can pop up almost everywhere). Review by odersky, extempore and anyone who feels like it.
* Added package object support to reflection fram...Martin Odersky2011-08-291-1/+1
| | | | | | Added package object support to reflection framework. Removed debug output and made some speed improvements.
* I wrote a warning when nullary methods return U...Paul Phillips2011-04-281-1/+1
| | | | | | | | | | | | | | | I wrote a warning when nullary methods return Unit. I wimped out of including it in this patch because we had about 200 of them, and that's what is fixed in this patch. I will add the warning to some kind of "-Xlint" feature after 2.9. This is motivated at least partly by the resolution of #4506, which indicates the distinction between "def foo()" and "def foo" will continue to jab its pointy stick into our eyes, so I believe we have a minimal duty of at least following our own advice about what they mean and not making a semirandom choice as to whether a method has parens or not. Review by community.
* Updated copyright notices to 2011Antonio Cunei2011-01-201-1/+1
|
* Added some more debugging tools for printing ty...Paul Phillips2011-01-041-2/+0
| | | | | | Added some more debugging tools for printing types. Squirrelled it away in a type debugging trait. No review.
* Added withFilter to the list of monadic method ...Paul Phillips2010-12-281-0/+2
| | | | | | Added withFilter to the list of monadic method names: otherwise the inliner doesn't recognize its attractiveness. No review.
* The undoLog is being cleared before a typer run...Paul Phillips2010-12-221-0/+7
| | | | | | | The undoLog is being cleared before a typer run, but not afterward. This meant a huge amount of unnecessary garbage persisted beyond typer. Now, more clearing. Review by moors.
* presentation compiler hardenings.Martin Odersky2010-10-291-1/+1
|
* While trying to come to an understanding with #...Paul Phillips2010-09-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | While trying to come to an understanding with #3869 I had one of those "what are we doing" moments regarding the reams of output generated under -Ydebug. We have all these places where extra info is logged under -Ydebug -- like "if (debug) log(...)" -- and if you try for those you are also saddled with all these irrelevant places which instead say if (debug) Console.println(...). I changed about every one of them to send it to log() instead. So if you were enjoying that 600 MB of debugging output when you compile "goodbye world", you can have it back and then some with -Ylog:all. Until then, enjoy the calm, quiet competence of the new -Ydebug. Also herein: raised default ANT_OPTS permgen because I can no longer build a dist with the former defaults, and gave some synthetics a better home in StdNames. No review (but if anyone just can't live without some particular piece of output every single time -Ydebug is given, I can put it back.)
* Bringing the tree and icode checkers back to life.Paul Phillips2010-09-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | build/pack/bin/scalac -d /tmp -Ycheck-debug -Ycheck:all \ src/compiler/scala/tools/nsc/Global.scala That blows up in constructors as most files do, so also try it with -Ycheck:icode to see the pretty icode output (for a little while anyway, after which it will again blow up.) Our work has only just begun! See test/checker-tests/fail*.scala for 11 examples of places where the checker cries foul. Many of them are telling us about real issues and we should listen, but I will need help to figure out which are legitimate and which should be eliminated by altering the checkers. This patch also hacks on some territory the checkers drew me into, especially TypeKinds, where I figured anything which had been commented out since 2005 was fair game. (Optional) review by dragos. (The one place I know I could use a look is in Checkers.scala, because I had to relax some checks and add at least one newer opcode.)
* Imporved printing of private[C] in TreePrinters.Martin Odersky2010-06-161-1/+1
|
* Removed more than 3400 svn '$Id' keywords and r...Antonio Cunei2010-05-121-1/+0
| | | | | Removed more than 3400 svn '$Id' keywords and related junk.
* Created TypeDiagnostics trait and have begun op...Paul Phillips2010-04-271-0/+1
| | | | | | | | | | | Created TypeDiagnostics trait and have begun opportunistically moving code into it. Along the way, some improvements to error messages. The situation described in ticket #2206 has always had an applicable error message, but it wasn't making it out to the user. More kinds of ambiguity are disambiguated, see the test cases. And overload errors are printed with some formatting so one has some hope of parsing. Review by odersky.
* Changed default of 'keepsTypeParams' to true. AllIulian Dragos2010-04-091-0/+3
| | | | | | phases that may change type parameters have to explicitly override this method.
* Added extensive statistics, reduced time of imp...Martin Odersky2010-01-041-5/+4
| | | | | | Added extensive statistics, reduced time of implicit resolution by 2/3rds, of whole typer by 1/4 to 1/3rd.
* fixes #2610 and fixes #2687.Lukas Rytz2009-12-111-1/+27
|
* Updated copyright notices to 2010Antonio Cunei2009-12-071-1/+1
|
* Fix and test for #1674; we aren't supposed to b...Miles Sabin2009-10-191-1/+1
| | | | | | | Fix and test for #1674; we aren't supposed to be validating positions if there are syntax errors ... ensure that's so; we are supposed to be validating positions when -Yide-debug is set ... ensure that's so.
* rewrite of positions in compilerMartin Odersky2009-07-301-0/+1
|
* switch to unnested packages.Martin Odersky2009-07-241-1/+2
|
* Trying to make typechecker faster by (1) new su...Martin Odersky2009-07-131-27/+3
| | | | | | | Trying to make typechecker faster by (1) new subtyping (2) better implicit caches. Disallowed '42 as a symbol. Added cache method to Mutable Maps. Better complietion in interactive.
* Named and default argumentsLukas Rytz2009-05-301-0/+1
| | | | | | | - MethodTypes now have (params: List[Symbol]) - "copy"-methods for case classes - the "copy" object in the compiler is now called "treeCopy"
* some documentation; statistics wrt implicits; n...Martin Odersky2009-05-221-0/+32
| | | | | some documentation; statistics wrt implicits; new presentation compiler
* Unreasonably satisfying patch which sets immuta...Paul Phillips2009-05-201-1/+1
| | | | | | Unreasonably satisfying patch which sets immutable final val inIDE = false and then performs dead code elimination (human style.)
* Let package object members override package dir...Martin Odersky2009-03-131-0/+1
| | | | | | | Let package object members override package directory members; plus improvements that allow bottstrapping with a package object scala. Refactored implicits.
* Compiler implementation of SIP 00002 and fixes ...nielsen2009-02-051-0/+4
| | | | | | Compiler implementation of SIP 00002 and fixes for tests and other tools like scaladoc
* Updated (all) copyright notices to 2009Antonio Cunei2009-01-131-1/+1
|
* fixed erroneous cyclic reference error conditio...Martin Odersky2009-01-081-1/+6
| | | | | fixed erroneous cyclic reference error condition; generated new starr.
* Phases now have a checkable flag, used by the n...Geoffrey Washburn2008-09-031-0/+1
| | | | | Phases now have a checkable flag, used by the new -Ycheck:all option.
* Fixing problem with case classes and companion ...Sean McDirmid2008-06-041-1/+1
| | | | | Fixing problem with case classes and companion objects