Skip to content

Conversation

@graceful-potato
Copy link
Contributor

Ruby constant should begins with an uppercase letter.
_variable_name is not a constant

@noniq noniq merged commit 414593f into textmate:master Oct 30, 2019
@noniq
Copy link
Member

noniq commented Oct 30, 2019

Good catch. Support for leading underscores was added in 6628e6c without further explanation. The correct regexp should have been '\b_?[A-Z]\w*\b' though, to not match variables starting with an underscore.

However, Ruby obviously does not support constants starting with an underscore:

_FOO = 1
self.class.const_defined?(:_FOO)
# ~> -:2:in `const_defined?': wrong constant name _FOO (NameError)
# ~> 	from -:2:in `<main>'

So this fix totally makes sense. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants