--- /dev/null
+// CS0136: A local variable named `s' cannot be declared in this scope because it would give a different meaning to `s', which is already used in a `parent or current' scope to denote something else
+// Line: 11
+
+using System;
+
+class X
+{
+ void Test2 (object o)
+ {
+ if (o is ValueType s) {
+ if (o is long s) {
+ Console.WriteLine (s);
+ }
+ }
+ }
+}
\ No newline at end of file
var lt = (LocatedToken) $4;
var lv = new LocalVariable (current_block, lt.Value, lt.Location);
is_expr.Variable = lv;
- current_block.AddLocalName (lv);
+ current_block.AddLocalName (lv.Name, lv, true);
}
$$ = is_expr;
AddLocalName (li.Name, li);
}
- public void AddLocalName (string name, INamedBlockVariable li)
+ public virtual void AddLocalName (string name, INamedBlockVariable li, bool canShadowChildrenBlockName = false)
{
- ParametersBlock.TopBlock.AddLocalName (name, li, false);
+ ParametersBlock.TopBlock.AddLocalName (name, li, canShadowChildrenBlockName);
}
public virtual void Error_AlreadyDeclared (string name, INamedBlockVariable variable, string reason)
}
}
- public void AddLocalName (string name, INamedBlockVariable li, bool ignoreChildrenBlocks)
+ public override void AddLocalName (string name, INamedBlockVariable li, bool ignoreChildrenBlocks)
{
if (names == null)
names = new Dictionary<string, object> ();