kframework / k-legacy

The K tools (deprecated, see README)
http://kframework.org
Other
146 stars 61 forks source link

uncaught exception and unnecessary message #2091

Open grosu opened 8 years ago

grosu commented 8 years ago

This is what you get when you kompile simple-typed-static.k of K3.6 with the K4.0 kompiler:

D:\github\grosu\k\k-distribution\tutorial\2_languages\1_simple\2_typed\1_static>kompile simple-typed-static.k --debug
java.lang.ClassCastException: org.kframework.kore.ADT$KSequence cannot be cast to org.kframework.kore.KRewrite
        at org.kframework.kore.compile.AddParentCells.getParent(AddParentCells.java:233)
        at org.kframework.kore.compile.AddParentCells.getParent(AddParentCells.java:233)
        at org.kframework.kore.compile.AddParentCells.lambda$concretizeCell$200(AddParentCells.java:283)
        at java.util.stream.Collectors.lambda$groupingBy$159(Collectors.java:907)
        at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
        at org.kframework.kore.compile.AddParentCells.concretizeCell(AddParentCells.java:283)
        at org.kframework.kore.compile.AddParentCells.concretize(AddParentCells.java:300)
        at org.kframework.kore.compile.AddParentCells.concretize(AddParentCells.java:318)
        at org.kframework.kore.compile.ConcretizeCells.concretize(ConcretizeCells.java:62)
        at org.kframework.definition.ModuleTransformer$$anonfun$fromSentenceTransformer$1.apply(transformers.scala:14)
        at org.kframework.definition.ModuleTransformer$$anonfun$fromSentenceTransformer$1.apply(transformers.scala:14)
        at org.kframework.definition.ModuleTransformer$$anonfun$fromSentenceTransformer$2$$anonfun$3.apply(transformers.scala:20)
        at org.kframework.definition.ModuleTransformer$$anonfun$fromSentenceTransformer$2$$anonfun$3.apply(transformers.scala:18)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.immutable.HashSet$HashSet1.foreach(HashSet.scala:322)
        at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:978)
        at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:978)
        at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:978)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
        at scala.collection.AbstractSet.scala$collection$SetLike$$super$map(Set.scala:47)
        at scala.collection.SetLike$class.map(SetLike.scala:92)
        at scala.collection.AbstractSet.map(Set.scala:47)
        at org.kframework.definition.ModuleTransformer$$anonfun$fromSentenceTransformer$2.apply(transformers.scala:18)
        at org.kframework.definition.ModuleTransformer$$anonfun$fromSentenceTransformer$2.apply(transformers.scala:17)
        at org.kframework.definition.ModuleTransformer$$anonfun$apply$5.apply(transformers.scala:58)
        at org.kframework.definition.ModuleTransformer$$anonfun$apply$5.apply(transformers.scala:55)
        at scala.collection.concurrent.TrieMap.getOrElseUpdate(TrieMap.scala:901)
        at org.kframework.definition.ModuleTransformer.apply(transformers.scala:55)
        at org.kframework.definition.ModuleTransformer.apply(transformers.scala:51)
        at org.kframework.definition.DefinitionTransformer.apply(transformers.scala:90)
        at org.kframework.kore.compile.ConcretizeCells.transformDefinition(ConcretizeCells.java:46)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at org.kframework.kompile.Kompile.lambda$defaultSteps$11(Kompile.java:156)
        at org.kframework.backend.java.symbolic.JavaBackend.lambda$null$5ca3f9c9$1(JavaBackend.java:79)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at org.kframework.backend.java.symbolic.JavaBackend.lambda$steps$146(JavaBackend.java:92)
        at org.kframework.kompile.Kompile.run(Kompile.java:120)
        at org.kframework.kompile.KompileFrontEnd.run(KompileFrontEnd.java:70)
        at org.kframework.main.FrontEnd.main(FrontEnd.java:52)
        at org.kframework.main.Main.runApplication(Main.java:110)
        at org.kframework.main.Main.runApplication(Main.java:100)
        at org.kframework.main.Main.main(Main.java:52)
java.lang.ClassCastException: org.kframework.kore.ADT$KSequence cannot be cast to org.kframework.kore.KRewrite
        at org.kframework.kore.compile.AddParentCells.getParent(AddParentCells.java:233)
        at org.kframework.kore.compile.AddParentCells.getParent(AddParentCells.java:233)
        at org.kframework.kore.compile.AddParentCells.lambda$concretizeCell$200(AddParentCells.java:283)
        at java.util.stream.Collectors.lambda$groupingBy$159(Collectors.java:907)
        at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
        at org.kframework.kore.compile.AddParentCells.concretizeCell(AddParentCells.java:283)
        at org.kframework.kore.compile.AddParentCells.concretize(AddParentCells.java:300)
        at org.kframework.kore.compile.AddParentCells.concretize(AddParentCells.java:318)
        at org.kframework.kore.compile.ConcretizeCells.concretize(ConcretizeCells.java:62)
        at org.kframework.definition.ModuleTransformer$$anonfun$fromSentenceTransformer$1.apply(transformers.scala:14)
        at org.kframework.definition.ModuleTransformer$$anonfun$fromSentenceTransformer$1.apply(transformers.scala:14)
        at org.kframework.definition.ModuleTransformer$$anonfun$fromSentenceTransformer$2$$anonfun$3.apply(transformers.scala:20)
        at org.kframework.definition.ModuleTransformer$$anonfun$fromSentenceTransformer$2$$anonfun$3.apply(transformers.scala:18)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.immutable.HashSet$HashSet1.foreach(HashSet.scala:322)
        at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:978)
        at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:978)
        at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:978)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
        at scala.collection.AbstractSet.scala$collection$SetLike$$super$map(Set.scala:47)
        at scala.collection.SetLike$class.map(SetLike.scala:92)
        at scala.collection.AbstractSet.map(Set.scala:47)
        at org.kframework.definition.ModuleTransformer$$anonfun$fromSentenceTransformer$2.apply(transformers.scala:18)
        at org.kframework.definition.ModuleTransformer$$anonfun$fromSentenceTransformer$2.apply(transformers.scala:17)
        at org.kframework.definition.ModuleTransformer$$anonfun$apply$5.apply(transformers.scala:58)
        at org.kframework.definition.ModuleTransformer$$anonfun$apply$5.apply(transformers.scala:55)
        at scala.collection.concurrent.TrieMap.getOrElseUpdate(TrieMap.scala:901)
        at org.kframework.definition.ModuleTransformer.apply(transformers.scala:55)
        at org.kframework.definition.ModuleTransformer.apply(transformers.scala:51)
        at org.kframework.definition.DefinitionTransformer.apply(transformers.scala:90)
        at org.kframework.kore.compile.ConcretizeCells.transformDefinition(ConcretizeCells.java:46)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at org.kframework.kompile.Kompile.lambda$defaultSteps$11(Kompile.java:156)
        at org.kframework.backend.java.symbolic.JavaBackend.lambda$null$5ca3f9c9$1(JavaBackend.java:79)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
        at org.kframework.backend.java.symbolic.JavaBackend.lambda$steps$146(JavaBackend.java:92)
        at org.kframework.kompile.Kompile.run(Kompile.java:120)
        at org.kframework.kompile.KompileFrontEnd.run(KompileFrontEnd.java:70)
        at org.kframework.main.FrontEnd.main(FrontEnd.java:52)
        at org.kframework.main.Main.runApplication(Main.java:110)
        at org.kframework.main.Main.runApplication(Main.java:100)
        at org.kframework.main.Main.main(Main.java:52)
[Error] Internal: Uncaught exception thrown of type ClassCastException.
Please rerun your program with the --debug flag to generate a stack trace, and
file a bug report at https://github.com/kframework/k/issues

I've already ran the program with --debug, so no need to be told the above. Period at the end of the message.

grosu commented 8 years ago

Apparently this exception was thrown because the old definitions used . instead of .Bag in the following rule:

  rule <task> <k> T:Type F:Id(Ps:Params) S => getTypes(Ps)->T F; ...</k> </task>
       (.Bag => <task>
               <k> mkDecls(Ps) S </k> <tenv> .Map </tenv> <return> T </return>
             </task>)
    [structural]

We should obviously get a more civilized error here.