aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2015-05-09 21:33:19 +0200
committerGuillaume Martres <smarter@ubuntu.com>2015-05-09 21:33:19 +0200
commit37851350754403323b26c0c32417cbecc0c44584 (patch)
treef7269a8eb348a1d450117e7d71ede6afcb2aeff3 /src/dotty/tools
parenta1790ebc08d8498f86440cd0534343b11319fc6d (diff)
downloaddotty-37851350754403323b26c0c32417cbecc0c44584.tar.gz
dotty-37851350754403323b26c0c32417cbecc0c44584.tar.bz2
dotty-37851350754403323b26c0c32417cbecc0c44584.zip
rename isSourceMethod to isRealMethod, the previous name was inaccurate
Diffstat (limited to 'src/dotty/tools')
-rw-r--r--src/dotty/tools/dotc/ast/CheckTrees.scala.disabled2
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala8
-rw-r--r--src/dotty/tools/dotc/transform/ValueClasses.scala2
-rw-r--r--src/dotty/tools/dotc/typer/Checking.scala2
-rw-r--r--src/dotty/tools/dotc/typer/RefChecks.scala6
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala2
6 files changed, 13 insertions, 9 deletions
diff --git a/src/dotty/tools/dotc/ast/CheckTrees.scala.disabled b/src/dotty/tools/dotc/ast/CheckTrees.scala.disabled
index 254f002c1..255619f35 100644
--- a/src/dotty/tools/dotc/ast/CheckTrees.scala.disabled
+++ b/src/dotty/tools/dotc/ast/CheckTrees.scala.disabled
@@ -131,7 +131,7 @@ object CheckTrees {
check(guard.tpe.derivesFrom(defn.BooleanClass))
case Return(expr, from) =>
check(expr.isValue); check(from.isTerm)
- check(from.tpe.termSymbol.isSourceMethod)
+ check(from.tpe.termSymbol.isRealMethod)
case Try(block, handler, finalizer) =>
check(block.isTerm)
check(finalizer.isTerm)
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index b93585324..1d3434091 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -478,8 +478,12 @@ object SymDenotations {
}
}
- /** Is this a user defined "def" method? Excluded are accessors and anonymous functions. */
- final def isSourceMethod(implicit ctx: Context) =
+ /** Is this a "real" method? A real method is a method which is:
+ * - not an accessor
+ * - not a label
+ * - not an anonymous function
+ */
+ final def isRealMethod(implicit ctx: Context) =
this.is(Method, butNot = AccessorOrLabel) && !isAnonymousFunction
/** Is this a setter? */
diff --git a/src/dotty/tools/dotc/transform/ValueClasses.scala b/src/dotty/tools/dotc/transform/ValueClasses.scala
index f17a0e757..308eed968 100644
--- a/src/dotty/tools/dotc/transform/ValueClasses.scala
+++ b/src/dotty/tools/dotc/transform/ValueClasses.scala
@@ -20,7 +20,7 @@ object ValueClasses {
}
def isMethodWithExtension(d: SymDenotation)(implicit ctx: Context) =
- d.isSourceMethod &&
+ d.isRealMethod &&
isDerivedValueClass(d.owner) &&
!d.isConstructor &&
!d.is(SuperAccessor) &&
diff --git a/src/dotty/tools/dotc/typer/Checking.scala b/src/dotty/tools/dotc/typer/Checking.scala
index 148e31885..ffb74839d 100644
--- a/src/dotty/tools/dotc/typer/Checking.scala
+++ b/src/dotty/tools/dotc/typer/Checking.scala
@@ -312,7 +312,7 @@ trait Checking {
def doubleDefError(decl: Symbol, other: Symbol): Unit = {
def ofType = if (decl.isType) "" else d": ${other.info}"
def explanation =
- if (!decl.isSourceMethod) ""
+ if (!decl.isRealMethod) ""
else "\n (both definitions have the same erased type signature)"
ctx.error(d"$decl is already defined as $other$ofType$explanation", decl.pos)
}
diff --git a/src/dotty/tools/dotc/typer/RefChecks.scala b/src/dotty/tools/dotc/typer/RefChecks.scala
index eeed83bb5..97d005112 100644
--- a/src/dotty/tools/dotc/typer/RefChecks.scala
+++ b/src/dotty/tools/dotc/typer/RefChecks.scala
@@ -297,9 +297,9 @@ object RefChecks {
"(this rule is designed to prevent ``accidental overrides'')")
} else if (other.isStable && !member.isStable) { // (1.4)
overrideError("needs to be a stable, immutable value")
- } else if (member.is(Lazy) && !other.isSourceMethod && !other.is(Deferred | Lazy)) {
+ } else if (member.is(Lazy) && !other.isRealMethod && !other.is(Deferred | Lazy)) {
overrideError("cannot override a concrete non-lazy value")
- } else if (other.is(Lazy, butNot = Deferred) && !other.isSourceMethod && !member.is(Lazy)) {
+ } else if (other.is(Lazy, butNot = Deferred) && !other.isRealMethod && !member.is(Lazy)) {
overrideError("must be declared lazy to override a concrete lazy value")
} else if (other.is(Deferred) && member.is(Macro) && member.extendedOverriddenSymbols.forall(_.is(Deferred))) { // (1.9)
overrideError("cannot be used here - term macros cannot override abstract methods")
@@ -1132,7 +1132,7 @@ class RefChecks extends MiniPhase { thisTransformer =>
}
val doTransform =
- sym.isSourceMethod &&
+ sym.isRealMethod &&
sym.isCase &&
sym.name == nme.apply &&
isClassTypeAccessible(tree)
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 191a13ad0..566e8289a 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -708,7 +708,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
ctx.error("return outside method definition", tree.pos)
(EmptyTree, WildcardType)
}
- else if (owner != cx.outer.owner && owner.isSourceMethod) {
+ else if (owner != cx.outer.owner && owner.isRealMethod) {
if (owner.isCompleted) {
val from = Ident(TermRef(NoPrefix, owner.asTerm))
val proto = returnProto(owner, cx.scope)