File: 0017-bug912393.patch

package info (click to toggle)
scala 2.11.12-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 62,828 kB
  • sloc: javascript: 28,808; java: 13,415; xml: 3,250; sh: 1,620; python: 756; makefile: 38; awk: 36; ansic: 6
file content (740 lines) | stat: -rw-r--r-- 32,671 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
From: Markus Koschany <apo@debian.org>
Date: Sat, 10 Nov 2018 16:11:46 +0100
Subject: 0017-bug912393

Bug-Debian: https://bugs.debian.org/912393
Forwarded: not-needed
---
 src/compiler/scala/tools/cmd/gen/AnyVals.scala     | 484 ---------------------
 src/compiler/scala/tools/cmd/gen/Codegen.scala     |   4 +-
 .../scala/tools/nsc/typechecker/Contexts.scala     |   2 +-
 .../scala/tools/nsc/typechecker/Typers.scala       |   2 +-
 src/compiler/scala/tools/util/PathResolver.scala   |   2 +-
 .../tests/InteractiveTestSettings.scala            |   2 +-
 .../scala/reflect/internal/util/StringOps.scala    |   2 +-
 .../tools/nsc/interpreter/jline/JLineHistory.scala |   2 +-
 .../scala/tools/nsc/interpreter/Formatting.scala   |   4 +-
 src/repl/scala/tools/nsc/interpreter/ILoop.scala   |   4 +-
 src/repl/scala/tools/nsc/interpreter/IMain.scala   |   4 +-
 src/repl/scala/tools/nsc/interpreter/Pasted.scala  |   2 +-
 src/repl/scala/tools/nsc/interpreter/Power.scala   |   4 -
 .../scala/tools/nsc/interpreter/ReplProps.scala    |   2 +-
 .../tools/nsc/doc/base/CommentFactoryBase.scala    |   2 +-
 15 files changed, 17 insertions(+), 505 deletions(-)
 delete mode 100644 src/compiler/scala/tools/cmd/gen/AnyVals.scala

diff --git a/src/compiler/scala/tools/cmd/gen/AnyVals.scala b/src/compiler/scala/tools/cmd/gen/AnyVals.scala
deleted file mode 100644
index e785899..0000000
--- a/src/compiler/scala/tools/cmd/gen/AnyVals.scala
+++ /dev/null
@@ -1,484 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2007-2013 LAMP/EPFL
- * @author  Paul Phillips
- */
-
-package scala.tools.cmd
-package gen
-
-/** Code generation of the AnyVal types and their companions. */
-trait AnyValReps {
-  self: AnyVals =>
-
-  sealed abstract class AnyValNum(name: String, repr: Option[String], javaEquiv: String)
-      extends AnyValRep(name,repr,javaEquiv) {
-
-    case class Op(op : String, doc : String)
-
-    private def companionCoercions(tos: AnyValRep*) = {
-      tos.toList map (to =>
-        s"implicit def @javaequiv@2${to.javaEquiv}(x: @name@): ${to.name} = x.to${to.name}"
-      )
-    }
-    def coercionComment =
-"""/** Language mandated coercions from @name@ to "wider" types. */
-import scala.language.implicitConversions"""
-
-    def implicitCoercions: List[String] = {
-      val coercions = this match {
-        case B     => companionCoercions(S, I, L, F, D)
-        case S | C => companionCoercions(I, L, F, D)
-        case I     => companionCoercions(L, F, D)
-        case L     => companionCoercions(F, D)
-        case F     => companionCoercions(D)
-        case _     => Nil
-      }
-      if (coercions.isEmpty) Nil
-      else coercionComment.lines.toList ++ coercions
-    }
-
-    def isCardinal: Boolean = isIntegerType(this)
-    def unaryOps = {
-      val ops = List(
-        Op("+", "/** Returns this value, unmodified. */"),
-        Op("-", "/** Returns the negation of this value. */"))
-
-      if(isCardinal)
-        Op("~", "/**\n" +
-                " * Returns the bitwise negation of this value.\n" +
-                " * @example {{{\n" +
-                " * ~5 == -6\n" +
-                " * // in binary: ~00000101 ==\n" +
-                " * //             11111010\n" +
-                " * }}}\n" +
-                " */") :: ops
-      else ops
-    }
-
-    def bitwiseOps =
-      if (isCardinal)
-        List(
-          Op("|", "/**\n" +
-                     "  * Returns the bitwise OR of this value and `x`.\n" +
-                     "  * @example {{{\n" +
-                     "  * (0xf0 | 0xaa) == 0xfa\n" +
-                     "  * // in binary:   11110000\n" +
-                     "  * //            | 10101010\n" +
-                     "  * //              --------\n" +
-                     "  * //              11111010\n" +
-                     "  * }}}\n" +
-                     "  */"),
-          Op("&", "/**\n" +
-                     "  * Returns the bitwise AND of this value and `x`.\n" +
-                     "  * @example {{{\n" +
-                     "  * (0xf0 & 0xaa) == 0xa0\n" +
-                     "  * // in binary:   11110000\n" +
-                     "  * //            & 10101010\n" +
-                     "  * //              --------\n" +
-                     "  * //              10100000\n" +
-                     "  * }}}\n" +
-                     "  */"),
-          Op("^", "/**\n" +
-                     "  * Returns the bitwise XOR of this value and `x`.\n" +
-                     "  * @example {{{\n" +
-                     "  * (0xf0 ^ 0xaa) == 0x5a\n" +
-                     "  * // in binary:   11110000\n" +
-                     "  * //            ^ 10101010\n" +
-                     "  * //              --------\n" +
-                     "  * //              01011010\n" +
-                     "  * }}}\n" +
-                     "  */"))
-      else Nil
-
-    def shiftOps =
-      if (isCardinal)
-        List(
-          Op("<<",  "/**\n" +
-                       "  * Returns this value bit-shifted left by the specified number of bits,\n" +
-                       "  *         filling in the new right bits with zeroes.\n" +
-                       "  * @example {{{ 6 << 3 == 48 // in binary: 0110 << 3 == 0110000 }}}\n" +
-                       "  */"),
-
-          Op(">>>", "/**\n" +
-                       "  * Returns this value bit-shifted right by the specified number of bits,\n" +
-                       "  *         filling the new left bits with zeroes.\n" +
-                       "  * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}}\n" +
-                       "  * @example {{{\n" +
-                       "  * -21 >>> 3 == 536870909\n" +
-                       "  * // in binary: 11111111 11111111 11111111 11101011 >>> 3 ==\n" +
-                       "  * //            00011111 11111111 11111111 11111101\n" +
-                       "  * }}}\n" +
-                       "  */"),
-
-          Op(">>",  "/**\n" +
-                       "  * Returns this value bit-shifted right by the specified number of bits,\n" +
-                       "  *         filling in the left bits with the same value as the left-most bit of this.\n" +
-                       "  *         The effect of this is to retain the sign of the value.\n" +
-                       "  * @example {{{\n" +
-                       "  * -21 >> 3 == -3\n" +
-                       "  * // in binary: 11111111 11111111 11111111 11101011 >> 3 ==\n" +
-                       "  * //            11111111 11111111 11111111 11111101\n" +
-                       "  * }}}\n" +
-                       "  */"))
-      else Nil
-
-    def comparisonOps = List(
-      Op("==", "/** Returns `true` if this value is equal to x, `false` otherwise. */"),
-      Op("!=", "/** Returns `true` if this value is not equal to x, `false` otherwise. */"),
-      Op("<",  "/** Returns `true` if this value is less than x, `false` otherwise. */"),
-      Op("<=", "/** Returns `true` if this value is less than or equal to x, `false` otherwise. */"),
-      Op(">",  "/** Returns `true` if this value is greater than x, `false` otherwise. */"),
-      Op(">=", "/** Returns `true` if this value is greater than or equal to x, `false` otherwise. */"))
-
-    def otherOps = List(
-      Op("+", "/** Returns the sum of this value and `x`. */"),
-      Op("-", "/** Returns the difference of this value and `x`. */"),
-      Op("*", "/** Returns the product of this value and `x`. */"),
-      Op("/", "/** Returns the quotient of this value and `x`. */"),
-      Op("%", "/** Returns the remainder of the division of this value by `x`. */"))
-
-    // Given two numeric value types S and T , the operation type of S and T is defined as follows:
-    // If both S and T are subrange types then the operation type of S and T is Int.
-    // Otherwise the operation type of S and T is the larger of the two types wrt ranking.
-    // Given two numeric values v and w the operation type of v and w is the operation type
-    // of their run-time types.
-    def opType(that: AnyValNum): AnyValNum = {
-      val rank = IndexedSeq(I, L, F, D)
-      (rank indexOf this, rank indexOf that) match {
-        case (-1, -1)   => I
-        case (r1, r2)   => rank apply (r1 max r2)
-      }
-    }
-
-    def mkCoercions = numeric map (x => "def to%s: %s".format(x, x))
-    def mkUnaryOps  = unaryOps map (x => "%s\n  def unary_%s : %s".format(x.doc, x.op, this opType I))
-    def mkStringOps = List("def +(x: String): String")
-    def mkShiftOps  = (
-      for (op <- shiftOps ; arg <- List(I, L)) yield
-        "%s\n  def %s(x: %s): %s".format(op.doc, op.op, arg, this opType I)
-    )
-
-    def clumps: List[List[String]] = {
-      val xs1 = List(mkCoercions, mkUnaryOps, mkStringOps, mkShiftOps) map (xs => if (xs.isEmpty) xs else xs :+ "")
-      val xs2 = List(
-        mkBinOpsGroup(comparisonOps, numeric, _ => Z),
-        mkBinOpsGroup(bitwiseOps, cardinal, this opType _),
-        mkBinOpsGroup(otherOps, numeric, this opType _)
-      )
-      xs1 ++ xs2
-    }
-    def classLines = (clumps :+ commonClassLines).foldLeft(List[String]()) {
-      case (res, Nil)   => res
-      case (res, lines) =>
-        val xs = lines map {
-          case ""   => ""
-          case s    => interpolate(s)
-        }
-        res ++ xs
-    }
-    def objectLines = {
-      val comp = if (isCardinal) cardinalCompanion else floatingCompanion
-      interpolate(comp + allCompanions + "\n" + nonUnitCompanions).trim.lines.toList ++ (implicitCoercions map interpolate)
-    }
-
-    /** Makes a set of binary operations based on the given set of ops, args, and resultFn.
-     *
-     *  @param    ops       list of function names e.g. List(">>", "%")
-     *  @param    args      list of types which should appear as arguments
-     *  @param    resultFn  function which calculates return type based on arg type
-     *  @return             list of function definitions
-     */
-    def mkBinOpsGroup(ops: List[Op], args: List[AnyValNum], resultFn: AnyValNum => AnyValRep): List[String] = (
-      ops flatMap (op =>
-        args.map(arg =>
-          "%s\n  def %s(x: %s): %s".format(op.doc, op.op, arg, resultFn(arg))) :+ ""
-      )
-    ).toList
-  }
-
-  sealed abstract class AnyValRep(val name: String, val repr: Option[String], val javaEquiv: String) {
-    def classLines: List[String]
-    def objectLines: List[String]
-    def commonClassLines = List(
-      "override def getClass(): Class[@name@] = null"
-    )
-
-    def lcname = name.toLowerCase
-    def boxedSimpleName = this match {
-      case C => "Character"
-      case I => "Integer"
-      case _ => name
-    }
-    def boxedName = this match {
-      case U => "scala.runtime.BoxedUnit"
-      case _ => "java.lang." + boxedSimpleName
-    }
-    def zeroRep = this match {
-      case L => "0L"
-      case F => "0.0f"
-      case D => "0.0d"
-      case _ => "0"
-    }
-
-    def representation = repr.map(", a " + _).getOrElse("")
-
-    def indent(s: String)  = if (s == "") "" else "  " + s
-    def indentN(s: String) = s.lines map indent mkString "\n"
-
-    def boxUnboxImpls = Map(
-      "@boxRunTimeDoc@" -> """
- *  Runtime implementation determined by `scala.runtime.BoxesRunTime.boxTo%s`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]].
- *""".format(boxedSimpleName),
-      "@boxImpl@"   -> "%s.valueOf(x)".format(boxedName),
-      "@unboxRunTimeDoc@" -> """
- *  Runtime implementation determined by `scala.runtime.BoxesRunTime.unboxTo%s`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]].
- *""".format(name),
-      "@unboxImpl@" -> "x.asInstanceOf[%s].%sValue()".format(boxedName, lcname),
-      "@unboxDoc@"  -> "the %s resulting from calling %sValue() on `x`".format(name, lcname)
-    )
-    def interpolations = Map(
-      "@name@"      -> name,
-      "@representation@" -> representation,
-      "@javaequiv@" -> javaEquiv,
-      "@boxed@"     -> boxedName,
-      "@lcname@"    -> lcname,
-      "@zero@"      -> zeroRep
-    ) ++ boxUnboxImpls
-
-    def interpolate(s: String): String = interpolations.foldLeft(s) {
-      case (str, (key, value)) => str.replaceAll(key, value)
-    }
-    def classDoc  = interpolate(classDocTemplate)
-    def objectDoc = ""
-    def mkImports = ""
-
-    def mkClass       = assemble("final abstract class " + name + " private extends AnyVal", classLines)
-    def mkObject      = assemble("object " + name + " extends AnyValCompanion", objectLines)
-    def make()    = List[String](
-      headerTemplate,
-      mkImports,
-      classDoc,
-      mkClass,
-      objectDoc,
-      mkObject
-    ) mkString ""
-
-    def assemble(decl: String, lines: List[String]): String = {
-      val body = if (lines.isEmpty) " { }\n\n" else lines map indent mkString (" {\n", "\n", "\n}\n")
-
-      decl + body + "\n"
-    }
-    override def toString = name
-  }
-}
-
-trait AnyValTemplates {
-  def headerTemplate = """/*                     __                                               *\
-**     ________ ___   / /  ___     Scala API                            **
-**    / __/ __// _ | / /  / _ |    (c) 2002-2013, LAMP/EPFL             **
-**  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **
-** /____/\___/_/ |_/____/_/ | |                                         **
-**                          |/                                          **
-\*                                                                      */
-
-// DO NOT EDIT, CHANGES WILL BE LOST
-// This auto-generated code can be modified in scala.tools.cmd.gen.
-// Afterwards, running tools/codegen-anyvals regenerates this source file.
-
-package scala
-
-"""
-
-  def classDocTemplate = ("""
-/** `@name@`@representation@ (equivalent to Java's `@javaequiv@` primitive type) is a
- *  subtype of [[scala.AnyVal]]. Instances of `@name@` are not
- *  represented by an object in the underlying runtime system.
- *
- *  There is an implicit conversion from [[scala.@name@]] => [[scala.runtime.Rich@name@]]
- *  which provides useful non-primitive operations.
- */
-""".trim + "\n")
-
-  def allCompanions = """
-/** Transform a value type into a boxed reference type.
- *@boxRunTimeDoc@
- *  @param  x   the @name@ to be boxed
- *  @return     a @boxed@ offering `x` as its underlying value.
- */
-def box(x: @name@): @boxed@ = @boxImpl@
-
-/** Transform a boxed type into a value type.  Note that this
- *  method is not typesafe: it accepts any Object, but will throw
- *  an exception if the argument is not a @boxed@.
- *@unboxRunTimeDoc@
- *  @param  x   the @boxed@ to be unboxed.
- *  @throws     ClassCastException  if the argument is not a @boxed@
- *  @return     @unboxDoc@
- */
-def unbox(x: java.lang.Object): @name@ = @unboxImpl@
-
-/** The String representation of the scala.@name@ companion object. */
-override def toString = "object scala.@name@"
-"""
-
-  def nonUnitCompanions = ""  // todo
-
-  def cardinalCompanion = """
-/** The smallest value representable as a @name@. */
-final val MinValue = @boxed@.MIN_VALUE
-
-/** The largest value representable as a @name@. */
-final val MaxValue = @boxed@.MAX_VALUE
-"""
-
-  def floatingCompanion = """
-/** The smallest positive value greater than @zero@ which is
- *  representable as a @name@.
- */
-final val MinPositiveValue = @boxed@.MIN_VALUE
-final val NaN              = @boxed@.NaN
-final val PositiveInfinity = @boxed@.POSITIVE_INFINITY
-final val NegativeInfinity = @boxed@.NEGATIVE_INFINITY
-
-/** The negative number with the greatest (finite) absolute value which is representable
- *  by a @name@.  Note that it differs from [[java.lang.@name@.MIN_VALUE]], which
- *  is the smallest positive value representable by a @name@.  In Scala that number
- *  is called @name@.MinPositiveValue.
- */
-final val MinValue = -@boxed@.MAX_VALUE
-
-/** The largest finite positive number representable as a @name@. */
-final val MaxValue = @boxed@.MAX_VALUE
-"""
-}
-
-class AnyVals extends AnyValReps with AnyValTemplates {
-  object B extends AnyValNum("Byte",    Some("8-bit signed integer"),                  "byte")
-  object S extends AnyValNum("Short",   Some("16-bit signed integer"),                 "short")
-  object C extends AnyValNum("Char",    Some("16-bit unsigned integer"),               "char")
-  object I extends AnyValNum("Int",     Some("32-bit signed integer"),                 "int")
-  object L extends AnyValNum("Long",    Some("64-bit signed integer"),                 "long")
-  object F extends AnyValNum("Float",   Some("32-bit IEEE-754 floating point number"), "float")
-  object D extends AnyValNum("Double",  Some("64-bit IEEE-754 floating point number"), "double")
-  object Z extends AnyValRep("Boolean", None,                                          "boolean") {
-    def classLines = """
-/** Negates a Boolean expression.
-  *
-  * - `!a` results in `false` if and only if `a` evaluates to `true` and
-  * - `!a` results in `true` if and only if `a` evaluates to `false`.
-  *
-  * @return the negated expression
-  */
-def unary_! : Boolean
-
-/** Compares two Boolean expressions and returns `true` if they evaluate to the same value.
-  *
-  * `a == b` returns `true` if and only if
-  *  - `a` and `b` are `true` or
-  *  - `a` and `b` are `false`.
-  */
-def ==(x: Boolean): Boolean
-
-/**
-  * Compares two Boolean expressions and returns `true` if they evaluate to a different value.
-  *
-  * `a != b` returns `true` if and only if
-  *  - `a` is `true` and `b` is `false` or
-  *  - `a` is `false` and `b` is `true`.
-  */
-def !=(x: Boolean): Boolean
-
-/** Compares two Boolean expressions and returns `true` if one or both of them evaluate to true.
-  *
-  * `a || b` returns `true` if and only if
-  *  - `a` is `true` or
-  *  - `b` is `true` or
-  *  - `a` and `b` are `true`.
-  *
-  * @note This method uses 'short-circuit' evaluation and
-  *       behaves as if it was declared as `def ||(x: => Boolean): Boolean`.
-  *       If `a` evaluates to `true`, `true` is returned without evaluating `b`.
-  */
-def ||(x: Boolean): Boolean
-
-/** Compares two Boolean expressions and returns `true` if both of them evaluate to true.
-  *
-  * `a && b` returns `true` if and only if
-  *  - `a` and `b` are `true`.
-  *
-  * @note This method uses 'short-circuit' evaluation and
-  *       behaves as if it was declared as `def &&(x: => Boolean): Boolean`.
-  *       If `a` evaluates to `false`, `false` is returned without evaluating `b`.
-  */
-def &&(x: Boolean): Boolean
-
-// Compiler won't build with these seemingly more accurate signatures
-// def ||(x: => Boolean): Boolean
-// def &&(x: => Boolean): Boolean
-
-/** Compares two Boolean expressions and returns `true` if one or both of them evaluate to true.
-  *
-  * `a | b` returns `true` if and only if
-  *  - `a` is `true` or
-  *  - `b` is `true` or
-  *  - `a` and `b` are `true`.
-  *
-  * @note This method evaluates both `a` and `b`, even if the result is already determined after evaluating `a`.
-  */
-def |(x: Boolean): Boolean
-
-/** Compares two Boolean expressions and returns `true` if both of them evaluate to true.
-  *
-  * `a & b` returns `true` if and only if
-  *  - `a` and `b` are `true`.
-  *
-  * @note This method evaluates both `a` and `b`, even if the result is already determined after evaluating `a`.
-  */
-def &(x: Boolean): Boolean
-
-/** Compares two Boolean expressions and returns `true` if they evaluate to a different value.
-  *
-  * `a ^ b` returns `true` if and only if
-  *  - `a` is `true` and `b` is `false` or
-  *  - `a` is `false` and `b` is `true`.
-  */
-def ^(x: Boolean): Boolean
-
-override def getClass(): Class[Boolean] = null
-    """.trim.lines.toList
-
-    def objectLines = interpolate(allCompanions + "\n" + nonUnitCompanions).lines.toList
-  }
-  object U extends AnyValRep("Unit", None, "void") {
-    override def classDoc = """
-/** `Unit` is a subtype of [[scala.AnyVal]]. There is only one value of type
- *  `Unit`, `()`, and it is not represented by any object in the underlying
- *  runtime system. A method with return type `Unit` is analogous to a Java
- *  method which is declared `void`.
- */
-"""
-    def classLines  = List(
-      """override def getClass(): Class[Unit] = null"""
-    )
-    def objectLines = interpolate(allCompanions).lines.toList
-
-    override def boxUnboxImpls = Map(
-      "@boxRunTimeDoc@" -> "",
-      "@boxImpl@"   -> "scala.runtime.BoxedUnit.UNIT",
-      "@unboxRunTimeDoc@" -> "",
-      "@unboxImpl@" -> "()",
-      "@unboxDoc@"  -> "the Unit value ()"
-    )
-  }
-
-  def isSubrangeType = Set(B, S, C)
-  def isIntegerType  = Set(B, S, C, I, L)
-  def isFloatingType = Set(F, D)
-  def isWideType     = Set(L, D)
-
-  def cardinal = numeric filter isIntegerType
-  def numeric  = List(B, S, C, I, L, F, D)
-  def values   = List(U, Z) ++ numeric
-
-  def make() = values map (x => (x.name, x.make()))
-}
diff --git a/src/compiler/scala/tools/cmd/gen/Codegen.scala b/src/compiler/scala/tools/cmd/gen/Codegen.scala
index c3aa527..d699eb9 100644
--- a/src/compiler/scala/tools/cmd/gen/Codegen.scala
+++ b/src/compiler/scala/tools/cmd/gen/Codegen.scala
@@ -25,7 +25,7 @@ object Codegen {
 
     echo("Generating sources into " + out)
 
-    if (anyvals || all) {
+    /*if (anyvals || all) {
       val av = new AnyVals { }
 
       av.make() foreach { case (name, code ) =>
@@ -33,7 +33,7 @@ object Codegen {
         echo("Writing: " + file)
         file writeAll code
       }
-    }
+    }*/
   }
 }
 
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 5ec16e8..61f02e7 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -617,7 +617,7 @@ trait Contexts { self: Analyzer =>
 
     def enclosingContextChain: List[Context] = this :: outer.enclosingContextChain
 
-    private def treeTruncated       = tree.toString.replaceAll("\\s+", " ").lines.mkString("\\n").take(70)
+    private def treeTruncated       = tree.toString.replaceAll("\\s+", " ").linesIterator.mkString("\\n").take(70)
     private def treeIdString        = if (settings.uniqid.value) "#" + System.identityHashCode(tree).toString.takeRight(3) else ""
     private def treeString          = tree match {
       case x: Import => "" + x
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index ac0a653..7aa801d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -4519,7 +4519,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
             if (e.errPos == tree.pos) {
               val header = f"${e.errMsg}%n  Expression does not convert to assignment because:%n    "
               val expansion = f"%n    expansion: ${show(convo)}"
-              NormalTypeError(tree, err.errors.flatMap(_.errMsg.lines.toList).mkString(header, f"%n    ", expansion))
+              NormalTypeError(tree, err.errors.flatMap(_.errMsg.linesIterator.toList).mkString(header, f"%n    ", expansion))
             } else e
           }
         def advice2(errors: List[AbsTypeError]): List[AbsTypeError] =
diff --git a/src/compiler/scala/tools/util/PathResolver.scala b/src/compiler/scala/tools/util/PathResolver.scala
index 88b29c0..d28be41 100644
--- a/src/compiler/scala/tools/util/PathResolver.scala
+++ b/src/compiler/scala/tools/util/PathResolver.scala
@@ -39,7 +39,7 @@ object PathResolver {
   }
   implicit class AsLines(val s: String) extends AnyVal {
     // sm"""...""" could do this in one pass
-    def asLines = s.trim.stripMargin.lines.mkLines
+    def asLines = s.trim.stripMargin.linesIterator.mkLines
   }
 
   /** pretty print class path */
diff --git a/src/interactive/scala/tools/nsc/interactive/tests/InteractiveTestSettings.scala b/src/interactive/scala/tools/nsc/interactive/tests/InteractiveTestSettings.scala
index ad5c61b..5c2588d 100644
--- a/src/interactive/scala/tools/nsc/interactive/tests/InteractiveTestSettings.scala
+++ b/src/interactive/scala/tools/nsc/interactive/tests/InteractiveTestSettings.scala
@@ -57,7 +57,7 @@ trait InteractiveTestSettings extends TestSettings with PresentationCompilerInst
     val str = try File(optsFile).slurp() catch {
       case e: java.io.IOException => ""
     }
-    str.lines.filter(!_.startsWith(CommentStartDelimiter)).mkString(" ")
+    str.linesIterator.filter(!_.startsWith(CommentStartDelimiter)).mkString(" ")
   }
 
   override protected def printClassPath(implicit reporter: Reporter) {
diff --git a/src/reflect/scala/reflect/internal/util/StringOps.scala b/src/reflect/scala/reflect/internal/util/StringOps.scala
index efb8126..229b35c 100644
--- a/src/reflect/scala/reflect/internal/util/StringOps.scala
+++ b/src/reflect/scala/reflect/internal/util/StringOps.scala
@@ -45,7 +45,7 @@ trait StringOps {
     else s.substring(0, end)
   }
   /** Breaks the string into lines and strips each line before reassembling. */
-  def trimAllTrailingSpace(s: String): String = s.lines map trimTrailingSpace mkString EOL
+  def trimAllTrailingSpace(s: String): String = s.linesIterator.map(trimTrailingSpace).mkString(EOL)
 
   def decompose(str: String, sep: Char): List[String] = {
     def ws(start: Int): List[String] =
diff --git a/src/repl-jline/scala/tools/nsc/interpreter/jline/JLineHistory.scala b/src/repl-jline/scala/tools/nsc/interpreter/jline/JLineHistory.scala
index 3bc2592..5f4bedf 100644
--- a/src/repl-jline/scala/tools/nsc/interpreter/jline/JLineHistory.scala
+++ b/src/repl-jline/scala/tools/nsc/interpreter/jline/JLineHistory.scala
@@ -40,7 +40,7 @@ trait JLineHistory extends JHistory with History {
   def moveToEnd(): Unit
 
   override def historicize(text: String): Boolean = {
-    text.lines foreach add
+    text.linesIterator foreach add
     moveToEnd()
     true
   }
diff --git a/src/repl/scala/tools/nsc/interpreter/Formatting.scala b/src/repl/scala/tools/nsc/interpreter/Formatting.scala
index 4a95487..a2b5801 100644
--- a/src/repl/scala/tools/nsc/interpreter/Formatting.scala
+++ b/src/repl/scala/tools/nsc/interpreter/Formatting.scala
@@ -23,7 +23,7 @@ class Formatting(indent: Int) {
    *  This way, compiler error messages read better.
    */
   def indentCode(code: String) = stringFromWriter(str =>
-    for (line <- code.lines) {
+    for (line <- code.linesIterator) {
       if (indenting(code)) str print indentation
       str println line
       str.flush()
@@ -31,5 +31,5 @@ class Formatting(indent: Int) {
   )
 }
 object Formatting {
-  def forPrompt(prompt: String) = new Formatting(prompt.lines.toList.last.length)
+  def forPrompt(prompt: String) = new Formatting(prompt.linesIterator.toList.last.length)
 }
diff --git a/src/repl/scala/tools/nsc/interpreter/ILoop.scala b/src/repl/scala/tools/nsc/interpreter/ILoop.scala
index b086b21..d0aac3f 100644
--- a/src/repl/scala/tools/nsc/interpreter/ILoop.scala
+++ b/src/repl/scala/tools/nsc/interpreter/ILoop.scala
@@ -509,7 +509,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
               tmp.safeSlurp() match {
                 case Some(edited) if edited.trim.isEmpty => echo("Edited text is empty.")
                 case Some(edited) =>
-                  echo(edited.lines map ("+" + _) mkString "\n")
+                  echo(edited.linesIterator map ("+" + _) mkString "\n")
                   val res = intp interpret edited
                   if (res == IR.Incomplete) diagnose(edited)
                   else {
@@ -750,7 +750,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
         val input = readWhile(s => delimiter.isEmpty || delimiter.get != s) mkString "\n"
         val text = (
           margin filter (_.nonEmpty) map {
-            case "-" => input.lines map (_.trim) mkString "\n"
+            case "-" => input.linesIterator map (_.trim) mkString "\n"
             case m   => input stripMargin m.head   // ignore excess chars in "<<||"
           } getOrElse input
         ).trim
diff --git a/src/repl/scala/tools/nsc/interpreter/IMain.scala b/src/repl/scala/tools/nsc/interpreter/IMain.scala
index dc8b620..7809576 100644
--- a/src/repl/scala/tools/nsc/interpreter/IMain.scala
+++ b/src/repl/scala/tools/nsc/interpreter/IMain.scala
@@ -652,7 +652,7 @@ class IMain(@BeanProperty val factory: ScriptEngineFactory, initialSettings: Set
         if (printResults && result != "")
           printMessage(result stripSuffix "\n")
         else if (isReplDebug) // show quiet-mode activity
-          printMessage(result.trim.lines map ("[quiet] " + _) mkString "\n")
+          printMessage(result.trim.linesIterator map ("[quiet] " + _) mkString "\n")
 
         // Book-keeping.  Have to record synthetic requests too,
         // as they may have been issued for information, e.g. :type
@@ -1258,7 +1258,7 @@ class IMain(@BeanProperty val factory: ScriptEngineFactory, initialSettings: Set
     /** Secret bookcase entrance for repl debuggers: end the line
      *  with "// show" and see what's going on.
      */
-    def isShow = code.lines exists (_.trim endsWith "// show")
+    def isShow = code.linesIterator exists (_.trim endsWith "// show")
     if (isReplDebug || isShow) {
       beSilentDuring(parse(code)) match {
         case parse.Success(ts) =>
diff --git a/src/repl/scala/tools/nsc/interpreter/Pasted.scala b/src/repl/scala/tools/nsc/interpreter/Pasted.scala
index 3a7eda1..479dc96 100644
--- a/src/repl/scala/tools/nsc/interpreter/Pasted.scala
+++ b/src/repl/scala/tools/nsc/interpreter/Pasted.scala
@@ -19,7 +19,7 @@ abstract class Pasted(prompt: String) {
   def interpret(line: String): IR.Result
   def echo(message: String): Unit
 
-  val PromptString    = prompt.lines.toList.last
+  val PromptString    = prompt.linesIterator.toList.last
   val AltPromptString = "scala> "
   val ContinuePrompt  = replProps.continuePrompt
   val ContinueString  = replProps.continueText     // "     | "
diff --git a/src/repl/scala/tools/nsc/interpreter/Power.scala b/src/repl/scala/tools/nsc/interpreter/Power.scala
index a14a60d..b14aef6 100644
--- a/src/repl/scala/tools/nsc/interpreter/Power.scala
+++ b/src/repl/scala/tools/nsc/interpreter/Power.scala
@@ -142,8 +142,6 @@ class Power[ReplValsImpl <: ReplVals : ru.TypeTag: ClassTag](val intp: IMain, re
     |replImplicits._
     |treedsl.CODE._""".stripMargin.lines
 
-  def init = customInit getOrElse initImports.mkString("import ", ", ", "")
-
   /** Quietly starts up power mode and runs whatever is in init.
    */
   def unleash(): Unit = beQuietDuring {
@@ -151,8 +149,6 @@ class Power[ReplValsImpl <: ReplVals : ru.TypeTag: ClassTag](val intp: IMain, re
     intp.bind("$r", replVals)
     // Then we import everything from $r.
     intp interpret s"import ${ intp.originalPath("$r") }._"
-    // And whatever else there is to do.
-    init.lines foreach (intp interpret _)
   }
 
   trait LowPriorityInternalInfo {
diff --git a/src/repl/scala/tools/nsc/interpreter/ReplProps.scala b/src/repl/scala/tools/nsc/interpreter/ReplProps.scala
index f3115d9..0726dce 100644
--- a/src/repl/scala/tools/nsc/interpreter/ReplProps.scala
+++ b/src/repl/scala/tools/nsc/interpreter/ReplProps.scala
@@ -52,7 +52,7 @@ class ReplProps {
   val continueString = Prop[String]("scala.repl.continue").option getOrElse "| "
   val continueText   = {
     val text   = enversion(continueString)
-    val margin = promptText.lines.toList.last.length - text.length
+    val margin = promptText.linesIterator.toList.last.length - text.length
     if (margin > 0) " " * margin + text else text
   }
   val continuePrompt = encolor(continueText)
diff --git a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
index f1c9663..82b20bc 100644
--- a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
@@ -203,7 +203,7 @@ trait CommentFactoryBase { this: MemberLookupBase =>
         SafeTags.replaceAllIn(javadoclessComment, { mtch =>
           java.util.regex.Matcher.quoteReplacement(safeTagMarker + mtch.matched + safeTagMarker)
         })
-      markedTagComment.lines.toList map (cleanLine(_))
+      markedTagComment.linesIterator.toList map (cleanLine(_))
     }
 
     /** Parses a comment (in the form of a list of lines) to a `Comment`