{"action":"created","issue":{"url":"https://api.github.com/repos/lampepfl/dotty/issues/826","labels_url":"https://api.github.com/repos/lampepfl/dotty/issues/826/labels{/name}","comments_url":"https://api.github.com/repos/lampepfl/dotty/issues/826/comments","events_url":"https://api.github.com/repos/lampepfl/dotty/issues/826/events","html_url":"https://github.com/lampepfl/dotty/issues/826","id":111239798,"number":826,"title":"Constraints on value class parameters are not checked early enough","user":{"login":"propensive","id":1024588,"avatar_url":"https://avatars.githubusercontent.com/u/1024588?v=3","gravatar_id":"","url":"https://api.github.com/users/propensive","html_url":"https://github.com/propensive","followers_url":"https://api.github.com/users/propensive/followers","following_url":"https://api.github.com/users/propensive/following{/other_user}","gists_url":"https://api.github.com/users/propensive/gists{/gist_id}","starred_url":"https://api.github.com/users/propensive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/propensive/subscriptions","organizations_url":"https://api.github.com/users/propensive/orgs","repos_url":"https://api.github.com/users/propensive/repos","events_url":"https://api.github.com/users/propensive/events{/privacy}","received_events_url":"https://api.github.com/users/propensive/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-13T18:25:30Z","updated_at":"2015-10-13T20:56:19Z","closed_at":null,"body":"While value classes with one value parameter all compile, the following illegal examples all produce unexpected output:\r\n\r\n- `class Foo(y: Int) extends AnyVal` produces `error: value y in class Foo does not take parameters`\r\n- `class Foo(y: String, z: String) extends AnyVal` crashes the compiler\r\n- `class Foo(val y: String, val z: String) extends AnyVal` crashes the compiler\r\n- `case class Foo(y: String, z: String) extends AnyVal` crashes the compiler\r\n\r\nTypical output (from the last example) looks like this:\r\n\r\n```\r\nerror while transforming (y: String, z: String) extends AnyVal() { \r\n  val y: String\r\n  val z: String\r\n}\r\nerror while transforming final class Foo(y: String, z: String) extends AnyVal() { \r\n  val y: String\r\n  val z: String\r\n}\r\nerror while transforming package <empty> {\r\n  final class Foo(y: String, z: String) extends AnyVal() { \r\n    val y: String\r\n    val z: String\r\n  }\r\n}\r\nexception occurred while compiling test.scala\r\nException in thread \"main\" java.lang.AssertionError: assertion failed\r\n        at scala.Predef$.assert(Predef.scala:151)\r\n        at dotty.tools.dotc.transform.SyntheticMethods.dotty$tools$dotc$transform$SyntheticMethods$$valueHashCodeBody$1(SyntheticMethods.scala:137)\r\n        at dotty.tools.dotc.transform.SyntheticMethods$$anonfun$syntheticRHS$1$1.apply(SyntheticMethods.scala:83)\r\n        at dotty.tools.dotc.transform.SyntheticMethods$$anonfun$syntheticRHS$1$1.apply(SyntheticMethods.scala:83)\r\n        at dotty.tools.dotc.ast.tpd$.polyDefDef(tpd.scala:215)\r\n        at dotty.tools.dotc.ast.tpd$.DefDef(tpd.scala:185)\r\n        at dotty.tools.dotc.transform.SyntheticMethods.syntheticDef$1(SyntheticMethods.scala:92)\r\n        at dotty.tools.dotc.transform.SyntheticMethods.dotty$tools$dotc$transform$SyntheticMethods$$syntheticDefIfMissing$1(SyntheticMethods.scala:69)\r\n        at dotty.tools.dotc.transform.SyntheticMethods$$anonfun$syntheticMethods$1.apply(SyntheticMethods.scala:189)\r\n        at dotty.tools.dotc.transform.SyntheticMethods$$anonfun$syntheticMethods$1.apply(SyntheticMethods.scala:189)\r\n        at scala.collection.immutable.List.flatMap(List.scala:327)\r\n        at dotty.tools.dotc.transform.SyntheticMethods.syntheticMethods(SyntheticMethods.scala:189)\r\n        at dotty.tools.dotc.transform.SyntheticMethods.addSyntheticMethods(SyntheticMethods.scala:194)\r\n        at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform(PostTyper.scala:171)\r\n        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1163)\r\n        at dotty.tools.dotc.transform.MacroTransform$Transformer.transform(MacroTransform.scala:55)\r\n        at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform(PostTyper.scala:181)\r\n        at dotty.tools.dotc.ast.Trees$Instance$TreeMap$$anonfun$transform$2.apply(Trees.scala:1180)\r\n        at dotty.tools.dotc.ast.Trees$Instance$TreeMap$$anonfun$transform$2.apply(Trees.scala:1180)\r\n        at scala.collection.immutable.List.loop$1(List.scala:173)\r\n        at scala.collection.immutable.List.mapConserve(List.scala:189)\r\n        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1180)\r\n        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1178)\r\n        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1169)\r\n        at dotty.tools.dotc.transform.MacroTransform$Transformer.transform(MacroTransform.scala:55)\r\n        at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform(PostTyper.scala:195)\r\n        at dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:22)\r\n        at dotty.tools.dotc.core.Phases$Phase$$anonfun$runOn$1.apply(Phases.scala:271)\r\n        at dotty.tools.dotc.core.Phases$Phase$$anonfun$runOn$1.apply(Phases.scala:269)\r\n        at scala.collection.immutable.List.map(List.scala:273)\r\n        at dotty.tools.dotc.core.Phases$Phase$class.runOn(Phases.scala:269)\r\n        at dotty.tools.dotc.transform.MacroTransform.runOn(MacroTransform.scala:16)\r\n        at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:59)\r\n        at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:56)\r\n        at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)\r\n        at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)\r\n        at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply$mcV$sp(Run.scala:56)\r\n        at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:52)\r\n        at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:52)\r\n        at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:69)\r\n        at dotty.tools.dotc.Run.compileUnits(Run.scala:52)\r\n        at dotty.tools.dotc.Run.compileSources(Run.scala:49)\r\n        at dotty.tools.dotc.Run.compile(Run.scala:33)\r\n        at dotty.tools.dotc.Driver.doCompile(Driver.scala:21)\r\n        at dotty.tools.dotc.Driver.process(Driver.scala:44)\r\n        at dotty.tools.dotc.Driver.main(Driver.scala:48)\r\n        at dotty.tools.dotc.Main.main(Main.scala)\r\n```"},"comment":{"url":"https://api.github.com/repos/lampepfl/dotty/issues/comments/147851203","html_url":"https://github.com/lampepfl/dotty/issues/826#issuecomment-147851203","issue_url":"https://api.github.com/repos/lampepfl/dotty/issues/826","id":147851203,"user":{"login":"smarter","id":63430,"avatar_url":"https://avatars.githubusercontent.com/u/63430?v=3","gravatar_id":"","url":"https://api.github.com/users/smarter","html_url":"https://github.com/smarter","followers_url":"https://api.github.com/users/smarter/followers","following_url":"https://api.github.com/users/smarter/following{/other_user}","gists_url":"https://api.github.com/users/smarter/gists{/gist_id}","starred_url":"https://api.github.com/users/smarter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smarter/subscriptions","organizations_url":"https://api.github.com/users/smarter/orgs","repos_url":"https://api.github.com/users/smarter/repos","events_url":"https://api.github.com/users/smarter/events{/privacy}","received_events_url":"https://api.github.com/users/smarter/received_events","type":"User","site_admin":false},"created_at":"2015-10-13T20:56:19Z","updated_at":"2015-10-13T20:56:19Z","body":"Yes, we haven't spent much time on error checking for value classes because it's not yet clear what will or will not be allowed for value classes, all of your examples might compile and do something reasonable some day :)."}}