Skip to content
Browse files

Concrete objects should be true when treated as booleans by default.

  • Loading branch information...
1 parent 868b4bd commit 580829d2ea337c57fad19273d232ccfb15b9baa4 @pmurias committed
Showing with 5 additions and 2 deletions.
  1. +1 −1 nqp-src/NQPCORE.setting
  2. +4 −1 t/qast-node.t
View
2 nqp-src/NQPCORE.setting
@@ -579,7 +579,7 @@ my class NQPMu {
"";
}
method Bool() {
- 0;
+ nqp::isconcrete(self);
}
}
View
5 t/qast-node.t
@@ -1,5 +1,5 @@
use QASTNode;
-plan(20);
+plan(21);
{
my $node := QAST::Node.new();
@@ -44,3 +44,6 @@ plan(20);
my $node2 := QAST::Node.new();
ok($node2.unique('foo') eq 'foo_3',"the names are unique even when generated from different objects");
}
+{
+ ok(nqp::istrue(QAST::Node.new()) == 1,"a QAST::Node is true in a boolean context");
+}

0 comments on commit 580829d

Please sign in to comment.
Something went wrong with that request. Please try again.