semLambda removed, semProcAux reworked (#17379)

* simplified proc-like name ident to symbol code

* wip - reworking generic param sem

* wip - closer to removing nkEmpty generic params

* it's hacky but tests pass

* slowly tweaking semProcAux to take on semLambda

* fix pragma superset check proto vs current

* Set the symbol owner earlier

* partial progress reworking proto

found bug where default values between forward and impl lead to overload
resolution issues.

* simplified pragma handling and callConv checks

Co-authored-by: Clyybber <Clyybber@users.noreply.github.com>

* partially working

* cgexprs issue

* It works!

* comment clean-up

* clean-up asserts, comments, and other bits

* add isGenericParams, inline isGeneric queries

* seeing if this is sufficiently consistent
* can use this approach or continue it in a further PR

* commentary about nullary generics and clean-ups

* fixed a mistake in PNode isGenericRoutine

* Some small cleanups

* Small cleanup

* for func lambdas ensure we use lambda pragmas

* add some basic compileTime func tests

* [ci skip] remove comments

Co-authored-by: Clyybber <Clyybber@users.noreply.github.com>
Co-authored-by: Clyybber <darkmine956@gmail.com>
This commit is contained in:
Saem Ghani 2021-03-17 11:51:50 -07:00 • committed by GitHub
commit 72b89eff82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 286 additions and 212 deletions

View file

@ -1233,7 +1233,7 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode,
if hasDefault:
def = a[^1]
block determineType:
if genericParams != nil and genericParams.len > 0:
if genericParams.isGenericParams:
def = semGenericStmt(c, def)
if hasUnresolvedArgs(c, def):
def.typ = makeTypeFromExpr(c, def.copyTree)
@ -1361,7 +1361,7 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode,
result.flags.excl tfHasMeta
result.n.typ = r
if genericParams != nil and genericParams.len > 0:
if genericParams.isGenericParams:
for n in genericParams:
if {sfUsed, sfAnon} * n.sym.flags == {}:
result.flags.incl tfUnresolved
@ -1666,7 +1666,7 @@ proc semProcTypeWithScope(c: PContext, n: PNode,
# we construct a fake 'nkProcDef' for the 'mergePragmas' inside 'implicitPragmas'...
s.ast = newTree(nkProcDef, newNodeI(nkEmpty, n.info), newNodeI(nkEmpty, n.info),
newNodeI(nkEmpty, n.info), newNodeI(nkEmpty, n.info), newNodeI(nkEmpty, n.info))
implicitPragmas(c, s, n, {wTags, wRaises})
implicitPragmas(c, s, n.info, {wTags, wRaises})
when useEffectSystem: setEffectsForProcType(c.graph, result, s.ast[pragmasPos])
closeScope(c)