Skip to content

TypeError when a class extends from Function0 #5010

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
sir-wabbit opened this issue Aug 24, 2018 · 2 comments
Closed

TypeError when a class extends from Function0 #5010

sir-wabbit opened this issue Aug 24, 2018 · 2 comments

Comments

@sir-wabbit
Copy link

class i0 extends Function0
Exception in thread "main" dotty.tools.dotc.core.TypeError: bad parameter reference i0.this.R at tryCatchPatterns
the parameter is type R in trait Function0 but the prefix i0(i0.this)
does not define any corresponding arguments.
	at dotty.tools.dotc.core.Types$NamedType.argDenot(Types.scala:1841)
	at dotty.tools.dotc.core.Types$NamedType.fromDesignator$1(Types.scala:1756)
	at dotty.tools.dotc.core.Types$NamedType.computeDenot(Types.scala:1774)
	at dotty.tools.dotc.core.Types$NamedType.denot(Types.scala:1730)
	at dotty.tools.dotc.core.Types$NamedType.info(Types.scala:1719)
	at dotty.tools.dotc.core.Types$$anon$5.apply(Types.scala:2860)
	at dotty.tools.dotc.core.Types$$anon$5.apply(Types.scala:2853)
	at dotty.tools.dotc.core.Types$TermLambda.dotty$tools$dotc$core$Types$TermLambda$$depStatus(Types.scala:2870)
	at dotty.tools.dotc.core.Types$TermLambda.dependencyStatus(Types.scala:2884)
	at dotty.tools.dotc.core.Types$TermLambda.resultType(Types.scala:2827)
	at dotty.tools.dotc.core.Types$MethodType.resultType(Types.scala:2931)
	at dotty.tools.dotc.printing.PlainPrinter.toText$$anonfun$8$$anonfun$6(PlainPrinter.scala:180)
	at dotty.tools.dotc.printing.Printer.atPrec(Printer.scala:41)
	at dotty.tools.dotc.printing.Printer.changePrec(Printer.scala:70)
	at dotty.tools.dotc.printing.PlainPrinter.toText$$anonfun$1(PlainPrinter.scala:182)
	at dotty.tools.dotc.printing.PlainPrinter.controlled(PlainPrinter.scala:28)
	at dotty.tools.dotc.printing.PlainPrinter.toText(PlainPrinter.scala:215)
	at dotty.tools.dotc.printing.RefinedPrinter.toText$$anonfun$1(RefinedPrinter.scala:243)
	at dotty.tools.dotc.printing.PlainPrinter.controlled(PlainPrinter.scala:28)
	at dotty.tools.dotc.printing.RefinedPrinter.toText(RefinedPrinter.scala:244)
	at dotty.tools.dotc.core.Types$Type.toText(Types.scala:1419)
	at dotty.tools.dotc.printing.Printer.toTextGlobal$$anonfun$1(Printer.scala:149)
	at dotty.tools.dotc.printing.Printer.atPrec(Printer.scala:41)
	at dotty.tools.dotc.printing.Printer.toTextGlobal(Printer.scala:149)
	at dotty.tools.dotc.printing.PlainPrinter.toTextRHS$$anonfun$1(PlainPrinter.scala:335)
	at dotty.tools.dotc.printing.PlainPrinter.controlled(PlainPrinter.scala:28)
	at dotty.tools.dotc.printing.PlainPrinter.toTextRHS(PlainPrinter.scala:341)
	at dotty.tools.dotc.printing.PlainPrinter.toTextRHS(PlainPrinter.scala:306)
	at dotty.tools.dotc.printing.PlainPrinter.dclTextWithInfo(PlainPrinter.scala:410)
	at dotty.tools.dotc.printing.PlainPrinter.dclText(PlainPrinter.scala:406)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.showDcl(Denotations.scala:1053)
	at dotty.tools.dotc.typer.RefChecks$.undefined$1(RefChecks.scala:514)
	at dotty.tools.dotc.typer.RefChecks$.checkNoAbstractMembers$4$$anonfun$3(RefChecks.scala:572)
	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:18)
	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:59)
	at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:52)
	at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
	at dotty.tools.dotc.typer.RefChecks$.checkNoAbstractMembers$1(RefChecks.scala:577)
	at dotty.tools.dotc.typer.RefChecks$.dotty$tools$dotc$typer$RefChecks$$$checkAllOverrides(RefChecks.scala:663)
	at dotty.tools.dotc.typer.RefChecks.transformTemplate(RefChecks.scala:963)

TE-a6994c362dfcd98096c0617c171bc54fd30101ff

Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Aug 25, 2018
Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Aug 25, 2018
To allow again t3613 to compile I need this exception. But the testcase is so
old I'm not sure if we should do this, even tho it's still supported by Scalac.
@Blaisorblade

This comment has been minimized.

@Blaisorblade
Copy link
Contributor

So tests/run/t3613.scala comes from when javax.swing.AbstractListModel had no argument, and now works by inferring a type argument to it. See discussion at scala/bug#11111.

Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Aug 26, 2018
This reverts commit 1fe1232 as it was an
incorrect diagnosis.
The only existing testcase was written when AbstractListModel had no parameter,
so change the testcase instead.

We could alternatively infer type arguments (see scala/bug#11111), but that
seems typically unhelpful.
Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Aug 26, 2018
We modify t3613 as it was written when AbstractListModel had no type parameter.

We could alternatively infer type arguments (see scala/bug#11111), as scalac
does, but that seems typically unhelpful. Instead, we only infer them for
constructor applications.
Blaisorblade added a commit that referenced this issue Jan 15, 2019
…ve-type-arguments

Fix #5010: check type parents have type 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