Skip to content

Crash in TypeDiagnostics.record #5833

@scabug

Description

@scabug

I see this quite often while typing in the IDE. probably the code has errors, but sometimes even when it doesn't. At any rate, it's probably better to catch exceptions thrown during recording type diagnostics logging, since often you may have malformed types.

I don't have a reproducible case, unfortunately.

java.lang.UnsupportedOperationException: tail of empty list
	at scala.collection.immutable.Nil$.tail(List.scala:320)
	at scala.collection.immutable.Nil$.tail(List.scala:315)
	at scala.reflect.internal.Types$RefinedType.normalizeImpl(Types.scala:1625)
	at scala.reflect.internal.Types$RefinedType.normalize(Types.scala:1616)
	at scala.reflect.internal.Definitions$DefinitionsClass.isFunctionType(Definitions.scala:681)
	at scala.reflect.internal.Types$TypeRef.customToString(Types.scala:2319)
	at scala.reflect.internal.Types$TypeRef.safeToString(Types.scala:2333)
	at scala.reflect.internal.Types$class.typeToString(Types.scala:6785)
	at scala.reflect.internal.SymbolTable.typeToString(SymbolTable.scala:13)
	at scala.reflect.internal.Types$Type.toString(Types.scala:945)
	at java.lang.String.valueOf(String.java:2826)
	at scala.tools.nsc.typechecker.TypeDiagnostics$class.record$1(TypeDiagnostics.scala:332)
	at scala.tools.nsc.typechecker.TypeDiagnostics$$anonfun$typeDiags$1$$anonfun$apply$2.apply(TypeDiagnostics.scala:338)
	at scala.tools.nsc.typechecker.TypeDiagnostics$$anonfun$typeDiags$1$$anonfun$apply$2.apply(TypeDiagnostics.scala:335)
	at scala.Function1$class.apply$mcVL$sp(Function1.scala:39)
	at scala.runtime.AbstractFunction1.apply$mcVL$sp(AbstractFunction1.scala:12)
	at scala.reflect.internal.Types$ForEachTypeTraverser.traverse(Types.scala:4726)
	at scala.reflect.internal.Types$Type.foreach(Types.scala:774)
	at scala.tools.nsc.typechecker.TypeDiagnostics$$anonfun$typeDiags$1.apply(TypeDiagnostics.scala:335)
	at scala.tools.nsc.typechecker.TypeDiagnostics$$anonfun$typeDiags$1.apply(TypeDiagnostics.scala:335)
	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
	at scala.collection.immutable.List.foreach(List.scala:77)
	at scala.tools.nsc.typechecker.TypeDiagnostics$class.typeDiags(TypeDiagnostics.scala:335)
	at scala.tools.nsc.typechecker.TypeDiagnostics$class.withDisambiguation(TypeDiagnostics.scala:358)
	at scala.tools.nsc.Global$$anon$1.withDisambiguation(Global.scala:460)
	at scala.tools.nsc.typechecker.TypeDiagnostics$class.foundReqMsg(TypeDiagnostics.scala:264)
	at scala.tools.nsc.Global$$anon$1.foundReqMsg(Global.scala:460)
	at scala.tools.nsc.typechecker.ContextErrors$ErrorUtils$.typeErrorMsg(ContextErrors.scala:81)
	at scala.tools.nsc.typechecker.ContextErrors$TyperContextErrors$TyperErrorGen$.AdaptTypeError(ContextErrors.scala:146)
	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1200)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5026)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$61.apply(Typers.scala:2677)
	at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:2677)
	at scala.tools.nsc.typechecker.Typers$Typer.loop$1(Typers.scala:2696)
	at scala.tools.nsc.typechecker.Typers$Typer.typedArgs(Typers.scala:2702)
	at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:2943)
	at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3016)
	at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4133)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4843)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5017)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2567)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$59$$anonfun$60.apply(Typers.scala:2663)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$59$$anonfun$60.apply(Typers.scala:2663)
	at scala.collection.immutable.List.loop$1(List.scala:163)
	at scala.collection.immutable.List.mapConserve(List.scala:179)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$59.apply(Typers.scala:2663)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2662)
	at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:2154)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typed1$3.apply(Typers.scala:4699)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4698)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5017)
	at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:5222)
	at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:1986)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4667)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5017)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2567)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$59$$anonfun$60.apply(Typers.scala:2663)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$59$$anonfun$60.apply(Typers.scala:2663)
	at scala.collection.immutable.List.loop$1(List.scala:163)
	at scala.collection.immutable.List.mapConserve(List.scala:179)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$59.apply(Typers.scala:2663)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2662)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1730)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$39.apply(Typers.scala:1593)
	at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1592)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4654)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5017)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2567)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$59$$anonfun$60.apply(Typers.scala:2663)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$59$$anonfun$60.apply(Typers.scala:2663)
	at scala.collection.immutable.List.loop$1(List.scala:163)
	at scala.collection.immutable.List.mapConserve(List.scala:179)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$59.apply(Typers.scala:2663)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2662)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4650)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5017)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5075)
	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:97)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:431)
	at scala.tools.nsc.interactive.Global$TyperRun$$anonfun$applyPhase$1.apply(Global.scala:1066)
	at scala.tools.nsc.interactive.Global$TyperRun.applyPhase(Global.scala:1066)
	at scala.tools.nsc.interactive.Global$TyperRun.typeCheck(Global.scala:1059)
	at scala.tools.nsc.interactive.Global.scala$tools$nsc$interactive$Global$$typeCheck(Global.scala:562)
	at scala.tools.nsc.interactive.Global$$anonfun$backgroundCompile$4$$anonfun$apply$5.apply(Global.scala:478)
	at scala.tools.nsc.interactive.Global$$anonfun$backgroundCompile$4.apply(Global.scala:474)
	at scala.tools.nsc.interactive.Global$$anonfun$backgroundCompile$4.apply(Global.scala:474)
	at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:759)
	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
	at scala.collection.immutable.List.foreach(List.scala:77)
	at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:758)
	at scala.tools.nsc.interactive.Global.backgroundCompile(Global.scala:474)
	at scala.tools.nsc.interactive.PresentationCompilerThread.run(PresentationCompilerThread.scala:25)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions