YarnSpinnerTool / YarnSpinner

Yarn Spinner is a tool for building interactive dialogue in games!
https://yarnspinner.dev
MIT License
2.3k stars 201 forks source link

Variable declaration inference breaks on certain sets #383

Closed McJones closed 7 months ago

McJones commented 7 months ago

What is the current behavior?

if you have the following Yarn file:

title: Start
---
<<set $badInference = $badInference + 1>>
===

attempting to compile this result in the following exception: System.ArgumentException: Key already exists in map (Parameter 'key') when attempting to add the variable declaration into the list of known declarations. For some reason the inference is failing and seeing two versions of $badInference causing a duplicate key issue. This flows onto YS-Unity and other places where the error is even more abstract and hard to understand.

What is the expected behavior?

The variable type should be able to be determine, or at least not crash.