Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UO field set changes #2533

Closed
wants to merge 4 commits into from
Closed

UO field set changes #2533

wants to merge 4 commits into from

Conversation

anderson-joyle
Copy link
Contributor

@anderson-joyle anderson-joyle commented Jul 9, 2024

Issue #2501.

Allowing the following scenarios:
Set(Index(uoTable, 1).Id, uoValue)
Set(Index(uoTable, 1).Id, 99)

@anderson-joyle anderson-joyle added the Breaking Internals Breaking change - may require a PA Client update. label Jul 9, 2024
@MikeStall
Copy link
Contributor

MikeStall commented Jul 11, 2024

            if (info.Data is NameSymbol nameSymbol && nameSymbol.Props.CanSet)

even if arg0 is UO, we should still do this check.

Set(ParseJson("1"), value) // fail at compile time


Refers to: src/libraries/Microsoft.PowerFx.Interpreter/Functions/SetFunction.cs:121 in bf5df32. [](commit_id = bf5df32, deletion_comment = False)

@anderson-joyle anderson-joyle changed the title DONT REVIEW! UO field set changes UO field set changes Jul 11, 2024
@anderson-joyle anderson-joyle marked this pull request as ready for review July 11, 2024 21:07
@anderson-joyle anderson-joyle requested a review from a team as a code owner July 11, 2024 21:07
@anderson-joyle anderson-joyle removed the Breaking Internals Breaking change - may require a PA Client update. label Jul 11, 2024
internal virtual UntypedObjectValue CreateNew(IRContext irContext, IUntypedObject impl)
{
return new UntypedObjectValue(irContext, impl);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhh.... this is not ideal. I'll followup offline...

@MikeStall
Copy link
Contributor

                return new UntypedObjectValue(irContext, propertyValue);

Should we have called CreateNew() here?

More broadly - the issue with CreateNew is that it's at odds with the UntypedObjectValue() ctor.


Refers to: src/libraries/Microsoft.PowerFx.Interpreter/Functions/LibraryUntypedObject.cs:458 in c92d9de. [](commit_id = c92d9de, deletion_comment = False)

{
TextLiteralNode textLiteralNode = (TextLiteralNode)bon.Right;

// !!!TODO What if property name does not exist?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// !!!TODO What if property name does not exist?

void SetProperty(string, formulaValue);
Throw on error.

Encourage to throw:
CustomFunctionErrorException

See later in this file how we catch that and convert to an ErrorValue.

@MikeStall
Copy link
Contributor

Superceded by #2547

@MikeStall MikeStall closed this Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants