Skip to content

Fix #2334: Require at least one digit after '.' in floating point literals #2336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
May 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1d2b605
Address reviewers comments
odersky Apr 28, 2017
98e26ab
Revise qualified names
odersky Mar 30, 2017
debdafa
Use unencoded names internally
odersky Apr 4, 2017
1d97865
Avoid forcing diagnostic message in ErrorType
odersky Apr 4, 2017
927ff02
var -> val
odersky Apr 4, 2017
150b714
Don't decode when unpickling tasty
odersky Apr 7, 2017
4cdc388
Invalide fullName cache when name changes
odersky Apr 7, 2017
5f43d27
Eagerly update names of package members when one looks for
odersky Apr 7, 2017
5875a7b
Fix compilation failure in LambdaLift
odersky Apr 7, 2017
e5435ac
More lenient checking of name mismatches in ClassfileParser
odersky Apr 7, 2017
0311cc5
Avoid unnecessary decodes
odersky Apr 7, 2017
bdfd861
Better support for debugging
odersky Apr 7, 2017
3744d70
Make encode and decode have more precise types
odersky Apr 7, 2017
b4e8419
Decode names of package members on enter
odersky Apr 7, 2017
0d8e15c
Drop isSimple requirement for unmangling expanded names
odersky Apr 7, 2017
15ff616
Polishing and better documentation of Names.scala
odersky Apr 7, 2017
815c36f
Rename SimpleTermName -> SimpleName, DerivedTermName -> DerivedName
odersky Apr 7, 2017
5b17a44
Polish and document NameKinds
odersky Apr 8, 2017
f0f3ebd
Update TastyFormat documentation
odersky Apr 8, 2017
2dc02b5
Compare unmangled name when searching for roots
odersky Apr 8, 2017
8e0c2f2
Use effectiveScope when creating companionLinks
odersky Apr 8, 2017
bb88d41
Some further polishings
odersky Apr 8, 2017
2005cd9
Fix rebase breakage
odersky Apr 27, 2017
e7b2325
Optimized scheme for mangling strings
odersky Apr 28, 2017
1ada92b
Fix converting Prefix/Suffix names to strings
odersky Apr 28, 2017
b6b744a
Fix test to use symbolic names
odersky Apr 28, 2017
1c48cdb
Fix #2334: Require at least one digit after '.' in floating point lit…
odersky May 1, 2017
a26d0de
Fix -Xprompt behavior
odersky May 1, 2017
72daf5c
Fix error message handling
odersky May 1, 2017
727e904
Don't report "not found" messages when we are looking for <error>.
odersky May 1, 2017
fcf2168
Fix positition of error in neg test
odersky May 1, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
toDenot(sym)(shiftedContext).isStatic(shiftedContext)
}

def isStaticConstructor: Boolean = (isStaticMember && isClassConstructor) || (sym.name eq core.Names.STATIC_CONSTRUCTOR)
def isStaticConstructor: Boolean = (isStaticMember && isClassConstructor) || (sym.name eq nme.STATIC_CONSTRUCTOR)


// navigation
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/core/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class Definitions {
}

private def newMethod(cls: ClassSymbol, name: TermName, info: Type, flags: FlagSet = EmptyFlags): TermSymbol =
newSymbol(cls, name.encode, flags | Method, info).asTerm
newSymbol(cls, name, flags | Method, info).asTerm

