microsoft / microsoft/Power-Fx

UDF Cleanup

Open
#942 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.4k
Forks
358
Avg merge
10h 34m
Merged PRs (30d)
3

Description

Writing UDFs needs to be more robust in face of user errors.

  • Don't crash
  • Report all user errors (both parse and bind) so that they're actionable.

Things to cleanup in UDFs:

  1. We immediately crash on unrecognized types in the signature (whenever GetFromStringOrNull returns null)
  2. We double parse the function body (UDFDefinition has a string body, it should store the TexlNode or even ParseResult). We're going from TexlNode back to String via TexlPretty ... and that injects "<error>" into the string contents on parse errors, which then get re-parsed! This also means that error spans don't align up with the user's original input text.
  3. CheckWrapper - don't do deferred binding. Bind immediately. This may require 2 passes for recursion (first pass to populate signatures, second pass to handle bodies)
  4. Better error handling - ensure we return all errors

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace UDF processing through UDFDefinition, CheckWrapper, GetFromStringOrNull, TexlNode, ParseResult, and TexlPretty. Start by mapping where parsing and binding occur, then verify that unrecognized types and parse or bind failures are reported without crashes, preserving the user's original text and error spans.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.