Skip to content

default parameter in structural refinement #8598

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
bishabosha opened this issue Mar 24, 2020 · 0 comments
Closed

default parameter in structural refinement #8598

bishabosha opened this issue Mar 24, 2020 · 0 comments

Comments

@bishabosha
Copy link
Member

minimized code

scala> def foo[T <: { def bar(a: Int = 0): Unit }](t: T): Unit = t.bar                                                                                                                   

Crash output (click arrow to expand)

Exception in thread "main" java.lang.AssertionError: assertion failed: def bar(a: Int = 0): Unit > def bar(a: Int): Unit, def bar$default$1: Int = 0
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.typer.Typer.typedRefinedTypeTree(Typer.scala:1442)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2232)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2266)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2304)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2313)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2316)
	at dotty.tools.dotc.typer.Typer.typedTypeBoundsTree(Typer.scala:1555)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2237)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2266)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2304)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2313)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2316)
	at dotty.tools.dotc.typer.Namer.typedAheadType$$anonfun$1(Namer.scala:1319)
	at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1312)
	at dotty.tools.dotc.typer.Namer.typedAheadType(Namer.scala:1319)
	at dotty.tools.dotc.typer.Namer$TypeDefCompleter.typeSig(Namer.scala:997)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:929)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:840)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:260)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:185)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:187)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:400)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2160)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2185)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2265)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2304)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2313)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2316)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1322)
	at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1312)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1322)
	at dotty.tools.dotc.typer.Namer.defDefSig$$anonfun$2(Namer.scala:1545)
	at scala.collection.immutable.List.foreach(List.scala:305)
	at dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1545)
	at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:812)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:929)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:840)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:260)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:185)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:187)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:400)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2160)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2185)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2265)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2304)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2313)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2316)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2338)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2382)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1875)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2198)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2265)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2304)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2313)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2316)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2338)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2382)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2001)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2239)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2266)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2304)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2313)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2316)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2424)
	at dotty.tools.dotc.typer.FrontEnd.liftedTree1$2(FrontEnd.scala:78)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:83)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:42)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:84)
	at dotty.tools.repl.REPLFrontEnd.runOn(ReplFrontEnd.scala:23)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:167)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:177)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:185)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:64)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:192)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:134)
	at dotty.tools.repl.ReplCompiler.runCompilationUnit(ReplCompiler.scala:156)
	at dotty.tools.repl.ReplCompiler.compile(ReplCompiler.scala:166)
	at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:229)
	at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:193)
	at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:127)
	at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:130)
	at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:148)
	at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:130)
	at dotty.tools.repl.Main$.main(Main.scala:6)
	at dotty.tools.repl.Main.main(Main.scala)
@odersky odersky self-assigned this Mar 26, 2020
bishabosha added a commit that referenced this issue Mar 26, 2020
Fix #8598: Refinements cannot have default arguments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants