Revert "fixes #3748 (#20563)"

This reverts commit 42ff3aa75a.
This commit is contained in:
narimiran
2023-05-31 07:16:59 +02:00
parent 653865559a
commit b855404c71
3 changed files with 4 additions and 19 deletions

View File

@@ -67,7 +67,7 @@ type
efWantStmt, efAllowStmt, efDetermineType, efExplain,
efWantValue, efOperand, efNoSemCheck,
efNoEvaluateGeneric, efInCall, efFromHlo, efNoSem2Check,
efNoUndeclared, efIsDotCall
efNoUndeclared
# Use this if undeclared identifiers should not raise an error during
# overload resolution.
efNoDiagnostics

View File

@@ -988,7 +988,7 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType
var prc = n[0]
if n[0].kind == nkDotExpr:
checkSonsLen(n[0], 2, c.config)
let n0 = semFieldAccess(c, n[0], {efIsDotCall})
let n0 = semFieldAccess(c, n[0])
if n0.kind == nkDotCall:
# it is a static call!
result = n0
@@ -1519,9 +1519,8 @@ proc dotTransformation(c: PContext, n: PNode): PNode =
proc semFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
# this is difficult, because the '.' is used in many different contexts
# in Nim. We first allow types in the semantic checking.
result = builtinFieldAccess(c, n, flags - {efIsDotCall})
if result == nil or ((result.typ == nil or result.typ.skipTypes(abstractInst).kind != tyProc) and
efIsDotCall in flags and callOperator notin c.features):
result = builtinFieldAccess(c, n, flags)
if result == nil:
result = dotTransformation(c, n)
proc buildOverloadedSubscripts(n: PNode, ident: PIdent): PNode =

View File

@@ -75,17 +75,3 @@ proc add*[TKey, TData](root: var PElement[TKey, TData], key: TKey, data: TData)
var tree = PElement[int, int](kind: ElementKind.inner, key: 0, left: nil, right: nil)
let result = add(tree, 1, 1)
echo(result)
# bug #3748
type
Foo = object
bar: int
proc bar(cur: Foo, val: int, s:seq[string]) =
discard cur.bar
proc does_fail(): Foo =
let a = @["a"]
result.bar(5, a)
doAssert does_fail().bar == 0