Skip to content

Fixes for fuzzing tests reported on Gitter #4401

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 15 commits into from
Apr 28, 2018

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Apr 28, 2018

No description provided.

@odersky
Copy link
Contributor Author

odersky commented Apr 28, 2018

This was quite enjoyable, trying to fix fuzzing problems in real time, as they are reported. But I won't be able to spend more time on this. So, reviewers, if you notice something, it would be good if you could fix it yourself and push on top of this PR.

@odersky
Copy link
Contributor Author

odersky commented Apr 28, 2018

This is best reviewed commit by commit.

odersky added 2 commits April 28, 2018 13:07
Should not be attempted if argument does not have a value type.
Test case is this one. I don't want to include it in the rgeression tests though
because it looks too noisy (i.e. we would likely get spurious failures for tiny
changes in the future).

    class i0 {
    type Ordering[i1, i2] = (=> i3[i1])
    def i4[i2, i3](i5: i1): i4[Any]    // error
    i8 += i14 {
    type i4[+i9] = i5
    def i7: Int = i6(5)
    class i9[i10 <: i16 <: i4[_], i12](val i14: i11[_], i4: i11) {  // error
    def i16[i14 >: i1]: i0 = ???
    implicit def i13[i4](i5: (=> i6)): i1[i6]   // error
    type i13[i7] = i13[i7]
    def i8[+i1[+i2] <: i0[i1]]](i9: => ii5[i7]): i7[i5] = sys.error();  // error // error
    def i10(i11: i4[i10.i4])(implicit i8: i0[i6#i0]) = i4 * i7 i5 i4! this match {
    case i14(i9) => 3 }
    }
    class i10 {
    type i13 = i10.i8
    val i11 =
    var i21 =
    case class Tuple1(i3: i1, i4: i4, i6)
    }
    (new i10(i13))
    }
    }
    package i1.i0
    object i12 {
    def i9(i10: i1)(implicit i9: i8[Boolean]) = implicitly[i9](i10: Any, i4, i9) {}
    case class i9[i14[i2]](i16: i11[i8[i2]]) extends i10[i4, i14] {
    def this(i11: i12) = {
    val i5 = new i5[Int, Int]
    }
    }
@@ -1004,7 +1004,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
def sameTypes(trees: List[tpd.Tree], trees1: List[tpd.Tree]): Boolean = {
if (trees.isEmpty) trees.isEmpty
else if (trees1.isEmpty) trees.isEmpty
else (trees.head.tpe eq trees1.head.tpe) && sameTypes(trees.tail, trees1.tail)
else (trees.head.typeOpt eq trees1.head.typeOpt) && sameTypes(trees.tail, trees1.tail)
Copy link
Member

Choose a reason for hiding this comment

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

I think I have a better fix for that one: #4402

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smarter I agree. Can you push #4402 on top of this and revert my corresponding commit? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see you have already started doing this, so please go ahead. Otherwise I could have also approved yours and done the rest myself.

I assumed the existing tests were already sufficient to avoid confusion before
we try a substitution of one for the other, but was wrong in the case where
both sides are riddled with errors.

Test case (too long/fuzzy to be included in regression tests):

case class i0[i1, i4](i4: i1)
object i4 {
implicit def i4[i1: i0](i4: i1): i1
def i4[i4[_], i4[_], i4[i4]](i4: i1[i4]): i4[i4] = null
}
class i1 extends i4 {
case _ =>
}
val i1 = new i0 {
type i1[i4] = i4 with i0[i4]
trait i1 extends i4 {
type i1[i4] = i1 type i4 = i4#i4 def i4[i4 >: i4](i4: => i4): i4.i4[_ <: i4] = i4
i4(i1, i4: i4)
def unapply(i2: i4) = sys.error("")
}
trait i4
trait throw {
val i3: i4 = i4(5, i1: i1,
i4: i4)
def i3: i4[Int] = i1(null: Any) i3(0, i1())
println(i3 <= i4)
}
object i1 {
implicit def i1(i4: i4): Int
def i1[@specialized i4 <: i4[i4]](i1: i4): i4[Int]
def i1[@specialized i4, i4 <: i1](i4: i4): i4[i1[i4]] = new i4[i1] {
val i1 = (new i2.i1
}
}
Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM!

This reverts commit f61596b.

A better fix is implemented in the next commit
@odersky
Copy link
Contributor Author

odersky commented Apr 28, 2018

Some existing neg tests give more errors now that we check arguments of erroneous functions anyway. So these error counts need to be updated. Otherwise the last two commits LGTM.

@smarter smarter merged commit c966be0 into scala:master Apr 28, 2018
@allanrenucci allanrenucci deleted the fix-fuzzing-1 branch April 28, 2018 14:04
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

Successfully merging this pull request may close these issues.

2 participants