FirelyTeam / firely-cql-sdk

BSD 3-Clause "New" or "Revised" License
31 stars 17 forks source link

583 Unsuppress ChangeType errors #545

Closed ewoutkramer closed 1 month ago

ewoutkramer commented 2 months ago

Fix for

I noticed that we had repeated code for handling what happens when ChangeType returns TypeConversion.NoMatch. We are mostly throwing (variations) of NewExpressionBuildingException, so I refactored a bit to make ChangeType throw a consistent error, using the throwOnError techique that we used elsewhere.

Then, I noticed this code:

  // If we make this a hard fail, 15 unit tests fail.
                        // throw this.NewExpressionBuildingException(
                        //      $"Cannot convert {expression.Type.ToCSharpString(Defaults.TypeCSharpFormat)} to {tsType.ToCSharpString(Defaults.TypeCSharpFormat)}");

So, we actually had 15 unit tests failing, but their failure was turned into a line in a log file. Sure enough, when I uncommented this, I got 15 (well, really 16) unit tests failing.

I was able to fix 14 out of sixteen (but see #543) cases, which left two, which are covered under #519 and #543. For now, I have suppressed these last two again.