Skip to content

Commit e15ebaa

Browse files
committed
Drop AllowDependendFunctions mode bit
Tests indicate it's not needed anymore. Also: fix neg test error position.
1 parent e31aa08 commit e15ebaa

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

compiler/src/dotty/tools/dotc/core/Mode.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ object Mode {
4848
/** Allow GADTFlexType labelled types to have their bounds adjusted */
4949
val GADTflexible = newMode(8, "GADTflexible")
5050

51-
/** Allow dependent functions. This is currently necessary for unpickling, because
52-
* some dependent functions are passed through from the front end(s?), even though they
53-
* are technically speaking illegal.
54-
*/
55-
val AllowDependentFunctions = newMode(9, "AllowDependentFunctions")
56-
5751
/** We are currently printing something: avoid to produce more logs about
5852
* the printing
5953
*/

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,12 +1312,12 @@ object Types {
13121312
// ----- misc -----------------------------------------------------------
13131313

13141314
/** Turn type into a function type.
1315-
* @pre this is a non-dependent method type.
1315+
* @pre this is a method type without parameter dependencies.
13161316
* @param dropLast The number of trailing parameters that should be dropped
13171317
* when forming the function type.
13181318
*/
13191319
def toFunctionType(dropLast: Int = 0)(implicit ctx: Context): Type = this match {
1320-
case mt: MethodType if !mt.isDependent || ctx.mode.is(Mode.AllowDependentFunctions) =>
1320+
case mt: MethodType if !mt.isDependent =>
13211321
val formals1 = if (dropLast == 0) mt.paramInfos else mt.paramInfos dropRight dropLast
13221322
defn.FunctionOf(
13231323
formals1 mapConserve (_.underlyingIfRepeated(mt.isJavaMethod)), mt.resultType, mt.isImplicitMethod && !ctx.erasedTypes)

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class TreeUnpickler(reader: TastyReader, nameAtRef: NameRef => TermName, posUnpi
7474
/** The unpickled trees */
7575
def unpickle()(implicit ctx: Context): List[Tree] = {
7676
assert(roots != null, "unpickle without previous enterTopLevel")
77-
new TreeReader(reader).readTopLevel()(ctx.addMode(Mode.AllowDependentFunctions))
77+
new TreeReader(reader).readTopLevel()
7878
}
7979

8080
class Completer(owner: Symbol, reader: TastyReader) extends LazyType {
@@ -1095,7 +1095,7 @@ class TreeUnpickler(reader: TastyReader, nameAtRef: NameRef => TermName, posUnpi
10951095
class LazyReader[T <: AnyRef](reader: TreeReader, op: TreeReader => Context => T) extends Trees.Lazy[T] {
10961096
def complete(implicit ctx: Context): T = {
10971097
pickling.println(i"starting to read at ${reader.reader.currentAddr}")
1098-
op(reader)(ctx.addMode(Mode.AllowDependentFunctions).withPhaseNoLater(ctx.picklerPhase))
1098+
op(reader)(ctx.withPhaseNoLater(ctx.picklerPhase))
10991099
}
11001100
}
11011101

tests/neg/depfuns.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
object Test {
22

3-
type T = (x: Int) // error: `=>' expected
3+
type T = (x: Int)
44

5-
}
5+
} // error: `=>' expected

0 commit comments

Comments
 (0)