diff --git a/DMCompiler/DM/Builders/DMExpressionBuilder.cs b/DMCompiler/DM/Builders/DMExpressionBuilder.cs index 2bc77c5798..39af4b1e51 100644 --- a/DMCompiler/DM/Builders/DMExpressionBuilder.cs +++ b/DMCompiler/DM/Builders/DMExpressionBuilder.cs @@ -647,6 +647,8 @@ private DMExpression BuildScopeIdentifier(DMASTScopeIdentifier scopeIdentifier, if (scopeMode is Normal && ctx.Proc != null) { if (ctx.Proc.GetLocalVariable(identifier.Identifier) != null) { // actually - it's referring to a local variable named "type" or "parent_type"... just do the usual thing + Compiler.Emit(WarningCode.SoftReservedKeyword, identifier.Location, + $"Using scope operator :: on a variable named \"type\" or \"parent_type\" is ambiguous. Consider changing the variable name from \"{identifier.Identifier}\"."); expression = BuildExpression(scopeIdentifier.Expression, inferredPath); } else { return BadExpression(WarningCode.BadExpression, identifier.Location, diff --git a/DMCompiler/DM/DMExpression.cs b/DMCompiler/DM/DMExpression.cs index 41c7448bfc..73de3895ba 100644 --- a/DMCompiler/DM/DMExpression.cs +++ b/DMCompiler/DM/DMExpression.cs @@ -138,10 +138,10 @@ private void VerifyArgType(DMCompiler compiler, DMProc targetProc, int index, st } } -internal readonly struct ExpressionContext(DMCompiler compiler, DMObject type, DMProc? proc) { +internal readonly struct ExpressionContext(DMCompiler compiler, DMObject type, DMProc proc) { public readonly DMCompiler Compiler = compiler; public readonly DMObject Type = type; - public readonly DMProc? Proc = proc; + public readonly DMProc Proc = proc; public DMObjectTree ObjectTree => Compiler.DMObjectTree; }