diff --git a/spec/compiler/parser/parser_spec.cr b/spec/compiler/parser/parser_spec.cr
index 3f0ff66548615f645298fe740445a661cd038924..4dc0b1818cea495933fc442e028eaefbc7dc11d2 100755
--- a/spec/compiler/parser/parser_spec.cr
+++ b/spec/compiler/parser/parser_spec.cr
@@ -613,8 +613,8 @@ describe "Parser" do
 
   it_parses "foo $a", Call.new(nil, "foo", [Global.new("$a")] of ASTNode)
 
-  it_parses "$1", Call.new(Global.new("$~"), "[]", [1.int32] of ASTNode)
-  it_parses "foo $1", Call.new(nil, "foo", [Call.new(Global.new("$~"), "[]", [1.int32] of ASTNode)] of ASTNode)
+  it_parses "$1", Call.new(Call.new(Global.new("$~"), "not_nil!"), "[]", [1.int32] of ASTNode)
+  it_parses "foo $1", Call.new(nil, "foo", [Call.new(Call.new(Global.new("$~"), "not_nil!"), "[]", [1.int32] of ASTNode)] of ASTNode)
   it_parses "foo /a/", Call.new(nil, "foo", [RegexLiteral.new("a")] of ASTNode)
 
   it_parses "foo out x; x", [Call.new(nil, "foo", [Out.new("x".var)] of ASTNode), "x".var]
diff --git a/src/compiler/crystal/parser.cr b/src/compiler/crystal/parser.cr
index 5dbd5d31528e34d7b8ee91fc3387e70f550180b1..3bc0aa9b0831603acfdee16eff9f256d8638f97f 100644
--- a/src/compiler/crystal/parser.cr
+++ b/src/compiler/crystal/parser.cr
@@ -707,7 +707,7 @@ module Crystal
       when :GLOBAL
         node_and_next_token Global.new(@token.value.to_s)
       when :GLOBAL_MATCH
-        node_and_next_token Call.new(Global.new("$~"), "[]", [NumberLiteral.new(@token.value.to_s, :i32)] of ASTNode)
+        node_and_next_token Call.new(Call.new(Global.new("$~"), "not_nil!"), "[]", [NumberLiteral.new(@token.value.to_s, :i32)] of ASTNode)
       when :IDENT
         case @token.value
         when :begin