Skip to content
Snippets Groups Projects
Commit c9c780a1 authored by Florian Angerer's avatar Florian Angerer
Browse files

Fix: added missing guard.

parent 0512825a
No related branches found
No related tags found
No related merge requests found
......@@ -57,7 +57,7 @@ public abstract class IsElementFastPath extends RFastPathNode {
return RRuntime.LOGICAL_FALSE;
}
@Specialization(replaces = "iselementOneCachedString")
@Specialization(guards = "elIn.getLength() == 1", replaces = "iselementOneCachedString")
protected Byte iselementOne(RAbstractStringVector elIn, RAbstractStringVector setIn,
@Cached("create()") BranchProfile trueProfile,
@Cached("create()") BranchProfile falseProfile) {
......
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.truffle.r.test.library.base;
import org.junit.Test;
import com.oracle.truffle.r.test.TestBase;
public class TestIsElement extends TestBase {
@Test
public void testIsElement() {
assertEval("{ is.element(c('a', 'b', 'b'), 'b') }");
assertEval("{ is.element('b', c('a', 'b', 'b')) }");
assertEval("{ is.element(paste0('a', 1:10), 'a1') }");
assertEval("{ is.element(paste0('a', 1:10), 'a0') }");
assertEval("{ is.element(paste0('a', c(1:10, rep(11,2))), 'a11') }");
assertEval("{ is.element(c(1:10,rep(11,10)), 1) }");
assertEval("{ is.element(c(1:10,rep(11,10)), 11) }");
assertEval("{ is.element(c(1:10,rep(11,10)), c(1:10,rep(11,10))) }");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment