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

fix stylecheck bug with nre #19356

Merged
merged 14 commits into from
Apr 8, 2022
Merged

Conversation

ringabout
Copy link
Member

@ringabout ringabout commented Jan 10, 2022

Before nim r --stylecheck:error --eval:"import nre"

nre.nim(144, 22) Error: 'pcre' should be: 'Pcre' [type declared in C:\Users\blue\.choosenim\toolchains\nim-#devel\lib\wrappers\pcre.nim(257, 3)]   
type
  Regex* = ref object
    pattern*: string
    pcreObj: ptr pcre.Pcre  ## not nil
    pcreExtra: ptr pcre.ExtraData  ## nil

    captureNameToId: Table[string, int]

compiler/linter.nim Outdated Show resolved Hide resolved
compiler/linter.nim Outdated Show resolved Hide resolved
@ringabout ringabout marked this pull request as draft January 11, 2022 14:21
compiler/linter.nim Outdated Show resolved Hide resolved
@ringabout ringabout marked this pull request as ready for review January 11, 2022 14:25
@ringabout
Copy link
Member Author

proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
    markUsed(c, n[1].info, s)   # <----------  dotexpr is already checked here
    result = semSym(c, n, s, flags) # we shouldn't let semSym check dotexpr again 
    onUse(n[1].info, s)
    return

@ringabout
Copy link
Member Author

find another same bug

serve.nim

const Serve* = 12

test.nim

import serve

echo serve.Serve

test.nim(9, 11) Error: 'serve' should be: 'Serve' [const declared in C:\Users\blue\Downloads\Nim\serve.nim(1, 7)]

@ringabout
Copy link
Member Author

Ready for review

@Araq Araq merged commit 00775f6 into nim-lang:devel Apr 8, 2022
@arnetheduck
Copy link
Contributor

Can we get a backport? been hitting this too.

@ringabout
Copy link
Member Author

Can we get a backport? been hitting this too.

If you would like a commit to be backported (and it should), you can @narimiran in case that the message is ignored. Nowadays it seems that contributing to 1-6 branch directly is acceptable => #19697

@narimiran
Copy link
Member

narimiran commented Apr 8, 2022

Nowadays it seems that contributing to 1-6 branch directly is acceptable

If somebody (accidentally) does it, it doesn't mean it is acceptable/preferred. I would much rather have PRs targeted at devel and marked as [backport].

@ringabout
Copy link
Member Author

ringabout commented Apr 8, 2022

Though it happened multiple times:

#19583
#19269
#19047

Even the rule has already been written into the contributuing guide.

narimiran pushed a commit that referenced this pull request Apr 8, 2022
* stylecheck usages part two: stdlib cleanup

typeinfo.nim: importCompilerProc => importcompilerproc

nre.nim: newLineFlags => newlineFlags

system.nim: JSRoot => JsRoot

ref #19319

* prefer importCompilerProc

* fix stylecheck error with asyncdispatch

it is a partial regression since #12842

* add tests

* don't use echo in tests

* fix stylecheck bug with nre

* Update compiler/linter.nim

* no need to check dotexpr again

* neither did let/var/const

(cherry picked from commit 00775f6)
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.

4 participants