{"push_id":1164250907,"size":2,"distinct_size":2,"ref":"refs/heads/wip/7685","head":"05d89a7b123c64290032753bc34608382fcfad6b","before":"f7b681b640b67d81f781cb46929a1c720ae4979f","commits":[{"sha":"0d76c5b3d86cca55e568ae9a11fc516a1b388905","author":{"name":"Dale Wijnand","email":"6766ab40c083feb8afd54ef3df21c39f9d192577@gmail.com"},"message":"SI-7685 Allow value class nesting (WIP)","distinct":true,"url":"https://api.github.com/repos/dwijnand/scala/commits/0d76c5b3d86cca55e568ae9a11fc516a1b388905"},{"sha":"05d89a7b123c64290032753bc34608382fcfad6b","author":{"name":"Lukas Rytz","email":"5cbdf6e2c4d3aeb436f9f1dfc215f66ee5cda9e4@gmail.com"},"message":"Fix expected type when type checking argument of value class\n\nExample\n\n    class A(val x: String) extends AnyVal\n    class B(val x: A)      extends AnyVal\n\n    class C {\n      def t = {\n        val a = new A(\"bcc\")\n        val b = new B(a)\n        b.x\n      }\n    }\n\nDuring erasure, when (re-)type-checking `new B(a)` in `typed1` of\n`transform/Erasure`, we get the a tree `InjectDerivedValue` representing\nthe `new B(a)`.\n\nBefore this patch, the expected type for type checking `a` was the\nerased type of B's value field, which is String (erasure replaces type\n`A` by `String`). The tree `a` has type `ErasedValueType(A, String)`.\nDuring erasure's `adapt` phase, the expected type did not match. Since\nthe tree's type is an (erased) value type, the adapt method would\nintroduce a box creation (i.e., `new A(a)`). This is clearly wrong.\n\nThe solution here is that the expected type for type-checking the `a`\ntree should be `ErasedValueType(A, String)`. This is actually the type\nof B's value at this phase, so we just need to make sure not to erase\nthat down to A. This is what specialErasure does.\n\nBytecode for `t` after this patch (if you also enable `-opt:l:project`,\notherwise there's some redundant local variables):\n\n    public t()Ljava/lang/String;\n     L0\n      LINENUMBER 6 L0\n      LDC \"bcc\"\n     L1\n      LINENUMBER 8 L1\n      ARETURN","distinct":true,"url":"https://api.github.com/repos/dwijnand/scala/commits/05d89a7b123c64290032753bc34608382fcfad6b"}]}
{"actor":{"display_login":"dwijnand"}}