Title: function names that start with colon have weird behavior with first non label compatible character · Issue #8908 · PowerShell/PowerShell · GitHub
Open Graph Title: function names that start with colon have weird behavior with first non label compatible character · Issue #8908 · PowerShell/PowerShell
X Title: function names that start with colon have weird behavior with first non label compatible character · Issue #8908 · PowerShell/PowerShell
Description: Steps to reproduce Note the different requirements: function :hello" {} # allowed single double-quote function hello"" {} #required matching double-quotes function global::hello"" {} #also requires matching double quotes function :hello`...
Open Graph Description: Steps to reproduce Note the different requirements: function :hello" {} # allowed single double-quote function hello"" {} #required matching double-quotes function global::hello"" {} #also requires...
X Description: Steps to reproduce Note the different requirements: function :hello" {} # allowed single double-quote function hello"" {} #required matching double-quotes function global::hello"...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/8908
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"function names that start with colon have weird behavior with first non label compatible character","articleBody":"# Steps to reproduce\r\nNote the different requirements:\r\n\r\n```powershell\r\nfunction :hello\" {} # allowed single double-quote\r\nfunction hello\"\" {} #required matching double-quotes\r\nfunction global::hello\"\" {} #also requires matching double quotes\r\nfunction :hello` more {} # error, 'more' was not expected.\r\n`function hello` more {} # works fine, function name is 'hello more'\r\n```\r\n\r\n# Expected behavior\r\n\r\nAll to be consistent.\r\n\r\n# Actual behavior\r\n\r\nIt seems that some rules for labels are being applied to functions who's name token directly start with a colon, as the rules seem to match, such that any character that would fail as a label character just gets consumed in to the name with no regard to the rules of that character, such as the double-quote in the first statement above, or the backtick in the 4th statement.\r\n\r\nI noticed this while trying to correct the PowerShell/EditorSyntax for function names, see https://github.com/PowerShell/EditorSyntax/pull/156 for my work. I've noticed that a label can also be a function, and that is difficult to properly detect in a TM grammar, so I was double checking some of my matches when I noticed this, and at first thought I had the rules to function names wrong.\r\n\r\n# Environment data\r\n\r\nTested on 5.1 Windows PowerShell and 6.2 preview\r\n```\r\nName Value\r\n---- -----\r\nPSVersion 6.2.0-preview.4\r\nPSEdition Core\r\nGitCommitId 6.2.0-preview.4\r\nOS Microsoft Windows 10.0.18334\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```","author":{"url":"https://github.com/msftrncs","@type":"Person","name":"msftrncs"},"datePublished":"2019-02-18T06:23:12Z","url":"https://github.com/PowerShell/PowerShell/issues/8908"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:9156aa55-a48c-6a49-2459-cce9148f9e4f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AFE4:34C731:30E18:42353:6AFE0F2F |
| html-safe-nonce | 62ef67e3cacfbc8fcc2572105aabe0bcf3f9c3317519263e5344d8d4ac8020ec |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRkU0OjM0QzczMTozMEUxODo0MjM1Mzo2QUZFMEYyRiIsInZpc2l0b3JfaWQiOiIxNzYxNjAxODYyMTE0MzQ4ODQ3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1dd3fe9efe1cc0150d89fe88511b105b4e177a2217b17097ea3c4f463c7dba39 |
| hovercard-subject-tag | issue:411319137 |
| 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/PowerShell/PowerShell/8908/issue_layout |
| twitter:image | https://opengraph.githubassets.com/06b21a9686a489ee695aee62da15f997bdebc401996da9b56f030668ac82d28c/PowerShell/PowerShell/issues/8908 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/06b21a9686a489ee695aee62da15f997bdebc401996da9b56f030668ac82d28c/PowerShell/PowerShell/issues/8908 |
| og:image:alt | Steps to reproduce Note the different requirements: function :hello" {} # allowed single double-quote function hello"" {} #required matching double-quotes function global::hello"" {} #also requires... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | msftrncs |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1fd4053be37b4bd545b4f38f1cecad058c343776acf2cbc6806316f26270e55e |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| 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 | 635a57b3d0df6bc21c0f39fc7078888fb90e4066 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width