private def enterMethod(cls: ClassSymbol, name: TermName, info: Type, flags: FlagSet = EmptyFlags): TermSymbol =
newMethod(cls, name, info, flags).entered
Expand Down Expand Up @@ -301,7 +301,7 @@ class Definitions {
lazy val ScalaPredefModuleRef = ctx.requiredModuleRef("scala.Predef")
def ScalaPredefModule(implicit ctx: Context) = ScalaPredefModuleRef.symbol

lazy val Predef_ConformsR = ScalaPredefModule.requiredClass("$less$colon$less").typeRef
lazy val Predef_ConformsR = ScalaPredefModule.requiredClass("<:<").typeRef
def Predef_Conforms(implicit ctx: Context) = Predef_ConformsR.symbol
lazy val Predef_conformsR = ScalaPredefModule.requiredMethodRef("$conforms")
def Predef_conforms(implicit ctx: Context) = Predef_conformsR.symbol
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Denotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ object Denotations {
select(recur(prefix), wrap(selector))
case qn @ AnyQualifiedName(prefix, _) =>
recur(prefix, n => wrap(qn.info.mkString(n).toTermName))
case path: SimpleTermName =>
case path: SimpleName =>
def recurSimple(len: Int, wrap: TermName => Name): Denotation = {
val point = path.lastIndexOf('.', len - 1)
val selector = wrap(path.slice(point + 1, len).asTermName)
Expand Down
156 changes: 112 additions & 44 deletions compiler/src/dotty/tools/dotc/core/NameKinds.scala

Large diffs are not rendered by default.

33 changes: 22 additions & 11 deletions compiler/src/dotty/tools/dotc/core/NameOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ object NameOps {
implicit class NameDecorator[N <: Name](val name: N) extends AnyVal {
import nme._

def testSimple(f: SimpleTermName => Boolean): Boolean = name match {
case name: SimpleTermName => f(name)
def testSimple(f: SimpleName => Boolean): Boolean = name match {
case name: SimpleName => f(name)
case name: TypeName => name.toTermName.testSimple(f)
case _ => false
}
Expand Down Expand Up @@ -83,7 +83,7 @@ object NameOps {
def isOpAssignmentName: Boolean = name match {
case raw.NE | raw.LE | raw.GE | EMPTY =>
false
case name: SimpleTermName =>
case name: SimpleName =>
name.length > 0 && name.last == '=' && name.head != '=' && isOperatorPart(name.head)
case _ =>
false
Expand All @@ -100,8 +100,10 @@ object NameOps {
* it is also called from the backend.
*/
def stripModuleClassSuffix: N = likeSpaced {
val semName =
if (name.isSimple && name.endsWith("$")) name.unmangleClassName else name
val semName = name.toTermName match {
case name: SimpleName if name.endsWith("$") => name.unmangleClassName
case _ => name
}
semName.exclude(ModuleClassName)
}

Expand All @@ -126,15 +128,24 @@ object NameOps {

def errorName: N = likeSpaced(name ++ nme.ERROR)

/** Map variance value -1, +1 to 0, 1 */
private def varianceToNat(v: Int) = (v + 1) / 2

/** Map 0, 1 to variance value -1, +1 */
private def natToVariance(n: Int) = n * 2 - 1

/** Name with variance prefix: `+` for covariant, `-` for contravariant */
def withVariance(v: Int): N =
likeSpaced { VariantName(name.exclude(VariantName).toTermName, v) }
def withVariance(v: Int): N = {
val underlying = name.exclude(VariantName)
likeSpaced(
if (v == 0) underlying
else VariantName(underlying.toTermName, varianceToNat(v)))
}

/** The variance as implied by the variance prefix, or 0 if there is
* no variance prefix.
*/
def variance = name.collect { case VariantName(_, n) => n }.getOrElse(0)
def variance = name.collect { case VariantName(_, n) => natToVariance(n) }.getOrElse(0)

def freshened(implicit ctx: Context): N = likeSpaced {
name.toTermName match {
Expand Down Expand Up @@ -227,19 +238,19 @@ object NameOps {
def compactified(implicit ctx: Context): TermName = termName(compactify(name.toString))

def unmangleClassName: N = name.toTermName match {
case name: SimpleTermName
case name: SimpleName
if name.endsWith(str.MODULE_SUFFIX) && !nme.falseModuleClassNames.contains(name) =>
likeSpaced(name.dropRight(str.MODULE_SUFFIX.length).moduleClassName)
case _ => name
}

def unmangle(kind: NameKind): N = likeSpaced {
name rewrite {
case unmangled: SimpleTermName =>
case unmangled: SimpleName =>
kind.unmangle(unmangled)
case ExpandedName(prefix, last) =>
kind.unmangle(last) rewrite {
case kernel: SimpleTermName =>
case kernel: SimpleName =>
ExpandedName(prefix, kernel)
}
}
Expand Down
Loading