scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.84k stars 1.05k forks source link

A variety of bugs (42 or so). #4389

Closed sir-wabbit closed 5 years ago

sir-wabbit commented 6 years ago

All files were generated using https://github.com/alexknvl/fuzzball

https://files.gitter.im/lampepfl/dotty/dWPj/exc-files.zip

There could be some duplicates. Most snippets have syntax errors in them. Feel free to create separate issues for individual bugs and reference them here, I'll update the list.

IN 3e54d491b47b3dc8034b4d16f4389554a09b94ba.scala
IN e7bb3c4598709966b31dbec096e11229922d4eb7.scala
IN b11c241ce88c83c0c6f949b3106d4e7ff9ef3d99.scala
IN 87b1e375168a7888470eefc1fb867d0c9f550865.scala
IN 0f12f42d878dcd4cb8b8ab62dbfb6b41861989b1.scala
scala.MatchError: This(Ident()) (of class dotty.tools.dotc.ast.Trees$This)
  at dotty.tools.dotc.typer.Namer$ClassCompleter.parentType$1(Namer.scala:910)
  at dotty.tools.dotc.typer.Namer$ClassCompleter.checkedParentType$1(Namer.scala:928)
  at dotty.tools.dotc.typer.Namer$ClassCompleter.$anonfun$completeInCreationContext$5(Namer.scala:981)
  at scala.collection.immutable.List.map(List.scala:283)
--
IN dea0cf7fd832a6f39963ddda6ffd89b336d18808.scala
IN 49fc58e3885b671a7569326d1ad6590f9668a1a2.scala
IN 44131e7b1cdc0192d39471ad01e2045991ec48b4.scala
IN eff46343d34261c03ec1223a254a3d39587f8d96.scala
java.lang.ClassCastException: dotty.tools.dotc.core.Types$CachedTypeRef cannot be cast to dotty.tools.dotc.core.Types$TermRef
  at dotty.tools.dotc.core.Types$TermRef$.apply(Types.scala:2150)
  at dotty.tools.dotc.core.SymDenotations$SymDenotation.termRef(SymDenotations.scala:1167)
  at dotty.tools.dotc.typer.TypeAssigner.assignType(TypeAssigner.scala:536)
  at dotty.tools.dotc.typer.TypeAssigner.assignType$(TypeAssigner.scala:535)
--
IN 37e5de7d6a0fa8cc9123fd570d9fd82d1fc5767f.scala
IN 36e924e6d37279c86a4420f3a80810e419bd31dd.scala
java.lang.AssertionError: assertion failed
  at scala.Predef$.assert(Predef.scala:204)
  at dotty.tools.dotc.ast.Trees$.$anonfun$flatten$1(Trees.scala:786)
  at scala.collection.immutable.List.foreach(List.scala:389)
  at dotty.tools.dotc.ast.Trees$.flatten(Trees.scala:785)
--
IN 14b960e57195554a6a085eae8e039a949e8b106d.scala
IN 9beb77e068c404c0c55b6bff0098607ff1a40c94.scala
IN 628b3c175445b95d9155223a2651ad97c6091657.scala
IN 796a428b317e90b5409fbbc886ed6077f801e91f.scala
IN 670b1276fc9546345aa3a1f1cd07439d77fbb913.scala
IN c091e02ebdd6f7de5e190325fdbb80c8aca00c62.scala
java.lang.AssertionError: assertion failed: position error: position not set for Ident(<error>) # 154097
  at scala.Predef$.assert(Predef.scala:219)
  at dotty.tools.dotc.ast.Positioned.check$1(Positioned.scala:179)
  at dotty.tools.dotc.ast.Positioned.$anonfun$checkPos$4(Positioned.scala:203)
  at dotty.tools.dotc.ast.Positioned.$anonfun$checkPos$4$adapted(Positioned.scala:203)
--
IN 485e5cbc7e78bd60b1063fc3542d096d4a78fdf7.scala
IN f181ded4073f5dbe2819dc049b01f3165ac5fd36.scala
IN fbeb627f550e8786ba5b9f81cdc2558c8fc6c1e0.scala
IN 028127de3ac8c2ee6ccde25072d765581dbd06f9.scala
IN c4dc64b31b9730c4bc565fda57a49b7350b0c3fa.scala
IN 657656be94175b0a476d5ce17b9f1e196ab67b38.scala
IN 31fe0d61224c99962a43598263b06c0435aae202.scala
IN 85ca89e9d0bdfd0a91f38831fdb97afd42848f75.scala
java.lang.AssertionError: assertion failed: class i1 has non-class parent: AppliedType(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),class i1)),type i2),List(dotty.tools.dotc.core.Types$ErrorType$$anon$4@fd5330))
  at scala.Predef$.assert(Predef.scala:219)
  at dotty.tools.dotc.core.SymDenotations$ClassDenotation.$anonfun$computeBaseData$1(SymDenotations.scala:1471)
  at scala.collection.immutable.List.foreach(List.scala:389)
  at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:1469)
--
IN aa8494d600b45595a55da3a6ba01e9f2b4d7e2d4.scala
IN 28752b8fb9b6db06fff4c606c3a402dc12b0ee06.scala
IN c1acdd088ec0e3f08433a147059c83f68019f53c.scala
IN dc731deada78bc82a0367866d3b7be065344d6f3.scala
IN d7239fc91a514de20e29078cf7f8a4fac6c2f2c3.scala
java.lang.AssertionError: assertion failed:  & Int / TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing),TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any)) & TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),module scala),class Int)
  at scala.Predef$.assert(Predef.scala:219)
  at dotty.tools.dotc.core.Types$AndType$.apply(Types.scala:2482)
  at dotty.tools.dotc.typer.TypeAssigner.assignType(TypeAssigner.scala:485)
  at dotty.tools.dotc.typer.TypeAssigner.assignType$(TypeAssigner.scala:484)
--
IN 402dda87200c7401f8a82626928c5dbb7a50bb79.scala
IN dc03aa91b83c86d65e5e5323e17b773e0d265ec2.scala
IN bdc904bfe63fb5bbc7862ae906073703a1559602.scala
IN 72496edbad3b3f4ba69d9a4675213f08cce60f12.scala
IN b82054893e0db44e31ae82d696c19c1fbc7be55c.scala
IN 9348b398326cdf60003cbaf79dc0f84d10fe3d2b.scala
IN efb3abc8bfefc00aa3787ba958f697d7159e1dee.scala
IN fa9901359760c3dfeea8a38df42538050db587fa.scala
IN 9040cce707802c656cd89d4fd33b241f1c8029da.scala
IN 5d506217aaf5e71195b85b12ca59245f35152885.scala
IN b8455b659c531a079763abf0f3ef5eb4451eda36.scala
IN 9a2c70eb0f9a9d78fd9532ae4266957e1561e707.scala
IN 9aa9274085e2f2cbd797a9c798e8f0ca355046eb.scala
IN d20a22b54bc6081775291bc917375d06156546b0.scala
IN 8af8cf4a9b8ef41468c4d57228ee7cf11ab3241e.scala
java.lang.AssertionError: assertion failed: List(TypeDef(i9,Ident(Int)), ValDef(i10,Ident(Int),Ident(i1))) != List(TypeDef(i9,Ident(Int)), ValDef(i10,Ident(Int),Select(This(Ident(<refinement>)),i1)), DefDef(i10_=,List(),List(List(ValDef(x$1,TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,class <refinement>)),type Int)],EmptyTree))),TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Unit)],Literal(Constant(()))))
  at scala.Predef$.assert(Predef.scala:219)
  at dotty.tools.dotc.typer.Typer.$anonfun$typedRefinedTypeTree$1(Typer.scala:1197)
  at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
  at dotty.tools.dotc.typer.Typer.typedRefinedTypeTree(Typer.scala:1191)
--
IN 3760adc72d035a66641c59926dcfa5e2130479a4.scala
--
IN d89176c23ea5b39655535152b1f47fa2a883ba89.scala
IN 1d1f57703bbd37dd850480cb5d99130930be08c9.scala
IN 99d577a4ade8aef7a68f2f4972c016af2126e854.scala
IN 597a43d8b9d210fe6fb04bf3059811776e7f20d9.scala
IN 9484d5d85ae512ee3861818ea4df11d924fcf797.scala
IN 34d778fcc0ad3dccec0fa7b83b3333868bda8251.scala
IN 64f042fa3a069619cfee211dd732b5be791e133b.scala
IN 3dc1e1bf0f5e40363aa99c84a83373a713009d44.scala
IN a92dabf8d9e828621e6f1ba07acf6627a49b4a3f.scala
IN 876beb6d1303bd2aaf8a571eed417e4681c25d73.scala
IN 827a8c670660b1c8bbe210e7a9dffea632ee39ea.scala
IN c049cb628afe555533c1c2367ca71a2941ff0cbb.scala
IN a9a748db44126596ccbe8ffcd5b5998753b931d8.scala
IN 9bd90df39a3b6924dc04ef684904825cb2802729.scala
IN ca106cb710ff6a9f4d1752d3a1c2d685877d3e55.scala
IN b91bd732c254800c09d8ebac125ef0f0421cf9d9.scala
IN 366525577470a6e3ecac0b77b1dcdc58405156ed.scala
IN a1dc444387638f31146f64d4745e896691a9c6a1.scala
IN 9c76a8fbb7ade0491135ace39023e4b80108563e.scala
IN c9121b21dd022c3ec44f6fe3615923b3d823f7e0.scala
IN b39f34ce574ac51b821ab409e48fd4acee02c755.scala
IN f901d61a9bc6053c910245552c74c4c73e43efe0.scala
IN 3eb86ec97c34b609dcc13323ddd05f669ea91288.scala
dotty.tools.dotc.ast.Trees$UnAssignedTypeException: type of TypeTree is not assigned
  at dotty.tools.dotc.ast.Trees$Tree.tpe(Trees.scala:96)
  at dotty.tools.dotc.typer.Checking$$anon$5.apply(Checking.scala:327)
  at dotty.tools.dotc.typer.Checking$$anon$5.apply(Checking.scala:298)
  at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1319)
