Skip to content

Commit

Permalink
Don't give . a type (#1880)
Browse files Browse the repository at this point in the history
  • Loading branch information
wixoaGit committed Jul 8, 2024
1 parent 20edaaf commit 8f5eb97
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions DMCompiler/DM/Builders/DMExpressionBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public enum ScopeMode {
case DMASTStringFormat stringFormat: return BuildStringFormat(stringFormat, dmObject, proc, inferredPath);
case DMASTIdentifier identifier: return BuildIdentifier(identifier, dmObject, proc, inferredPath);
case DMASTScopeIdentifier globalIdentifier: return BuildScopeIdentifier(globalIdentifier, dmObject, proc, inferredPath);
case DMASTCallableSelf: return new ProcSelf(expression.Location, inferredPath, proc);
case DMASTCallableSelf: return new ProcSelf(expression.Location, null, proc);
case DMASTCallableSuper: return new ProcSuper(expression.Location, dmObject, proc);
case DMASTCallableProcIdentifier procIdentifier: return BuildCallableProcIdentifier(procIdentifier, dmObject);
case DMASTProcCall procCall: return BuildProcCall(procCall, dmObject, proc, inferredPath);
Expand Down Expand Up @@ -754,8 +754,9 @@ public enum ScopeMode {

case DMASTDereference.IndexOperation indexOperation:
operation = new Dereference.IndexOperation {
// Passing the path here is cursed, but one of the tests seems to suggest we want that?
Index = DMExpression.Create(dmObject, proc, indexOperation.Index, prevPath),
// var/type1/result = new /type2()[new()] changes the inferred new to "new /type1()"
// L[new()] = new() uses the type of L however
Index = DMExpression.Create(dmObject, proc, indexOperation.Index, inferredPath ?? prevPath),
Safe = indexOperation.Safe,
Path = prevPath
};
Expand Down

0 comments on commit 8f5eb97

Please sign in to comment.