diff options
author | metagn <metagngn@gmail.com> | 2023-05-20 22:09:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-20 21:09:16 +0200 |
commit | 641e34bcb2acf8e289c5be67f5fb1164cb6be80a (patch) | |
tree | da6bf730c7045a3aae204c8262dc3a53d6dbf9d0 /compiler | |
parent | a852b2e9cf80e806a85c92149d9f68f592e32185 (diff) | |
download | Nim-641e34bcb2acf8e289c5be67f5fb1164cb6be80a.tar.gz |
fix #14254 (#21837)
* fix #14254 * use temporary PR branch for neo * fix url
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semexprs.nim | 4 | ||||
-rw-r--r-- | compiler/semgnrc.nim | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 4dd7840f1..b79abadff 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1522,7 +1522,9 @@ proc builtinFieldAccess(c: PContext; n: PNode; flags: var TExprFlags): PNode = flags.incl efCannotBeDotCall proc dotTransformation(c: PContext, n: PNode): PNode = - if isSymChoice(n[1]): + if isSymChoice(n[1]) or + # generics usually leave field names as symchoices, but not types + (n[1].kind == nkSym and n[1].sym.kind == skType): result = newNodeI(nkDotCall, n.info) result.add n[1] result.add copyTree(n[0]) diff --git a/compiler/semgnrc.nim b/compiler/semgnrc.nim index 01146bb7c..7dec8a30d 100644 --- a/compiler/semgnrc.nim +++ b/compiler/semgnrc.nim @@ -152,12 +152,16 @@ proc fuzzyLookup(c: PContext, n: PNode, flags: TSemGenericFlags, result = n let n = n[1] let ident = considerQuotedIdent(c, n) - var candidates = searchInScopesFilterBy(c, ident, routineKinds) + var candidates = searchInScopesFilterBy(c, ident, routineKinds+{skType}) + # skType here because could be type conversion if candidates.len > 0: let s = candidates[0] # XXX take into account the other candidates! isMacro = s.kind in {skTemplate, skMacro} if withinBind in flags or s.id in ctx.toBind: - result = newDot(result, symChoice(c, n, s, scClosed)) + if s.kind == skType: # don't put types in sym choice + result = newDot(result, semGenericStmtSymbol(c, n, s, ctx, flags, fromDotExpr=true)) + else: + result = newDot(result, symChoice(c, n, s, scClosed)) elif s.isMixedIn: result = newDot(result, symChoice(c, n, s, scForceOpen)) else: |