--
IN ed71e8db3233023ed7a8795d01bbc03b6b063a8b.scala
java.lang.ClassCastException
--
IN 9baccf94095f1bd680e9bb75cc552d0784b8b9c2.scala
java.lang.AssertionError: assertion failed: Mode(Type,ImplicitsEnabled)
  at scala.Predef$.assert(Predef.scala:219)
  at dotty.tools.dotc.ast.desugar$.apply(Desugar.scala:1126)
  at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1816)
  at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1829)
--
IN 5be1c2b57f5e6b8bd7e23fc1cc74ae0c4ac6d6a5.scala
IN 5d6c276f1c1bf438799df096416f89683fc4fcaa.scala
IN 5a760f543aeb770614235cf247b035f8f2924f8a.scala
IN 52fa076196b986c41897259b783cb4d1b2bdd5f3.scala
IN 6291e318fc02ee941333a81928ec3ce3e4afbfa8.scala
IN 4a5fb957ddf1b97d1e06db42848a3bceeb1e4b74.scala
IN 015ea9cf2d07b27200a33c4451bfc4c93afe213e.scala
IN ba77fdb2a05d078e9c400f45d1fe12fa769a1c1f.scala
IN 50960852a3aa14a9455822b00df49c2c506c2bf2.scala
IN 839c0001d8c945deb1f79df9c4d78de183153819.scala
IN bf85113c67ed65e7402c3c3c44cdefa5bff79ee0.scala
IN d9366dfb4c3f01352f197fec820c771a96500a98.scala
IN f8d98c8fcb9b0c66058a3dc04221582ef21f30c2.scala
IN 91e050e423baa437d6adfcbec48fcd5dcad65a77.scala
IN 87e911d4a30f9df0be954fcb2cd693c86d4ea19d.scala
IN d64eca0bd5520ca9551c97c6e0190ff6c81bd7eb.scala
java.lang.AssertionError: assertion failed: invalid prefix TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing),TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any))
  at scala.Predef$.assert(Predef.scala:219)
  at dotty.tools.dotc.core.Types$NamedType.<init>(Types.scala:1588)
  at dotty.tools.dotc.core.Types$TermRef.<init>(Types.scala:2080)
  at dotty.tools.dotc.core.Types$CachedTermRef.<init>(Types.scala:2119)
--
IN 87e911d4a30f9df0be954fcb2cd693c86d4ea19d.scala
IN fdff7381025ab9092a1f93c9c145b177bc7d1fcb.scala
IN 35089d35a316726b914741884113b859aa6bfeb5.scala
IN fa895929a0991e2b6747201ab2e9522b7869423c.scala
IN 3cd12b064ca064177c035ef58d3a9cbe90980d7e.scala
IN 06abe47b5828fec1c1975aae63202b4f93cf0bac.scala
IN 7326aaaa717bccc7d8fee10995a595f21edb44c6.scala
IN 98d78217f6e6011d3d5e072ba751e5cef71bf40d.scala
IN 86ffb5f29d6fcab5893656be0307f2b8933b1498.scala
IN 048e0594728ea7cdff7497c4e90bf702f220b206.scala
IN 62fa6e56c343b91f6069fbe8812bc8deb697f24b.scala
IN 649af74727c8b64104f090a3cafb1ad8c392e22d.scala
IN 2bd7cd0e80b641fa33d269c737c79e9d38f3bd64.scala
java.lang.ClassCastException
--
IN e5958babfe7651fc7a2bcc847d75f8fb1d86239d.scala
IN b4131f43afdca7e9af9915386c4badc068fe5ca4.scala
IN eea72c2d04f6938ea4c9007a9acf580a9862639a.scala
IN 95bbe2ee00e10cbb3890bcbfe5da2b584a8388e1.scala
IN c8f351c9685739fcf49bd7ce406e431b2a6b7cf7.scala
IN 944abc99641166a85daa0ac21946aaa6d2cf2bba.scala
java.lang.AssertionError: assertion failed
  at scala.Predef$.assert(Predef.scala:204)
  at dotty.tools.dotc.core.Types$CachedTypeRef.<init>(Types.scala:2125)
  at dotty.tools.dotc.core.Uniques$NamedTypeUniques.newType$1(Uniques.scala:61)
  at dotty.tools.dotc.core.Uniques$NamedTypeUniques.enterIfNew(Uniques.scala:65)
--
IN 6fdfd91c2db76511d40c54ec406c59fdf8af7b09.scala
IN 919792033e4adc9121da1a721db573b3b5565113.scala
java.lang.AssertionError: assertion failed:  & <refinement> / TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing),TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any)) & TypeRef(NoPrefix,class <refinement>)
  at scala.Predef$.assert(Predef.scala:219)
  at dotty.tools.dotc.core.Types$AndType$.apply(Types.scala:2482)
  at dotty.tools.dotc.core.Types$ClassInfo.selfType(Types.scala:3482)
  at dotty.tools.dotc.core.Types$ThisType.underlying(Types.scala:2188)
--
IN fd0fff9cf5a3c608485c0a1b95ad5fd6d8db7246.scala
java.lang.AssertionError: assertion failed: found: null.asInstanceOf[Some]: Some, expected: Symbol('i2)
  at scala.Predef$.assert(Predef.scala:219)
  at dotty.tools.dotc.typer.Implicits$ImplicitSearch.<init>(Implicits.scala:847)
  at dotty.tools.dotc.typer.Implicits.$anonfun$inferImplicit$4(Implicits.scala:816)
  at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
--
IN 471d33abf565d5dd3691679237f148638f4ff115.scala
java.lang.AssertionError: assertion failed: no companion i7 in dotty.tools.dotc.core.Scopes$MutableScope@4e79bb24
  at scala.Predef$.assert(Predef.scala:219)
  at dotty.tools.dotc.typer.NamerContextOps$.dotty$tools$dotc$typer$NamerContextOps$$findModuleBuddy(Namer.scala:167)
  at dotty.tools.dotc.typer.NamerContextOps.$anonfun$adjustModuleCompleter$2(Namer.scala:159)
  at dotty.tools.dotc.core.SymDenotations$LazyType.sourceModule(SymDenotations.scala:1940)
--
IN 569812032e895bd8d1f726ae909f0b38512bc74b.scala
java.lang.AssertionError: assertion failed: non-existent getter denotation (val <none>) for getter(i1$default$1)
  at scala.Predef$.assert(Predef.scala:219)
  at dotty.tools.dotc.typer.Applications$Application.findGetter$1(Applications.scala:370)
  at dotty.tools.dotc.typer.Applications$Application.findDefaultGetter(Applications.scala:375)
  at dotty.tools.dotc.typer.Applications$Application.tryDefault$1(Applications.scala:430)
--
IN fb365ec2e9f49b0963553f410a39d839e184b485.scala
java.lang.ClassCastException: dotty.tools.dotc.core.Symbols$Symbol cannot be cast to dotty.tools.dotc.core.Symbols$ClassSymbol
  at dotty.tools.dotc.core.Symbols$Symbol.asClass(Symbols.scala:503)
  at dotty.tools.dotc.core.SymDenotations$ClassDenotation.$anonfun$computeMemberNames$1(SymDenotations.scala:1750)
  at dotty.tools.dotc.core.SymDenotations$ClassDenotation.$anonfun$computeMemberNames$1$adapted(SymDenotations.scala:1749)
  at scala.collection.immutable.List.foreach(List.scala:389)
--
IN 70a87d879bff85bdad921c0feca802ca2bfc974d.scala
java.lang.AssertionError: assertion failed: data race? overwriting type i6 with type i6 in type TypeRef(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),module class i0$)),type i4),type i6),
           |last sym id = 8760, new sym id = 8762,
           |last owner = module class <root>, new owner = module class <root>,
           |period = frontend at run 2
  at scala.Predef$.assert(Predef.scala:219)
--
IN 74fe12410cd48a672c4482971aba6144549a29dd.scala
java.lang.StackOverflowError
  at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:3941)
  at dotty.tools.dotc.core.Substituters.substRecThis(Substituters.scala:161)
  at dotty.tools.dotc.core.Substituters.substRecThis$(Substituters.scala:150)
  at dotty.tools.dotc.core.Contexts$Context.substRecThis(Contexts.scala:71)
--

https://github.com/lampepfl/dotty/issues/4377 - already reported

IN 53733e0d1dbd22db14cb42456dc6c0e52385566a.scala
java.lang.AssertionError: assertion failed: unreachable
  at scala.Predef$.assert(Predef.scala:219)
  at dotty.tools.dotc.printing.Formatting$.needsExplanation$1(Formatting.scala:194)
  at dotty.tools.dotc.printing.Formatting$.$anonfun$explanations$2(Formatting.scala:200)
  at scala.collection.immutable.List.flatMap(List.scala:335)

https://github.com/lampepfl/dotty/issues/4373 - already reported

IN a4ff76c16ba3ee1d33dd1a84449ec829a9a97aa6.scala
IN 39bf335240b828efaa825fa242422f0eaa6d7ca2.scala
IN 1e3ef21bb17fbe13bf3beaf13a18ca382b52a469.scala
java.lang.AssertionError: assertion failed: TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class scala)),module Predef),type String) TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing),TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any))
  at scala.Predef$.assert(Predef.scala:219)
  at dotty.tools.dotc.core.Types$OrType.<init>(Types.scala:2527)
  at dotty.tools.dotc.core.Types$CachedOrType.<init>(Types.scala:2555)
  at dotty.tools.dotc.core.Types$OrType$.apply(Types.scala:2560)

https://github.com/lampepfl/dotty/issues/4370 - already reported

IN 830cdab909e6a0cbdb008265cc196a209567e658.scala
java.lang.StackOverflowError
  at dotty.tools.dotc.typer.VarianceChecker$Validator$.$anonfun$apply$2(VarianceChecker.scala:89)
  at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
  at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
  at dotty.tools.dotc.reporting.trace$.apply(trace.scala:39)
smarter commented 6 years ago

IN 70a87d879bff85bdad921c0feca802ca2bfc974d.scala java.lang.AssertionError: assertion failed: data race? overwriting type i6 with type i6 in type TypeRef(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class )),module class i0$)),type i4),type i6),

I wasn't able to reproduce this one on master, for me compilation stops normally after 19 errors, are you using any compiler flag?

sir-wabbit commented 6 years ago

No, I tested them using

class CompilationTests2 extends ParallelTesting {
  import ParallelTesting._
  import TestConfiguration._
  import CompilationTests2._

  // Test suite configuration --------------------------------------------------

  def maxDuration = 30.seconds
  def numberOfSlaves = 5
  def safeMode = Properties.testsSafeMode
  def isInteractive = SummaryReport.isInteractive
  def testFilter = Properties.testsFilter

  // Positive tests ------------------------------------------------------------

  // Run tests -----------------------------------------------------------------

  @Test def runAll: Unit = {
    implicit val testGroup: TestGroup = TestGroup("runAll")
    compileFilesInDir("tests/result", defaultOptions)
  }.checkRuns()
...
}
smarter commented 6 years ago

Oh I see, it needs -Yno-double-bindings to crash, which is one of the flags we use in our test suite. (https://github.com/lampepfl/dotty/blob/master/compiler/test/dotty/tools/vulpix/TestConfiguration.scala)

sir-wabbit commented 6 years ago

Another one:

object i0 {
(null: String) match {
case (i1: Int |) => false
isInstanceOf lazy 4 | (_: Any) =>
println()
case i2() => extends _
case _ =>
case i3: String => Set[Int](new i1())
def this(i1: Int, i2: Int, i4: Int) = 0
case _ =>
}
}
exception occurred while compiling 
IN 0d3d32f4bfeedb17806fb4384e69a62353f26377.scala
java.lang.ClassCastException: dotty.tools.dotc.core.Types$CachedTypeRef cannot be cast to dotty.tools.dotc.core.Types$TermRef
  at dotty.tools.dotc.core.Types$TermRef$.apply(Types.scala:2150)
  at dotty.tools.dotc.core.SymDenotations$SymDenotation.termRef(SymDenotations.scala:1167)
  at dotty.tools.dotc.typer.Typer.$anonfun$typedClassDef$1(Typer.scala:1538)
  at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
smarter commented 6 years ago

Same stack trace as eff46343d34261c03ec1223a254a3d39587f8d96.scala so same issue probably.

sir-wabbit commented 6 years ago
object i0 {
def i1() = {
var i2: Any = new Array[this]()
i2.i5(0) += 123
val i6: 3 = 'i2('i219, 'i3')
i16 = 2 }
object i19 {
def i15(i12: => Any): String = 1
}
IN cb3ee9bdc9fb731e8e0c244511569c5790d59917.scala
dotty.tools.dotc.ast.Trees$UnAssignedTypeException: type of Literal(Constant(0)) is not assigned
        at dotty.tools.dotc.ast.Trees$Tree.tpe(Trees.scala:96)
        at dotty.tools.dotc.ast.tpd$.sameTypes(tpd.scala:1007)
        at dotty.tools.dotc.ast.tpd$TypedTreeCopier.Apply(tpd.scala:500)
        at dotty.tools.dotc.typer.Lifter.liftAssigned(EtaExpansion.scala:62)
sir-wabbit commented 6 years ago

Maybe this is the same problem as in eff46343d34261c03ec1223a254a3d39587f8d96, but stacktraces are a bit different.

class i0 {
private var main(i1: String): Unit = {
class i2 extends AnyRef {
def i3 = 0
}
def this() = { this(i4); i3 }
}
}
IN c9aee3837da3f3ed3b5027953922b89ead5aee96.scala
java.lang.ClassCastException: dotty.tools.dotc.core.Types$CachedTypeRef cannot be cast to dotty.tools.do
tc.core.Types$TermRef
        at dotty.tools.dotc.core.Types$TermRef$.apply(Types.scala:2150)
        at dotty.tools.dotc.core.Types$TermRef$.apply(Types.scala:2156)
        at dotty.tools.dotc.core.Types$NamedType$.apply(Types.scala:2142)
        at dotty.tools.dotc.core.Types$Type.select(Types.scala:1166)
sir-wabbit commented 6 years ago
class i0 {
type Ordering[i1, i2] = (=> i3[i1])
def i4[i2, i3](i5: i1): i4[Any]
i8 += i14 {
type i4[+i9] = i5
def i7: Int = i6(5)
class i9[i10 <: i16 <: i4[_], i12](val i14: i11[_], i4: i11) {
def i16[i14 >: i1]: i0 = ???
implicit def i13[i4](i5: (=> i6)): i1[i6]
type i13[i7] = i13[i7]
def i8[+i1[+i2] <: i0[i1]]](i9: => ii5[i7]): i7[i5] = sys.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]
}
}
IN 4954cd0302868e2d083c9b996c467b14ff868f28.scala
java.lang.AssertionError: assertion failed: found: implicitly[i9](Tuple3.apply[Any, Nothing, Nothing](i10: Any, i4, i9)): i1.i0.i12.i9, expected: ?{ apply: ? }
        at scala.Predef$.assert(Predef.scala:219)
        at dotty.tools.dotc.typer.Implicits$ImplicitSearch.<init>(Implicits.scala:847)
        at dotty.tools.dotc.typer.Implicits.$anonfun$inferImplicit$4(Implicits.scala:816)
        at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
sir-wabbit commented 6 years ago
import
object i0 {
def i1[i2[_]](implicit i3: i2[Int]) = ()
i1(()) }
IN dc3c9176fadf2312a5d6627ae6c3644d6a99c29e.scala
java.lang.AssertionError: assertion failed: position error: position not set for Ident(<empty>) # 1673268
        at scala.Predef$.assert(Predef.scala:219)
        at dotty.tools.dotc.ast.Positioned.check$1(Positioned.scala:179)
        at dotty.tools.dotc.ast.Positioned.checkPos(Positioned.scala:216)
        at dotty.tools.dotc.typer.FrontEnd.$anonfun$parse$1(FrontEnd.scala:49)
sir-wabbit commented 6 years ago
abstract class i0 {
def i1(i2: Int)(i3: Int): Int
<i1> tailrec match {
case i2: i2[Int] => 15
case '- ' ' =>
new i1(42)
}
IN bafb78b5b24ce0f0f6e6d9beff7d08577995613d.scala
java.lang.AssertionError: assertion failed: position error, parent position does not contain child positon
parent          = PostfixOp(Literal(Constant(null)),Ident(i2)),
parent position = [120..121],
child           = Literal(Constant(null)),
child position  = <76..76>
sir-wabbit commented 6 years ago
object i0 {
def unapply(i1: Int)(i6: List[Int]): Int = {
case _ => case _ { if (true) i6 } }
def i7(i8: i0) = i1 match {
case i0(_) =>
(i1, i8) match {
case i0(i1, i1) => case _ => i2
}
}
object i5 {
import collection.mutable._
try { ??? mutable { case i1(i5, i3, i4) => i5 })
}
IN 7de4dfdc25b8989dd8f6098452b883927cb4be14.scala
scala.MatchError: Block(List(DefDef($anonfun,List(),List(List(ValDef(i6,TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class immutable)),class List),List(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),module scala),class Int)))],EmptyTree))),TypeTree[TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),module scala),class Int)],Apply(Apply(Select(Ident(i0),unapply),List(Literal(Constant(null)))),List(Ident(i6))))),Closure(List(),Ident($anonfun),EmptyTree)) (of class dotty.tools.dotc.ast.Trees$Block)
        at dotty.tools.dotc.typer.Applications.unapplyImplicits$1(Applications.scala:969)
        at dotty.tools.dotc.typer.Applications.$anonfun$typedUnApply$1(Applications.scala:993)
        at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
        at dotty.tools.dotc.typer.Applications.typedUnApply(Applications.scala:841)
sir-wabbit commented 6 years ago
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
}
}
IN aa9329208e83b050befe7a57f33d5904a2d7e058.scala
java.lang.ClassCastException: dotty.tools.dotc.core.Types$CachedMethodType cannot be cast to dotty.tools.dotc.core.Types$TypeLambda
        at dotty.tools.dotc.core.Types$TypeParamRef.copyBoundType(Types.scala:3286)
        at dotty.tools.dotc.core.Substituters.subst(Substituters.scala:13)
        at dotty.tools.dotc.core.Substituters.subst$(Substituters.scala:10)
        at dotty.tools.dotc.core.Contexts$Context.subst(Contexts.scala:71)
sir-wabbit commented 6 years ago
package i0
trait i0 {
type i0
type i0[i1] = { def I2 = if (I2) i0 }
println( + I2 + i1)
}
object I2 {
def I2(I2: String): Boolean = ???
inline def List(i1: String, val I2: Int) = 1
}
IN c3bf685ae60bfb5a8f56c5b9578909e5145f0bb8.scala
java.lang.AssertionError: assertion failed
        at scala.Predef$.assert(Predef.scala:204)
        at dotty.tools.dotc.core.TypeOps.dominators$1(TypeOps.scala:143)
        at dotty.tools.dotc.core.TypeOps.approximateOr$1(TypeOps.scala:200)
        at dotty.tools.dotc.core.TypeOps.orDominator(TypeOps.scala:210)
sir-wabbit commented 6 years ago

possibly a duplicate of #4370

class i0 {
type i1 = {
override def toString <: i2
def i2: i0 { type i2 = i1 } = i2.i2 }
}
trait i2 {
type i1
def i2[i2](i2: i2): i0[i2]
}
new i2[i2] {
type i2 = i2[i2]
val i2: i0[_] & i2[i2] = Nil
}
class i2[i2] {
def i2(i2: Function1[i1[_]]): Either[Dynamic] = i2
def i2[i2 <: String](implicitly: i2[_]): i2[i2] = null
}
object i2 {
val i2: Seq[_] = sys.error("")
val i2 = Seq(new i2)
Console.println(i2[i2].i2)
}
IN 2c27289a8eb7deb6485d9991ef63d597a729
f5e1.scala
java.lang.StackOverflowError
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.isType(SymDenotations.scala:439)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.isAbstractOrAliasType(SymDenotations.scala:540)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.isAliasType(SymDenotations.scala:537)
        at dotty.tools.dotc.typer.VarianceChecker$Validator$.$anonfun$apply$2(VarianceChecker.scala:90)
sir-wabbit commented 6 years ago
<iI6>{I6}#I6{}
val I3 = new I2 with i0[Any]((I6: Int) I6> new toInt) implicit def I3[i5[_]]( I2: I2[I6, I6])#I2[I6]] = ???
def I2[I6 <: I1] = new i0[I6] {
def I6(scala.I6: Array[I1]) = {
val i5 = None
I6 = i5.asInstanceOf[Double]
}
I2.I6 == if (!I2.I6 =!= +I6' + I6 + I6 - 10) || I4 == true
case None => !1
def this() = 1
}
trait i5 {
type I2 >: Null
def I6( I2: List[Long, Nothing] = ???
I6(I6) +=( I6)
}
private var I6 extends i0[I6, I6] with I6[Int] {
var I2: I1[Option] = I6 with Dynamic {
val I1 = new Array[Nothing](1, 2)
}
IN 6302a4a20a03cdae0e22b2efae2cb3ca50133543.scala
dotty.tools.dotc.ast.Trees$UnAssignedTypeException: type of Ident(I6) is not assigned
    at dotty.tools.dotc.ast.Trees$Tree.tpe(Trees.scala:96)
    at dotty.tools.dotc.ast.TypedTreeInfo.refPurity(TreeInfo.scala:402)
    at dotty.tools.dotc.ast.TypedTreeInfo.refPurity$(TreeInfo.scala:401)
    at dotty.tools.dotc.ast.tpd$.refPurity(tpd.scala:21)
sir-wabbit commented 6 years ago
class i0[i1]
class i1 extends i0[Int]
object i0 {
implicit val i2: i1 { type i1 = i1; object i2 {}
def i2[i1, i2 <: i1 <: i0[i2]](implicit i2: i1): i0 { type i2 = i1; }
trait i2[+i2[i2]] {
def i2[i2[i2] <: i0[i2], i2](i2: i0[i2]): i2[i2] =
i1 match {
case i1: i2[i2] => i2
case i2: i2[i2] => i2
}
}
IN d7eb8e3848449aee365b2c0b7b7ffaca742e8f38.scala
java.lang.ClassCastException: dotty.tools.dotc.core.Types$LambdaParam cannot be cast to dotty.tools.dotc.core.Symbols$Symbol
    at dotty.tools.dotc.core.TypeComparer.compareCaptured$1(TypeComparer.scala:884)
    at dotty.tools.dotc.core.TypeComparer.isSubArg$1(TypeComparer.scala:896)
    at dotty.tools.dotc.core.TypeComparer.isSubArgs(TypeComparer.scala:905)
    at dotty.tools.dotc.core.TypeComparer.isMatchingApply$1(TypeComparer.scala:685)
sir-wabbit commented 6 years ago
object i0 {
abstract class i0[i0, i0, i0, i0] {
val I1 = new i0
val I1: Int = I1 {
val I1 = I1
}
}
object I1 {
def I1[I1 >: i0, I1 >: I1]: i0[i0, I1] = i0[i0]
def I1() i0 = i0
import I1.i0()
}
}
trait I1[-I1, +i0[i0 <: I1] <: I1#i0[(i0, I1, I1], I1 <: i0)] {}
class I1 {}
object i0 {
type i0[i0] <: i0[i0, I1]]
}
trait I1
class I1 extends i0
IN e293c442ee95a3e332eadee8f1db16ef8164a3e7.scala
java.lang.AssertionError: assertion failed
    at scala.Predef$.assert(Predef.scala:204)
    at dotty.tools.dotc.core.ConstraintHandling.addToConstraint(ConstraintHandling.scala:339)
    at dotty.tools.dotc.core.ConstraintHandling.addToConstraint$(ConstraintHandling.scala:335)
    at dotty.tools.dotc.core.TypeComparer.addToConstraint(TypeComparer.scala:19)
sir-wabbit commented 6 years ago
object i0 {
class i0 {}
case class I2() {}
}
(I2 _*)
}
trait I2[I2] {
val I2: I2
type I2 = super.I2
}
class I2[I2] { class I2 extends i0[I2]
}
class I2 {
def I2[I2 <: I2](implicit I2: I2 => I2): i0 = ???
I2() }
class I2 extends { lazy val I2 = this type i0 }
trait i0 extends i0 with I2 {
I2: I2 =>
}
implicit def I1: I2[I2] = collection.I2
}
object i0 {
val I2 = new I2
}
IN 078764bace3d0ed6f71b61b2ede433467ec0ce69.scala
java.lang.AssertionError: assertion failed: I2 & i0 / HKTypeLambda(List(I2), List(TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing),TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),class I2),List(TypeParamRef(I2)))) & TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),class i0)
    at scala.Predef$.assert(Predef.scala:219)
    at dotty.tools.dotc.core.Types$AndType$.apply(Types.scala:2482)
    at dotty.tools.dotc.core.Types$ClassInfo.selfType(Types.scala:3482)
    at dotty.tools.dotc.core.Types$ThisType.underlying(Types.scala:2188)
