{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/13668","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/13668/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/13668/comments","events_url":"https://api.github.com/repos/angular/angular/issues/13668/events","html_url":"https://github.com/angular/angular/issues/13668","id":197495134,"number":13668,"title":"[NGC] Error encountered resolving symbol values statically","user":{"login":"gund","id":3644678,"avatar_url":"https://avatars.githubusercontent.com/u/3644678?v=3","gravatar_id":"","url":"https://api.github.com/users/gund","html_url":"https://github.com/gund","followers_url":"https://api.github.com/users/gund/followers","following_url":"https://api.github.com/users/gund/following{/other_user}","gists_url":"https://api.github.com/users/gund/gists{/gist_id}","starred_url":"https://api.github.com/users/gund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gund/subscriptions","organizations_url":"https://api.github.com/users/gund/orgs","repos_url":"https://api.github.com/users/gund/repos","events_url":"https://api.github.com/users/gund/events{/privacy}","received_events_url":"https://api.github.com/users/gund/received_events","type":"User","site_admin":false},"labels":[{"id":375501288,"url":"https://api.github.com/repos/angular/angular/labels/comp:%20core%20&%20compiler","name":"comp: core & compiler","color":"c7def8","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-12-25T10:09:43Z","updated_at":"2016-12-30T11:38:21Z","closed_at":"2016-12-27T22:34:12Z","body":"**I'm submitting a ...**  (check one with \"x\")\r\n```\r\n[x] bug report => search github for a similar issue or PR before submitting\r\n[ ] feature request\r\n[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n```\r\n\r\n**Current behavior**\r\nIf you have generic class that used inside of Service exposed in @NgModule providers array NGC will fail with error:\r\n```\r\nERROR in Error encountered resolving symbol values statically. Could not resolve type T (position X\r\n resolving symbol Y in D)\r\n```\r\n\r\n**Expected behavior**\r\nShould compile without any problems.\r\n\r\n**Minimal reproduction of the problem with instructions**\r\n* Create simple app with `ng new` command\r\n* Create some service and some generic class that one of methods of the service returns\r\n* Run `ng build --aot` and watch it fails\r\n\r\nOr just clone and run [this repo](https://github.com/gund/ngc-test).\r\n\r\n**What is the motivation / use case for changing the behavior?**\r\nThis kind of code prevents entire application from AOT compilation\r\n\r\n**Please tell us about your environment:**\r\nWindows 10 x64\r\nNode v6.9.2\r\nTS 2.0.3\r\n\r\n* **Angular version:** 2.3.1\r\n\r\n* **Browser:** [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]\r\n \r\n* **Language:** [all | TypeScript X.X | ES6/7 | ES5]\r\n\r\n* **Node (for AoT issues):** `node --version` =   6.9.2\r\n"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/269762102","html_url":"https://github.com/angular/angular/issues/13668#issuecomment-269762102","issue_url":"https://api.github.com/repos/angular/angular/issues/13668","id":269762102,"user":{"login":"gund","id":3644678,"avatar_url":"https://avatars.githubusercontent.com/u/3644678?v=3","gravatar_id":"","url":"https://api.github.com/users/gund","html_url":"https://github.com/gund","followers_url":"https://api.github.com/users/gund/followers","following_url":"https://api.github.com/users/gund/following{/other_user}","gists_url":"https://api.github.com/users/gund/gists{/gist_id}","starred_url":"https://api.github.com/users/gund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gund/subscriptions","organizations_url":"https://api.github.com/users/gund/orgs","repos_url":"https://api.github.com/users/gund/repos","events_url":"https://api.github.com/users/gund/events{/privacy}","received_events_url":"https://api.github.com/users/gund/received_events","type":"User","site_admin":false},"created_at":"2016-12-30T11:38:21Z","updated_at":"2016-12-30T11:38:21Z","body":"@tbosch yes I understand why compiler makes `TestInContextService` class `Injectable` but the thing is I do not need it to be `Injectable`. In fact all instantiating will happen in one of the methods in `TestService`.\r\nSo `TestInContextService` becomes sort of wrapper around `TestService` and controls how some of the methods are invoked in `TestService` however it should preserve all semantics of the original `TestService` that's why `extend`ing is necessary here but not DI capabilities.\r\n\r\nThat being said I was thinking about a way of telling NGC compiler to not assume some classes `Injectable`s even though they extend `Injectable` (please keep in mind that this will work without any problems in JIT mode so it is purely a NGC limitation).\r\n\r\nIt seems like it goes more to a feature request so considering all the above what do you think does it makes sense to create another issue as a feature request?\r\n(I still think having something like `@NonInjectable` annotation would be great (: ).\r\n\r\nSo use case will be like this:\r\n```ts\r\n@Injectable()\r\nclass TestService { }\r\n\r\n@NonInjectable()\r\nclass TestInContextService extends TestService { } // But no longer injectable and not provided anywhere\r\n```\r\n\r\n`NonInjectable` annotation might even do nothing because no action required for these case to work in runtime, so it can be just as a marker for compiler."}}
{"actor":{"display_login":"gund"}}