Title: String.slice(str, 0, -1) raises FunctionClauseError · Issue #496 · elixirscript/elixirscript · GitHub
Open Graph Title: String.slice(str, 0, -1) raises FunctionClauseError · Issue #496 · elixirscript/elixirscript
X Title: String.slice(str, 0, -1) raises FunctionClauseError · Issue #496 · elixirscript/elixirscript
Description: This snippet of Elixir: String.slice(str, 0, -1) Started with slice/2 form of this call, but swapped to slice/3 to confirm the error wasn't being generated by the Elixir range. Raises the following exception ** (EXIT from #PID<0.95.0>) a...
Open Graph Description: This snippet of Elixir: String.slice(str, 0, -1) Started with slice/2 form of this call, but swapped to slice/3 to confirm the error wasn't being generated by the Elixir range. Raises the following...
X Description: This snippet of Elixir: String.slice(str, 0, -1) Started with slice/2 form of this call, but swapped to slice/3 to confirm the error wasn't being generated by the Elixir range. Raises the follo...
Opengraph URL: https://github.com/elixirscript/elixirscript/issues/496
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"String.slice(str, 0, -1) raises FunctionClauseError","articleBody":"**This snippet of Elixir:**\r\n\r\n`String.slice(str, 0, -1)`\r\n\r\nStarted with slice/2 form of this call, but swapped to slice/3 to confirm the error wasn't being generated by the Elixir range.\r\n\r\n**Raises the following exception**\r\n\r\n\u003e ** (EXIT from #PID\u003c0.95.0\u003e) an exception was raised:\r\n\u003e ** (FunctionClauseError) no function clause matching in ElixirScript.Translate.Form.compile/2\r\n\u003e lib/elixir_script/passes/translate/form.ex:28: ElixirScript.Translate.Form.compile(\u0026Inspect.inspect/2, %{anonymous_fn: false, function: {:__struct__, nil}, in_guard: false, module: Inspect.Opts, pid: #PID\u003c0.200.0\u003e, vars: %{}})\r\n\u003e lib/elixir_script/passes/translate/form.ex:16: ElixirScript.Translate.Form.compile!/2\r\n\u003e lib/elixir_script/passes/translate/forms/map.ex:37: anonymous fn/2 in ElixirScript.Translate.Forms.Map.compile/2\r\n\u003e (elixir 1.10.4) lib/enum.ex:1396: Enum.\"-map/2-lists^map/1-0-\"/2\r\n\u003e (elixir 1.10.4) lib/enum.ex:1396: Enum.\"-map/2-lists^map/1-0-\"/2\r\n\u003e lib/elixir_script/passes/translate/forms/map.ex:32: ElixirScript.Translate.Forms.Map.compile/2\r\n\u003e lib/elixir_script/passes/translate/form.ex:16: ElixirScript.Translate.Form.compile!/2\r\n\u003e lib/elixir_script/passes/translate/function.ex:170: ElixirScript.Translate.Function.compile_block/2\r\n\r\n**Modified Transcript.Form.compile! as follows:**\r\n\r\n```\r\n @spec compile!(any, map) :: ESTree.Node.t()\r\n def compile!(ast, state) do\r\n {js_ast, _} = compile(ast, state)\r\n js_ast\r\n rescue\r\n e -\u003e Logger.debug inspect({:compile!, ast, state})\r\n raise RuntimeError, message: inspect({\"compile!/2\", e})\r\n end\r\n```\r\n\r\n**Which revealed the following debugging info:**\r\n\r\n\u003e 03:45:21.580 [debug] {:compile!, \u0026Inspect.inspect/2, %{anonymous_fn: false, function: {:__struct__, nil}, in_guard: false, module: Inspect.Opts, pid: #PID\u003c0.200.0\u003e, vars: %{}}}\r\n\u003e \r\n\u003e 03:45:21.696 [debug] {:compile!, {:%{}, [line: 74], [__struct__: Inspect.Opts, base: :decimal, binaries: :infer, char_lists: :infer, charlists: :infer, custom_options: [], inspect_fun: \u0026Inspect.inspect/2, limit: 50, pretty: false, printable_limit: 4096, safe: true, structs: true, syntax_colors: [], width: 80]}, %{anonymous_fn: false, function: {:__struct__, nil}, in_guard: false, module: Inspect.Opts, pid: #PID\u003c0.200.0\u003e, vars: %{}}}\r\n\r\n**Thoughts**\r\n\r\nNot too familiar with this codebase, but I'm working from the premise that `inspect_fun: \u0026Inspect.inspect/2` might be malformed, for it to be promoted into the `ast` parameter of `compile!`.","author":{"url":"https://github.com/beadsland","@type":"Person","name":"beadsland"},"datePublished":"2020-08-01T08:40:06.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/496/elixirscript/issues/496"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:afcfb4a2-b46f-d700-77ec-5a79a052fe5b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EDE2:320F8E:1CAC6B5:2722D04:696ABB5D |
| html-safe-nonce | 2a2394a2805235eee3d1b9fa8aee25cde9af6e8d33e1c490b3f5249cc00b7bff |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFREUyOjMyMEY4RToxQ0FDNkI1OjI3MjJEMDQ6Njk2QUJCNUQiLCJ2aXNpdG9yX2lkIjoiNzM4NTA4NjkxNzM3MzI0NjMwMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | bc272524efaae9222fe92681470a1216f1705bf1b554d986a74618246a5f1cc5 |
| hovercard-subject-tag | issue:670666555 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/elixirscript/elixirscript/496/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7d71b81ecfb9e1db1f857c4a0fdfc22d719216a26ffbb734ca58b239571c03ef/elixirscript/elixirscript/issues/496 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7d71b81ecfb9e1db1f857c4a0fdfc22d719216a26ffbb734ca58b239571c03ef/elixirscript/elixirscript/issues/496 |
| og:image:alt | This snippet of Elixir: String.slice(str, 0, -1) Started with slice/2 form of this call, but swapped to slice/3 to confirm the error wasn't being generated by the Elixir range. Raises the following... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | beadsland |
| hostname | github.com |
| expected-hostname | github.com |
| None | 46ce962e0e18113ea447391b6ace8b02d4d2861e57b4fbab3658698f73d8855b |
| turbo-cache-control | no-preview |
| go-import | github.com/elixirscript/elixirscript git https://github.com/elixirscript/elixirscript.git |
| octolytics-dimension-user_id | 25870092 |
| octolytics-dimension-user_login | elixirscript |
| octolytics-dimension-repository_id | 30160313 |
| octolytics-dimension-repository_nwo | elixirscript/elixirscript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 30160313 |
| octolytics-dimension-repository_network_root_nwo | elixirscript/elixirscript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 30300f30bb3949de255e84a146706a3bdb5c19c9 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width