Skip to content

Commit

Permalink
Add missing pattern match case in varianceInType
Browse files Browse the repository at this point in the history
  • Loading branch information
joroKr21 committed Dec 4, 2019
1 parent 8fa0fc2 commit 5699c5e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/reflect/scala/reflect/internal/Variances.scala
Expand Up @@ -289,6 +289,7 @@ trait Variances {
case PolyType(tparams, restpe) => inSyms(tparams).flip & inType(restpe)
case ExistentialType(tparams, restpe) => inSyms(tparams) & inType(restpe)
case AnnotatedType(annots, tp) => inAnnots(annots) & inType(tp)
case SuperType(thistpe, supertpe) => inType(thistpe) & inType(supertpe)
}

def apply(tp: Type, tparam: Symbol): Variance = {
Expand Down
4 changes: 4 additions & 0 deletions test/files/neg/t9911.check
@@ -0,0 +1,4 @@
t9911.scala:23: error: super may not be used on value source
super.source.getSomething
^
one error found
28 changes: 28 additions & 0 deletions test/files/neg/t9911.scala
@@ -0,0 +1,28 @@
// This should say:
// Error: super may not be used on value source
class ScalacBug {

class SomeClass {

type U

// Changing T or U stops the problem
def getSomething[T]: U = ???
}

trait Base {

// Changing this to a def like it should be stops the problem
val source: SomeClass = ???
}

class Bug extends Base {

override val source = {
// Not calling the function stops the problem
super.source.getSomething
???
}
}

}

0 comments on commit 5699c5e

Please sign in to comment.