Skip to content

crash with compilable code: "java.lang.UnsupportedOperationException: multi-denotation with alternatives" #2033

@helloqirun

Description

@helloqirun

(The trunk version of) scalac can compile but dotc crashes. scalac-2.9 emits an error.
Moreover, if I "beautify" the code a bit, dotc does not crash.

$ cat good.scala

 import  java . io ._
 import  collection ._
 object  Test { def  check ( obj : AnyRef ){
 val  bos = new  ByteArrayOutputStream ()
 val  out = new  ObjectOutputStream ( println )
 val  arr = bos  toByteArray ()
 val  in =(())
 val  deser =()
 val  lhs = mutable  LinkedHashSet ()
 check ( lhs )}}

$ dotc good.scala

-- [E040] Syntax Error: good.scala ---------------------------------------------
4 | object  Test { def  check ( obj : AnyRef ){
  |                                           ^
  |                                          '=' expected, but `AnyRef` found

longer explanation available when compiling with `-explain`
-- [E040] Syntax Error: good.scala ---------------------------------------------
11 | check ( lhs )}}
   |               ^
   |               eof expected, but `lhs` found
13 |

longer explanation available when compiling with `-explain`

exception occurred while typechecking good.scala

exception occurred while compiling good.scala
Exception in thread "main" java.lang.UnsupportedOperationException: multi-denotation with alternatives List(method println, method println) does not implement operation info
	at dotty.tools.dotc.core.Denotations$MultiDenotation.multiHasNot(Denotations.scala:595)
	at dotty.tools.dotc.core.Denotations$MultiDenotation.infoOrCompleter(Denotations.scala:558)
	at dotty.tools.dotc.core.Denotations$MultiDenotation.info(Denotations.scala:559)
	at dotty.tools.dotc.core.Denotations$MultiDenotation.info(Denotations.scala:557)
	at dotty.tools.dotc.core.Types$NamedType.info(Types.scala:1618)
	at dotty.tools.dotc.core.TypeComparer.compareNamed$1(TypeComparer.scala:164)
	at dotty.tools.dotc.core.TypeComparer.dotty$tools$dotc$core$TypeComparer$$firstTry(TypeComparer.scala:205)
	at dotty.tools.dotc.core.TypeComparer$$anonfun$isSubType$1.apply$mcZ$sp(TypeComparer.scala:112)
	at dotty.tools.dotc.core.TypeComparer$$anonfun$isSubType$1.apply(TypeComparer.scala:104)
	at dotty.tools.dotc.core.TypeComparer$$anonfun$isSubType$1.apply(TypeComparer.scala:104)
<snipped>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions