summary refs log tree commit diff stats
path: root/compiler/sem.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2023-12-12 16:54:50 +0100
committerGitHub <noreply@github.com>2023-12-12 16:54:50 +0100
commitdb603237c648a796ef7bff77641febd30b3999cd (patch)
tree13e693ac432b1542cab7f2b2bbe1b8c11ca258e0 /compiler/sem.nim
parent8cc3c774c8925c3d21626d09b41ad352bd898e4a (diff)
downloadNim-db603237c648a796ef7bff77641febd30b3999cd.tar.gz
Types: Refactorings; step 1 (#23055)
Diffstat (limited to 'compiler/sem.nim')
-rw-r--r--compiler/sem.nim10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim
index 03e599753..d63fa56c9 100644
--- a/compiler/sem.nim
+++ b/compiler/sem.nim
@@ -196,8 +196,8 @@ proc commonType*(c: PContext; x, y: PType): PType =
       k = a.kind
       if b.kind != a.kind: return x
       # bug #7601, array construction of ptr generic
-      a = a.lastSon.skipTypes({tyGenericInst})
-      b = b.lastSon.skipTypes({tyGenericInst})
+      a = a.elementType.skipTypes({tyGenericInst})
+      b = b.elementType.skipTypes({tyGenericInst})
     if a.kind == tyObject and b.kind == tyObject:
       result = commonSuperclass(a, b)
       # this will trigger an error later:
@@ -498,15 +498,15 @@ proc semAfterMacroCall(c: PContext, call, macroResult: PNode,
   c.friendModules.add(s.owner.getModule)
   result = macroResult
   resetSemFlag result
-  if s.typ[0] == nil:
+  if s.typ.returnType == nil:
     result = semStmt(c, result, flags)
   else:
-    var retType = s.typ[0]
+    var retType = s.typ.returnType
     if retType.kind == tyTypeDesc and tfUnresolved in retType.flags and
         retType.len == 1:
       # bug #11941: template fails(T: type X, v: auto): T
       # does not mean we expect a tyTypeDesc.
-      retType = retType[0]
+      retType = retType.skipModifier
     case retType.kind
     of tyUntyped, tyAnything:
       # Not expecting a type here allows templates like in ``tmodulealias.in``.