* fix #14254

* use temporary PR branch for neo

* fix url
This commit is contained in:
metagn
2023-05-20 22:09:16 +03:00
committed by GitHub
parent a852b2e9cf
commit 641e34bcb2
5 changed files with 17 additions and 4 deletions

View File

@@ -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])

View File

@@ -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:

View File

@@ -93,7 +93,8 @@ pkg "measuremancer", "nimble testDeps; nimble -y test"
pkg "memo"
pkg "msgpack4nim", "nim c -r tests/test_spec.nim"
pkg "nake", "nim c nakefile.nim"
pkg "neo", "nim c -d:blas=openblas --mm:refc tests/all.nim"
pkg "neo", "nim c -d:blas=openblas --mm:refc tests/all.nim", "https://github.com/metagn/neo"
# remove custom url when https://github.com/andreaferretti/neo/pull/53 is merged
pkg "nesm", "nimble tests", "https://github.com/nim-lang/NESM", useHead = true
pkg "netty"
pkg "nico", allowFailure = true

View File

@@ -19,3 +19,7 @@ import strutils
proc doStrip*[T](a: T): string =
result = ($a).strip()
type Foo = int32
proc baz2*[T](y: int): auto =
result = y.Foo

View File

@@ -38,6 +38,8 @@ block tdotlookup:
# bug #1444
fn(4)
doAssert doStrip(123) == "123"
# bug #14254
doAssert baz2[float](1'i8) == 1
block tmodule_same_as_proc:
# bug #1965