{"action":"created","issue":{"url":"https://api.github.com/repos/scala/scala/issues/5310","repository_url":"https://api.github.com/repos/scala/scala","labels_url":"https://api.github.com/repos/scala/scala/issues/5310/labels{/name}","comments_url":"https://api.github.com/repos/scala/scala/issues/5310/comments","events_url":"https://api.github.com/repos/scala/scala/issues/5310/events","html_url":"https://github.com/scala/scala/pull/5310","id":168293158,"number":5310,"title":"SIP-23 Implementation of literal types","user":{"login":"milessabin","id":131183,"avatar_url":"https://avatars.githubusercontent.com/u/131183?v=3","gravatar_id":"","url":"https://api.github.com/users/milessabin","html_url":"https://github.com/milessabin","followers_url":"https://api.github.com/users/milessabin/followers","following_url":"https://api.github.com/users/milessabin/following{/other_user}","gists_url":"https://api.github.com/users/milessabin/gists{/gist_id}","starred_url":"https://api.github.com/users/milessabin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/milessabin/subscriptions","organizations_url":"https://api.github.com/users/milessabin/orgs","repos_url":"https://api.github.com/users/milessabin/repos","events_url":"https://api.github.com/users/milessabin/events{/privacy}","received_events_url":"https://api.github.com/users/milessabin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/scala/scala/milestones/55","html_url":"https://github.com/scala/scala/milestones/2.12.1","labels_url":"https://api.github.com/repos/scala/scala/milestones/55/labels","id":1840949,"number":55,"title":"2.12.1","description":"Merge to 2.12.x.","creator":{"login":"adriaanm","id":91083,"avatar_url":"https://avatars.githubusercontent.com/u/91083?v=3","gravatar_id":"","url":"https://api.github.com/users/adriaanm","html_url":"https://github.com/adriaanm","followers_url":"https://api.github.com/users/adriaanm/followers","following_url":"https://api.github.com/users/adriaanm/following{/other_user}","gists_url":"https://api.github.com/users/adriaanm/gists{/gist_id}","starred_url":"https://api.github.com/users/adriaanm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriaanm/subscriptions","organizations_url":"https://api.github.com/users/adriaanm/orgs","repos_url":"https://api.github.com/users/adriaanm/repos","events_url":"https://api.github.com/users/adriaanm/events{/privacy}","received_events_url":"https://api.github.com/users/adriaanm/received_events","type":"User","site_admin":false},"open_issues":22,"closed_issues":8,"state":"open","created_at":"2016-06-21T15:54:47Z","updated_at":"2016-08-14T07:59:11Z","due_on":"2016-11-07T08:00:00Z","closed_at":null},"comments":18,"created_at":"2016-07-29T10:09:47Z","updated_at":"2016-08-14T15:58:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scala/scala/pulls/5310","html_url":"https://github.com/scala/scala/pull/5310","diff_url":"https://github.com/scala/scala/pull/5310.diff","patch_url":"https://github.com/scala/scala/pull/5310.patch"},"body":"Implements literal types. Enabled by `-Yliteral-types` or `-Xexperimental`.\r\n\r\nThis is a continuation of work by @folone and @adriaanm. The work on @adriaanm's [branch](https://github.com/adriaanm/scala/tree/sip23) was the starting point and all the TODO items on the corresponding [PR](https://github.com/adriaanm/scala/pull/21) have been completed.\r\n\r\n+ Literals can now appear in type position, designating the corresponding singleton type.\r\n+ Widening/narrowing behaviour is consistent with 2.11.x and between 2.12.x with the flag enabled and disabled. The use of `final` on a val definition to explicitly request an unwidened type to be inferred is preserved. Type parameter inference remains the same unless the inference of a singleton type is explicitly requested via a `<: Singleton` bound.\r\n+ A `scala.ValueOf[T]` type class and corresponding `scala.Predef.valueOf[T]` operator has been added yielding the unique value of types with a single inhabitant.\r\n+ `isInstanceOf`/`asInstanceOf` tests/conversions are implemented via equality/identity tests for singleton types.\r\n+ Support for `scala.Symbol` literal types has been added.\r\n+ The spec markdown files have been updated.\r\n+ Many tests for all of the above have been added.\r\n+ All (par)tests pass.\r\n+ With `-Yliteral-types` enabled on _all_ tests there are 15 test result changes, all of which are expected. See below for details.\r\n+ Types reported in error messages are widened where appropriate, matching behaviour with the flag disabled (eg. we report 'Found String expected Int' instead of 'Found \"foo\" expected Int').\r\n+ The public macro API is unchanged relative to 2.11.x. In contrast to @adriaanm's branch there are now non-API `LiteralConstantType` and `FoldableConstantType` subtypes of the API type `ConstantType`.\r\n* shapeless is likely to be the library most directly affected by the above changes and, with only minor 2.11.x source-compatible [changes](https://github.com/milessabin/shapeless/commit/b9774c2ab2d8ebc2232399a2e7c2b21c028ba710), it compiles and passes all tests with `-Yliteral-types` both enabled and disabled.\r\n\r\n### Related bugs fixed in this PR\r\n\r\n+ [SI-1273](https://issues.scala-lang.org/browse/SI-1273) Singleton type has wrong bounds\r\n+ [SI-5103](https://issues.scala-lang.org/browse/SI-5103) Singleton types not inferred in all places they should be\r\n+ [SI-8323](https://issues.scala-lang.org/browse/SI-8323) Duplicate method name & signature with singleton type parameters over constant types\r\n+ [SI-8564](https://issues.scala-lang.org/browse/SI-8564) Methods with ConstantType results get the inhabitant of ConstantType as their body\r\n\r\n### Test result changes with `-Yliteral-types` enabled for all tests\r\n\r\n#### New warnings due to Symbol literals becoming pure:\r\n+ test/files/instrumented/indy-symbol-literal.scala\r\n\r\n#### Error messages changed due to more precise types being reported:\r\n+ test/files/neg/t8323.scala\r\n\r\n#### Pos tests which correctly become neg with -Yliteral-types\r\n+ test/files/pos/unchecked-a.scala\r\n\r\n#### Neg tests which correctly become pos with -Yliteral-types:\r\n+ test/files/neg/any-vs-anyref.scala\r\n+ test/files/neg/not-possible-cause.scala\r\n+ test/files/neg/t6263.scala\r\n+ test/files/neg/t900.scala\r\n\r\n#### Error messages changed correctly:\r\n+ test/files/neg/t8463.scala\r\n+ test/files/run/repl-colon-type.scala\r\n\r\n#### Compiler/REPL output changed due to more precise types being reported:\r\n+ test/files/neg/logImplicits.scala\r\n+ test/files/run/analyzerPlugins.scala\r\n+ test/files/run/delambdafy_uncurry_byname_inline.scala\r\n\r\n#### Compiler/REPL output changed due to Symbols becoming first-class literals:\r\n+ test/files/run/t6549.scala\r\n\r\n#### Run tests which correctly fail:\r\n+ test/files/run/sip23-cast-0.scala\r\n\r\n#### Unavoidable failure due to the enablement of the feature:\r\n+ test/files/run/settings-parse.scala\r\n"},"comment":{"url":"https://api.github.com/repos/scala/scala/issues/comments/239681141","html_url":"https://github.com/scala/scala/pull/5310#issuecomment-239681141","issue_url":"https://api.github.com/repos/scala/scala/issues/5310","id":239681141,"user":{"login":"adriaanm","id":91083,"avatar_url":"https://avatars.githubusercontent.com/u/91083?v=3","gravatar_id":"","url":"https://api.github.com/users/adriaanm","html_url":"https://github.com/adriaanm","followers_url":"https://api.github.com/users/adriaanm/followers","following_url":"https://api.github.com/users/adriaanm/following{/other_user}","gists_url":"https://api.github.com/users/adriaanm/gists{/gist_id}","starred_url":"https://api.github.com/users/adriaanm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriaanm/subscriptions","organizations_url":"https://api.github.com/users/adriaanm/orgs","repos_url":"https://api.github.com/users/adriaanm/repos","events_url":"https://api.github.com/users/adriaanm/events{/privacy}","received_events_url":"https://api.github.com/users/adriaanm/received_events","type":"User","site_admin":false},"created_at":"2016-08-14T15:58:30Z","updated_at":"2016-08-14T15:58:30Z","body":"I added a [comment](https://github.com/scala/scala.github.com/pull/346) to the SIP to summarize our discussion during last week's meeting."}}
{"actor":{"display_login":"adriaanm"}}