summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #5402 from som-snytt/issue/8040-unusedSeth Tisue2017-04-101-16/+18
|\ | | | | SI-8040 Improve unused warnings
| * SI-8040 Warn patvars in casedefsSom Snytt2017-03-111-20/+15
| | | | | | | | | | | | | | | | Collect bindings in casedefs unless "@-bound to _". Also minor refactor to make it easier to see the cases of `id @ _`. Tupled matching is supposed to be efficient either now or soon.
| * SI-8040 Warn unused flagsSom Snytt2017-03-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-8040 Heeding -Ywarn-unusedSom Snytt2017-03-111-3/+2
| | | | | | | | | | | | | | Polish notation, as in shoe-shine, as recommended by the warning. Minor clean-ups as advocated by `Ywarn-unused` and `Xlint`.
| * SI-8040 Warn unused pattern varsSom Snytt2017-03-111-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | Warn for unused `case X(x) =>` but, as an escape hatch, not for `case X(x @ _) =>`. The latter form is deemed documentary. (Named args could serve a similar purpose, `case X(x = _) =>`.) An attachment is used to mark the bound var, and the symbol position is used to correlate the identifier with the variable that is introduced. This mechanism doesn't work yet when only a single var is defined.
* | Fix Greek Mythology references in compiler packageJanek Bogucki2017-04-102-3/+3
|/ | | | | | | Improve documentation some packages and correct some typos in these directories, - compiler - library
* Revert "SI-10133 Require escaped single quote char lit"Adriaan Moors2017-02-211-18/+6
|
* Merge pull request #5629 from som-snytt/issue/10120-quote-errAdriaan Moors2017-02-201-6/+18
|\ | | | | SI-10133 Require escaped single quote char lit
| * SI-10120 Extra advice on unclosed char literalSom Snytt2017-01-081-6/+13
| | | | | | | | | | | | | | | | | | | | Folks from other languages might mistakenly enclose a string in single quotes. Since this presents as a symbol literal followed by the unpaired single quote, we can add a syntax reminder. Also polish the wording for bad string interpolation.
| * SI-10133 Require escaped single quote char litSom Snytt2017-01-081-0/+5
| | | | | | | | | | | | The spec specifically requires `'\''` and not `'''`. The error consumes all consecutive single quotes.
* | SI-10148 Accept verbose zeroSom Snytt2017-02-181-4/+4
| | | | | | | | The test for non-zero must recognize `-0e+00f` and variants.
* | Merge pull request #5648 from som-snytt/issue/10148Seth Tisue2017-02-162-8/+30
|\ \ | | | | | | SI-10148 Follow Java for float literals
| * | SI-10148 Follow Java for float literalsSom Snytt2017-01-182-8/+30
| |/ | | | | | | | | Use `Float.parseFloat` instead of converting from Double. Error when a value rounds to zero.
* | Merge pull request #5245 from dwijnand/trailing-commasAdriaan Moors2017-02-081-0/+11
|\ \ | | | | | | SI-4986 The glorious return of Comma McTraily
| * | SIP-27 Tweak and test wildstar in REPLDale Wijnand2017-01-081-2/+5
| | | | | | | | | | | | From https://github.com/scala/scala/pull/5245#issuecomment-266658070
| * | SI-4986 SIP-27 Trailing Comma (multi-line only) supportDale Wijnand2016-12-111-0/+8
| |/
* | SI-10097 Adapt unless -Xsource:2.13Som Snytt2016-12-141-3/+12
| | | | | | | | | | | | For 2.12 migration, insert missing case class param section, strip caseaccessor from implicit paramsection, and deprecate the adaptation.
* | SI-8704 Also warn if effectively multiple implicitSom Snytt2016-12-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | Current semantics are that leading implicit param turns the parameter section into an implicit section (though without making other params implicitly implicit). Warn if more than one head of a param section is implicit, since that results in multiple implicit param sections.
* | SI-8704 Error on bad implicit sectionsSom Snytt2016-12-141-13/+19
| | | | | | | | | | | | | | Instead of aborting when a class def has extra parameter section, take all parameter sections and sanity check the use of leading implicit to indicate an implicit parameter section.
* | SI-10097 Error if no non-implicit case class paramSom Snytt2016-12-141-5/+10
|/ | | | | | | | | | Case class must have a non-implicit param list. Error early, error often. Also update spec to say that class implicitly gets a non-implicit parameter section if it doesn't have one, and that a case class must have one.
* Merge pull request #5440 from som-snytt/issue/9944Lukas Rytz2016-11-161-2/+11
|\ | | | | SI-9944 Scan after interp expr keeps CR
| * SI-9944 Scan after interp expr keeps CRSom Snytt2016-10-011-2/+11
| | | | | | | | | | | | In an interpolated expression `s"""${ e }"""`, the scanner advances input past the RBRACE. If a multiline string as shown, get the next raw char, because CR is significant.
* | Factor out some more into ScaladocScannerAdriaan Moors2016-10-191-1/+1
| |
* | DocScanner has doc-comment scanning hooks.Adriaan Moors2016-10-191-15/+30
|/ | | | | | | Align the Scala and Java doc comment scanning methods a bit. The Scala one especially had gotten a bit messy, with regular block comments being kind of accumulated, but never actually registered as DocComments.
* Retain javadoc comments in scaladocJakob Odersky2016-07-151-1/+1
| | | | | * Hook into java parser to generate doc comments * Generate empty trees for java implementation bodies
* Merge commit '91b6944' into merge-2.11-to-2.12-june-19Lukas Rytz2016-06-191-1/+1
|\
| * SI-9245 Fresher name in Try and testSom Snytt2016-06-071-1/+1
| | | | | | | | | | | | | | | | Fresh name for catcher gets a dollar. "Here, have a dollar." Test due to retronym demonstrates possible conflict. Over the lifetime of the universe, surely at least one code monkey would type in that identifier to catch a banana.
* | Merge commit 'cba585d' into merge-2.11-to-2.12-june-1Lukas Rytz2016-06-011-44/+64
|\|
| * SI-4625 Warn on first non-toplevel onlySom Snytt2016-05-171-42/+46
| | | | | | | | | | | | Fixed the warning when main module is accompanied by snippets. Minor clean-up so even I can follow what is returned.
| * SI-4625 Warn when discarding script objectSom Snytt2016-05-171-4/+11
| | | | | | | | | | | | It's pretty confusing when your script object becomes a local and then nothing happens. Such as when you're writing a test and it takes forever to figure out what's going on.
| * SI-4625 Permit arbitrary top-level in scriptSom Snytt2016-05-161-1/+3
| | | | | | | | | | | | | | In an unwrapped script, where a `main` entry point is discovered in a top-level object, retain all top-level classes. Everything winds up in the default package.
| * SI-4625 App is a thingSom Snytt2016-05-161-1/+4
| | | | | | | | Scripting knows it by name.
| * SI-4625 Recognize App in scriptSom Snytt2016-05-161-1/+5
| | | | | | | | | | | | | | | | | | Cheap name test: if the script object extends "App", take it for a main-bearing parent. Note that if `-Xscript` is not `Main`, the default, then the source is taken as a snippet and there is no attempt to locate an existing `main` method.
* | Add since arg to deprecationWarning and use itSimon Ochsenreither2016-05-292-18/+18
| |
* | Merge pull request #4935 from som-snytt/issue/8044-tickvarAdriaan Moors2016-05-241-8/+8
|\ \ | | | | | | SI-8044 Allow binding backquoted varid in patterns
| * | SI-8044 Allow any id in explicit pattern bindingSom Snytt2016-05-201-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allows arbitrary identifier in `X @ pat`, including non-varids. This goes to regularity. Users of this syntax are not likely to be confused by the "backquoted var id is stable" rule. Also for sequence pattern, `X @ _*`.
| * | SI-8044 Allow binding backquoted varid in patternsSom Snytt2016-05-201-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, a varid could not be backquoted, so that it was not possible to introduce variables with names such as `type` in a match expression. This commit allows backquoted varids in `case x @ _` and `case x: Int`. In neither position is a stable id accepted, that is, an id with leading uppercase. Therefore, this commit merely relaxes the backquoted varid to be taken as a normal varid in these contexts.
* | | Merge pull request #4988 from som-snytt/issue/backtick-barAdriaan Moors2016-05-201-2/+2
|\ \ \ | |/ / |/| | SI-9665 Backquoted vbar in extractor pattern
| * | SI-9665 Backquoted vbar in extractor patternSom Snytt2016-03-151-2/+2
| | | | | | | | | | | | Allow an infix extractor named `|`, when backquoted.
* | | Keep Function when CBN arg thunk targets a SAMAdriaan Moors2016-03-302-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The body of `def delay[T](v: => T) = (v _): F0[T]` becomes `() => v` during `typedEta`, and then uncurry considers whether to strip the function wrapper since `v` is known to be a `Function0` thunk. Stripping is sound when the expected type is `Function0` for this expression, but that's no longer a given, since we could be expecting any nullary SAM. Also sweep up a bit around `typedEta`. Encapsulate the, erm, creative encoding of `m _` as `Typed(m, Function(Nil, EmptyTree))`.
* | | Remove -Y settings that are no longer used in 2.12Lukas Rytz2016-02-161-5/+0
|/ / | | | | | | | | | | Added a deprecation warning for `-optimize`. Later we'll also graduate `-Yopt` to `-opt`, probably for 2.12.0-M5.
* | Merge commit 'cc6fea6' into merge/2.11.x-to-2.12.x-20160203Jason Zaugg2016-02-042-35/+54
|\| | | | | | | | | | | Conflicts: build.sbt scripts/jobs/integrate/bootstrap
| * SI-9572 Check for illegal tuple sizes in the parserStefan Zeiger2016-01-282-35/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds explicit checks with syntax errors for tuple literals and types of more than 22 elements. An alternative approach to fixing SI-9572 would be to revert to the old failure mode of Scala 2.10 where references to arbitrary `scala.TupleXY` would be generated in the parser, which then leads to “type/object not found” errors in the typechecker. This fix here is more intrusive but arguably provides a better user experience. Methods `stripParens` and `makeBinop` are moved from `TreeBuilder` to `Parsers` because they can now generate syntax errors. New methods `makeSafeTupleType` and `makeSafeTupleTerm` implement the error checking on top of `makeTupleType` and `makeTupleTerm`. They are overridden with no-op versions in the quasiquotes parser because it also overrides `makeTupleType` and `makeTupleTerm` in a way that supports arbitrary tuple sizes.
* | Remove unused imports and other minor cleanupsSimon Ochsenreither2015-12-185-8/+6
| | | | | | | | | | | | | | | | | | | | - Language imports are preceding other imports - Deleted empty file: InlineErasure - Removed some unused private[parallel] methods in scala/collection/parallel/package.scala This removes hundreds of warnings when compiling with "-Xlint -Ywarn-dead-code -Ywarn-unused -Ywarn-unused-import".
* | Merge commit 'bb3ded3' into merge-2.11-to-2.12-oct-5Lukas Rytz2015-10-051-2/+8
|\|
| * Improve presentation compilation of annotationsJason Zaugg2015-09-241-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A trio of problems were hampering autocompletion of annotations. First, given that that annotation is written before the annotated member, it is very common to end parse incomplete code that has a floating annotation without an anotatee. The parser was discarding the annotations (ie, the modifiers) and emitting an `EmptyTree`. Second, the presetation compiler was only looking for annotations in the Modifiers of a member def, but after typechecking annotations are moved into the symbol. Third, if an annotation failed to typecheck, it was being discarded in place of `ErroneousAnnotation`. This commit: - modifies the parser to uses a dummy class- or type-def tree, instead of EmptyTree, which can carry the annotations. - updates the locator to look in the symbol annotations of the modifiers contains no annotations. - uses a separate instance of `ErroneousAnnotation` for each erroneous annotation, and stores the original tree in its `original` tree.
* | Merge commit 'a170c99' into 2.12.xLukas Rytz2015-09-223-0/+0
|\|
| * unset inappropriate execute bitsSeth Tisue2015-09-023-0/+0
| | | | | | | | | | | | | | | | | | | | I imagine these date back to old Subversion days and are probably the result of inadvertent commits from Windows users with vcs client configs. having the bit set isn't really harmful most of the time, but it's just not right, and it makes the files stand out in directory listings for no reason
| * Fix typo in the name of a private methodMichał Pociecha2015-08-231-5/+5
| | | | | | | | Since it's a private method, it's safe to just rename it.
* | Merge remote-tracking branch 'origin/2.11.x' into 2.12.xSeth Tisue2015-09-081-5/+5
| | | | | | | | | | | | | | | | only trivial merge conflicts here. not dealing with PR #4333 in this merge because there is a substantial conflict there -- so that's why I stopped at 63daba33ae99471175e9d7b20792324615f5999b for now