Skip to content

Fix init error in test #8109

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 2 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions tests/run/tuples1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ object Test extends App {
val a6_4 = x6(4); val a6_4c: String = a6_4; println(s"a6_4 = $a6_4")
val a8_0 = x8(0); val a8_0c: String = a8_0; println(s"a8_0 = $a8_0")
val c0_0 = x0 ++ x0; val c0_0c: Unit = c0_0; println(s"c0_0 = $c0_0")
val c0_1 = x0 ++ x1; val c0_1c: Int *: Unit = c0_1c; println(s"c0_1 = $c0_1")
val c1_0 = x1 ++ x0; val c1_0c: Int *: Unit = c1_0c; println(s"c1_0 = $c1_0")
val c0_1 = x0 ++ x1; val c0_1c: Int *: Unit = c0_1; println(s"c0_1 = $c0_1")
val c1_0 = x1 ++ x0; val c1_0c: Int *: Unit = c1_0; println(s"c1_0 = $c1_0")
val c0_4 = x0 ++ x4; val c0_4c: (String, Int, String, Int) = c0_4; println(s"c0_4 = $c0_4")
val c4_0 = x4 ++ x0; val c4_0c: (String, Int, String, Int) = c4_0; println(s"c4_0 = $c4_0")
val c1_1 = x1 ++ x1; val c1_1c: (Int, Int) = c1_1; println(s"c1_1 = $c1_1")
Expand Down
6 changes: 3 additions & 3 deletions tests/run/typeclass-derivation2a.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ object TypeLevel {
def mirror(ordinal: Int): Mirror =
mirror(ordinal, EmptyProduct)

val label: Array[Array[String]] =
initLabels(0, 0, new mutable.ArrayBuffer[String], new mutable.ArrayBuffer[Array[String]])

private final val elemSeparator = '\000'
private final val caseSeparator = '\001'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liufengyun what happens if it is an inline val?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not be an error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, due to const-fold it's not an error. The checker now runs before const-fold, it thus reports an error.

But I think it's still good to report errors here, as in this case const-fold changes the semantics of programs, which is too subtle for end users.


val label: Array[Array[String]] =
initLabels(0, 0, new mutable.ArrayBuffer[String], new mutable.ArrayBuffer[Array[String]])

private def initLabels(start: Int, cur: Int,
elems: mutable.ArrayBuffer[String],
cases: mutable.ArrayBuffer[Array[String]]): Array[Array[String]] = {
Expand Down