Skip to content

Curried type parameters application crash #10679

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
agluszak opened this issue Dec 7, 2020 · 1 comment
Closed

Curried type parameters application crash #10679

agluszak opened this issue Dec 7, 2020 · 1 comment

Comments

@agluszak
Copy link

agluszak commented Dec 7, 2020

Tested with Scala 3.0.0-M2. Possibly related to #10681

Minimized code

type Curried = [X] =>> [Y] =>> String
type PartialApplication[X] = Curried[String][X]
val test1 = PartialApplication[String]                                               
val test2 = Curried[String][String]

Output (click arrow to expand)

scala> type Curried = [X] =>> [Y] =>> String                                    
     | type PartialApplication[X] = Curried[String][X]
     | val test1 = PartialApplication[String]    
// defined alias type Curried[X] = [Y] =>> String
// defined alias type PartialApplication[X] = Curried[String][X]
val test1: String = ""

scala> val test2 = Curried[String][String]                                      
Exception in thread "main" dotty.tools.dotc.ast.Trees$UnAssignedTypeException: type of dotty.tools.dotc.typer.Applications$IntegratedTypeArgs@4b41587d is not assigned
	at dotty.tools.dotc.ast.Trees$Tree.tpe(Trees.scala:79)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3572)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2932)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2601)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2605)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2720)
	at dotty.tools.dotc.typer.Applications.typedFunPart$$anonfun$1(Applications.scala:852)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2728)
	at dotty.tools.dotc.typer.Applications.typedFunPart(Applications.scala:861)
	at dotty.tools.dotc.typer.Applications.typedFunPart$(Applications.scala:236)
	at dotty.tools.dotc.typer.Typer.typedFunPart(Typer.scala:92)
	at dotty.tools.dotc.typer.Applications.typedTypeApply(Applications.scala:1078)
	at dotty.tools.dotc.typer.Applications.typedTypeApply$(Applications.scala:236)
	at dotty.tools.dotc.typer.Typer.typedTypeApply(Typer.scala:92)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2489)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2532)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2601)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2605)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1232)
	at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1219)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1232)
	at dotty.tools.dotc.typer.Namer.rhsType$1$$anonfun$1(Namer.scala:1367)
	at dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:216)
	at dotty.tools.dotc.typer.Namer.rhsType$2(Namer.scala:1367)
	at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1378)
	at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1379)
	at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1390)
	at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1398)
	at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:680)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:801)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:712)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:166)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:188)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:190)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:370)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2413)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2438)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2531)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2601)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2605)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2627)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2676)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2131)
	at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2459)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2463)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2531)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2601)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2605)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2627)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2676)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2256)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2503)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2532)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2601)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2605)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2720)
	at dotty.tools.dotc.typer.FrontEnd.liftedTree1$1(FrontEnd.scala:79)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:84)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:43)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:85)
	at dotty.tools.repl.REPLFrontEnd.runOn(ReplFrontEnd.scala:24)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:185)
	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:195)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:203)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:210)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:152)
	at dotty.tools.repl.ReplCompiler.runCompilationUnit(ReplCompiler.scala:151)
	at dotty.tools.repl.ReplCompiler.compile(ReplCompiler.scala:161)
	at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:234)
	at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:197)
	at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:130)
	at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:133)
	at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:152)
	at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:133)
	at dotty.tools.repl.Main$.main(Main.scala:6)
	at dotty.tools.repl.Main.main(Main.scala)
@anatoliykmetyuk
Copy link
Contributor

No longer reproduces: the original example (correctly) reports an error:

-- [E006] Not Found Error: /Users/kmetiuk/Projects/scala3/playground/itbd/Bad.scala:3:12                                                              
3 |val test1 = PartialApplication[String]
  |            ^^^^^^^^^^^^^^^^^^
  |            Not found: PartialApplication

longer explanation available when compiling with `-explain`
-- [E006] Not Found Error: /Users/kmetiuk/Projects/scala3/playground/itbd/Bad.scala:4:12 
4 |val test2 = Curried[String][String]
  |            ^^^^^^^
  |            Not found: Curried

And the following example compiles successfully:

type Curried = [X] =>> [Y] =>> String
type PartialApplication[X] = Curried[String][X]
val test1: PartialApplication[String]
val test2: Curried[String][String]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants