public final Mutable<?, ?, ?> childCopyOf(final StmtContext<?, ?, ?> stmt, final CopyType type,
final QNameModule targetModule) {
checkEffectiveModelCompleted(stmt);
- checkArgument(stmt instanceof StatementContextBase, "Unsupported statement %s", stmt);
- return childCopyOf((StatementContextBase<?, ?, ?>) stmt, type, targetModule);
+ if (stmt instanceof StatementContextBase) {
+ return childCopyOf((StatementContextBase<?, ?, ?>) stmt, type, targetModule);
+ } else if (stmt instanceof ReplicaStatementContext) {
+ return ((ReplicaStatementContext<?, ?, ?>) stmt).replicaAsChildOf(this);
+ } else {
+ throw new IllegalArgumentException("Unsupported statement " + stmt);
+ }
}
private <X, Y extends DeclaredStatement<X>, Z extends EffectiveStatement<X, Y>> Mutable<X, Y, Z> childCopyOf(
--- /dev/null
+/*
+ * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.stmt;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class YT1346Test {
+ @Test
+ public void testUsesAugmentUsesException() throws Exception {
+ assertNotNull(StmtTestUtils.parseYangSource("/bugs/YT1346/foo.yang"));
+ }
+}