Skip to content

regression: 2.13 failing bootstrap (culprit: PR 6025?) #455

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

Closed
SethTisue opened this issue Dec 6, 2017 · 5 comments
Closed

regression: 2.13 failing bootstrap (culprit: PR 6025?) #455

SethTisue opened this issue Dec 6, 2017 · 5 comments
Assignees

Comments

@SethTisue
Copy link
Member

SethTisue commented Dec 6, 2017

2.13.x just started failing bootstrap: https://scala-ci.typesafe.com/job/scala-2.13.x-integrate-bootstrap/594/consoleFull

class Testable(val c: String) extends AnyVal {
                  ^

🤔

afaict the only merged PR was scala/scala#6025 (@hrhino, merged by @retronym) and it passed PR validation, so I guess this is one of those weird times when a problem only shows up after re-STARR?

@retronym
Copy link
Member

retronym commented Dec 6, 2017

Maybe the PR validation was still in the -Xsource:2.12 regime (it was an old PR that hadn’t been rebased to the tip of 2.13)

@retronym retronym self-assigned this Dec 6, 2017
@retronym
Copy link
Member

retronym commented Dec 6, 2017

object Const { final val VAL = 1 ; final val VAR = 2 }
import Const._
object Test {
	def test(i: Int) = i match { case v @ (VAR | VAL) => v == VAR case _ => "default" }
	def main(args: Array[String]) {
		println(test(VAR))
		println(test(VAL))
		println(test(-1))
	}
}
⚡ scalac sandbox/test.scala && scala Test
true
false
default


⚡ qscalac sandbox/test.scala && scala Test
false
false
default

v is typed with Int(1).

@SethTisue
Copy link
Member Author

SethTisue commented Dec 6, 2017

you have to admit that of 1.type and 2.type, 1 is "least"

ah, lub humor

@retronym
Copy link
Member

retronym commented Dec 6, 2017

The root bug is either in:

  def numericLub(ts: List[Type]) =
    ts reduceLeft ((t1, t2) =>
      if (isNumericSubType(t1, t2)) t2
      else if (isNumericSubType(t2, t1)) t1
      else IntTpe)

Or maybe in the way the new code passes constants in without first deconsting them.

I'll revert until we get to the bottom of it.

@retronym retronym closed this as completed Dec 6, 2017
@retronym retronym reopened this Dec 6, 2017
@retronym
Copy link
Member

retronym commented Dec 6, 2017

Here's the code in the parser that was affected.

    def param(owner: Name, implicitmod: Int, caseParam: Boolean): ValDef = {
      val start = in.offset
      val annots = annotations(skipNewLines = false)
      var mods = Modifiers(Flags.PARAM)
      if (owner.isTypeName) {
        mods = modifiers() | Flags.PARAMACCESSOR
        if (mods.isLazy) syntaxError("lazy modifier not allowed here. Use call-by-name parameters instead", skipIt = false)
        in.token match {
          case v @ (VAL | VAR) =>
            mods = mods withPosition (in.token.toLong, tokenRange(in))
            if (v == VAR) mods |= Flags.MUTABLE
            in.nextToken()
          case _ =>
            if (mods.flags != Flags.PARAMACCESSOR) accept(VAL)
            if (!caseParam) mods |= Flags.PrivateLocal
        }
        if (caseParam) mods |= Flags.CASEACCESSOR
      }
      val nameOffset = in.offset
      val name = ident()
      var bynamemod = 0
      val tpt =
        if ((settings.YmethodInfer && !owner.isTypeName) && in.token != COLON) {
          TypeTree()
        } else { // XX-METHOD-INFER
          accept(COLON)
          if (in.token == ARROW) {
            if (owner.isTypeName && !mods.isLocalToThis)
              syntaxError(
                in.offset,
                (if (mods.isMutable) "`var'" else "`val'") +
                " parameters may not be call-by-name", skipIt = false)
            else if (implicitmod != 0)
              syntaxError(
                in.offset,
                "implicit parameters may not be call-by-name", skipIt = false)
            else bynamemod = Flags.BYNAMEPARAM
          }
          paramType()
        }
      val default =
        if (in.token == EQUALS) {
          in.nextToken()
          mods |= Flags.DEFAULTPARAM
          expr()
        } else EmptyTree
      atPos(start, if (name == nme.ERROR) start else nameOffset) {
        ValDef((mods | implicitmod.toLong | bynamemod) withAnnotations annots, name.toTermName, tpt, default)
      }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants