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: patch-diff.githubusercontent.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:fbd174a3-2a50-c6c1-e2d1-22a4650245ea |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EC18:1BFE61:1BC3641:23D634D:6992786A |
| html-safe-nonce | a422eaaa654253815ba74293e40f14d3c60acc872180db2d5e8c8f981ade76a1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzE4OjFCRkU2MToxQkMzNjQxOjIzRDYzNEQ6Njk5Mjc4NkEiLCJ2aXNpdG9yX2lkIjoiMTk4NDc0NjI3Mzc3Mzg3NzM1NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | dfd3550770303905a37e585edcd36f466edd30531c8d9dde7d1edbd57aa30282 |
| 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 | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| 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 | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width