Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement for enums #1400

Merged
merged 5 commits into from Nov 30, 2022
Merged

enhancement for enums #1400

merged 5 commits into from Nov 30, 2022

Conversation

sdghchj
Copy link
Member

@sdghchj sdghchj commented Nov 28, 2022

Describe the PR

  1. explicit enum conversion;
  2. implicit integer conversion;
  3. keep the type of the right operand of a shift operation; fix panic: runtime error: negative shift amount #1392 negative shift amount as a result of expression ^uint(0)
  4. parse escape characters.
  5. rune type in binary expressions. fix panic: runtime error: negative shift amount #1392 interface{} is nil, not int
  6. function len to get the length of a literal string
  7. parse hex and oct numbers

Relation issue
#1392

examples:

const uintSize = 32 << (^uint(uintptr(0)) >> 63)
const maxBase = 10 + ('z' - 'a' + 1) + ('Z' - 'A' + 1)
const shlByLen = 1 << len("aaa")
const hexnum = 0xFF
const octnum = 017
const nonescapestr = `aa\nbb\u8888cc`
const escapestr = "aa\nbb\u8888cc"
const escapechar = '\u8888'

type Class int
const A Class = 1
const B = Class(2) 

1. explicit enum conversion;
2. implicit integer conversion;
3. keep the type of the right operand of a shift operation;
3. parse escape characters.
@codecov
Copy link

codecov bot commented Nov 29, 2022

Codecov Report

Base: 95.04% // Head: 85.16% // Decreases project coverage by -9.88% ⚠️

Coverage data is based on head (939c8d6) compared to base (a10fb9a).
Patch coverage: 29.58% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1400      +/-   ##
==========================================
- Coverage   95.04%   85.16%   -9.89%     
==========================================
  Files          16       19       +3     
  Lines        3111     3620     +509     
==========================================
+ Hits         2957     3083     +126     
- Misses         89      459     +370     
- Partials       65       78      +13     
Impacted Files Coverage Δ
const.go 23.20% <23.20%> (ø)
package.go 73.07% <57.69%> (-15.23%) ⬇️
utils_other.go 89.47% <89.47%> (ø)
utils_go18.go 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@sdghchj sdghchj requested a review from ubogdan November 29, 2022 05:44
@sdghchj sdghchj merged commit e50db3e into master Nov 30, 2022
@sdghchj sdghchj deleted the enums branch November 30, 2022 01:34
@enricorotundo
Copy link

hey @sdghchj thanks so much for adding support for enums 🎉

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.

panic: runtime error: negative shift amount
3 participants