sir-wabbit commented 6 years ago
object i0 {
def I1[i6](i6: I1)(implicit i6: i6 => Boolean = this, i6: Int) = 0
val i6 = I1(i6[String] )
def i6[i6 <: i6](implicit i6: i6[i6], i6: i6[i6]): i6[i6] = i6
def i6[i6](i6: i6[i6]): i6[i6] = Nil
def i6[i6](i6: List[I1]): i6[I1, i6] = new I1[i6]
def i6[I1: i6, I1](I1: i2 => Seq[i6]) match {
case i6 => I1 match {
case i6' | I1(i6) < 2
}
def i6[@specialized I1, i2 >: i2, I1, i6, i2, i3, I4, i2, i2, i2, i3, I4, i5, i2, i6, i6](i2: i6, i6: I1, I4: i6)(i5: i6[I1, I1, i6, i6, i6, i6, i6, i6 <1, i6, i3, I4, i6, i6, i6, I1, I1, i2, i2, i2 i3, I4, i6, i6, i6] => I1): i6
}
class i6[i6](val i6: i6[_]) {
def I1[@specialized i6: i6](i6: String) = i6(i6); i2(_) { implicit I1: i6[new] }
def i2(i3: I1): i6 { type I1 = I1[i6]
type I1 = i6[i6]
override case val I1: i6[(i6, i6)]) = i6 match {
case i6: I1[_] =>
}
}
IN 66e3f7dad3eb7aad64091d85ab7a4d63b5f6ec80.scala
java.lang.AssertionError: assertion failed: non-existent getter denotation (val <none>) for getter(I1$default$3)
    at scala.Predef$.assert(Predef.scala:219)
    at dotty.tools.dotc.typer.Applications$Application.findGetter$1(Applications.scala:370)
    at dotty.tools.dotc.typer.Applications$Application.findDefaultGetter(Applications.scala:375)
    at dotty.tools.dotc.typer.Applications$Application.tryDefault$1(Applications.scala:430)
sir-wabbit commented 6 years ago
class i0[@specialized i0] {
def i1: i0
}
trait main extends i0 {
class i1 {}
var i1 = 0
var i1 = new i1
}
exception occurred while compiling /home/alex/ws/dotty/tests/result/38c24d1dcf977c3b5928b2894ad7d6ccb2f7
4764.scala
java.lang.AssertionError: assertion failed: bad parameter reference main.this.i0 at frontend
the parameter is type i0 in class i0 but the prefix main(main.this)
does not define any corresponding arguments.
        at scala.Predef$.assert(Predef.scala:219)
        at dotty.tools.dotc.core.Types$NamedType.argDenot(Types.scala:1808)
sir-wabbit commented 6 years ago
import language.i0
@scala.AnyRef
object i1 {
def i2(i3: String) = 2
def I4(i3: String): Any = None
trait i5 {}
def I6[i7 <: _[_]](i7: i7[i7])(implicit i7: i5[i7]): i7 = i2 + i2 +  + i1() yield i7
i2(i5, this)
}
exception occurred while compiling /home/alex/ws/dotty/tests/result/319ce54456a9712e71c3fd6d9aa2eaf9d8c0c903.scala
java.lang.AssertionError: assertion failed: TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class sc
ala)),class Nothing),TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any))
        at scala.Predef$.assert(Predef.scala:219)
        at dotty.tools.dotc.core.Types$TypeBounds.<init>(Types.scala:3566)
        at dotty.tools.dotc.core.Types$RealTypeBounds.<init>(Types.scala:3625)
        at dotty.tools.dotc.core.Types$TypeBounds$.apply(Types.scala:3652)
odersky commented 6 years ago

Oh I see, it needs -Yno-double-bindings to crash, which is one of the flags we use in our test suite. (https://github.com/lampepfl/dotty/blob/master/compiler/test/dotty/tools/vulpix/TestConfiguration.scala)

Note: Tests that introduce double definitions need to be compiled without -Tno-double-bindings. Make them a neg test in neg-custom-args.

odersky commented 6 years ago

It would be great if we could get minimized test cases in the comments. No need to file separate issues for them. Just list each code snippet in a separate comment. If they are presented like this, they should be easy & fast to fix. Otherwise, the ceremony of issues and bug fixes is crushing.

sir-wabbit commented 6 years ago

https://gist.github.com/alexknvl/36eb9a7faad464f9ea527450e532d24f

sir-wabbit commented 6 years ago

https://github.com/alexknvl/dotty-fuzzing-results