From f19fc8564d7795ec88bf124223a5a9b6d86403c8 Mon Sep 17 00:00:00 2001 From: Amy <3855802+amylizzle@users.noreply.github.com> Date: Fri, 24 May 2024 01:17:05 +0100 Subject: [PATCH] Fix inferred type expressions (#1806) Co-authored-by: amylizzle Co-authored-by: wixoa --- .../DMProject/Tests/Expression/InferredType.dm | 10 ++++++++++ DMCompiler/DM/Expressions/Binary.cs | 1 + DMCompiler/DM/Expressions/Builtins.cs | 1 + 3 files changed, 12 insertions(+) create mode 100644 Content.Tests/DMProject/Tests/Expression/InferredType.dm diff --git a/Content.Tests/DMProject/Tests/Expression/InferredType.dm b/Content.Tests/DMProject/Tests/Expression/InferredType.dm new file mode 100644 index 0000000000..a32fbb4501 --- /dev/null +++ b/Content.Tests/DMProject/Tests/Expression/InferredType.dm @@ -0,0 +1,10 @@ +// issue #1752 + +/proc/RunTest() + var/matrix/M1 = new() + var/matrix/M2 = new() + + (M1 * M2).Multiply(1) + + var/list/test = list(M1,M2) + (locate(/matrix) in test).Multiply(1) \ No newline at end of file diff --git a/DMCompiler/DM/Expressions/Binary.cs b/DMCompiler/DM/Expressions/Binary.cs index 1d848b1802..6f83d4cfa3 100644 --- a/DMCompiler/DM/Expressions/Binary.cs +++ b/DMCompiler/DM/Expressions/Binary.cs @@ -7,6 +7,7 @@ internal abstract class BinaryOp(Location location, DMExpression lhs, DMExpressi protected DMExpression LHS { get; } = lhs; protected DMExpression RHS { get; } = rhs; public override DMComplexValueType ValType => LHS.ValType; + public override bool PathIsFuzzy => true; } #region Simple diff --git a/DMCompiler/DM/Expressions/Builtins.cs b/DMCompiler/DM/Expressions/Builtins.cs index 25ca7fa082..b85352732a 100644 --- a/DMCompiler/DM/Expressions/Builtins.cs +++ b/DMCompiler/DM/Expressions/Builtins.cs @@ -154,6 +154,7 @@ public override void EmitPushValue(DMObject dmObject, DMProc proc) { sealed class Locate : DMExpression { private readonly DMExpression _path; private readonly DMExpression? _container; + public override bool PathIsFuzzy => true; public Locate(Location location, DMExpression path, DMExpression? container) : base(location) { _path = path;