summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/parser.nim2
-rw-r--r--compiler/semtypes.nim7
2 files changed, 7 insertions, 2 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim
index 07f5c9de9..c68c80b46 100644
--- a/compiler/parser.nim
+++ b/compiler/parser.nim
@@ -220,7 +220,7 @@ proc getPrecedence(tok: TToken, strongSpaces: bool): int =
   of tkIn, tkNotin, tkIs, tkIsnot, tkNot, tkOf, tkAs: result = 5
   of tkDotDot: result = considerStrongSpaces(6)
   of tkAnd: result = 4
-  of tkOr, tkXor: result = 3
+  of tkOr, tkXor, tkPtr, tkRef: result = 3
   else: result = -10
 
 proc isOperator(tok: TToken): bool =
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index 679a01699..5e391cc93 100644
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -125,11 +125,12 @@ proc semAnyRef(c: PContext; n: PNode; kind: TTypeKind; prev: PType): PType =
   if n.len < 1:
     result = newConstraint(c, kind)
   else:
+    let isCall = ord(n.kind in nkCallKinds)
     let n = if n[0].kind == nkBracket: n[0] else: n
     checkMinSonsLen(n, 1)
     result = newOrPrevType(kind, prev, c)
     # check every except the last is an object:
-    for i in 0 .. n.len-2:
+    for i in isCall .. n.len-2:
       let region = semTypeNode(c, n[i], nil)
       if region.skipTypes({tyGenericInst}).kind notin {tyError, tyObject}:
         message n[i].info, errGenerated, "region needs to be an object type"
@@ -1107,6 +1108,10 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType =
           result = makeNotType(c, negated)
         else:
           localError(n.info, errGenerated, "invalid type")
+      elif op.id == ord(wPtr):
+        result = semAnyRef(c, n, tyPtr, prev)
+      elif op.id == ord(wRef):
+        result = semAnyRef(c, n, tyRef, prev)
       else:
         result = semTypeExpr(c, n)
     else: