Today we allow expressions like the following in PowerApps
```
If(Type(Boolean), 1, 2)
```
this PR blocks such unintended usage of type literals at compile time.
Add x-ms-enum-values in CDP connectors
Accumulate option sets to surface them in CdpTable
Optionset names will be 'propertyName (tableName)'
If existing, propertyName will be replaced with 'x-ms-enum' value
Making the `TypeLiteralNode` visitor abstract in the `TexlVisitor` to
ensure we consider handling TypeLiteralNode in future TexlVisitor
implementations. keeping it virtual sometimes made this go unnoticed.
Fixes#2674 .
The TimeValue function has a few issues, which are fixed by this change:
- Better validation (so that calls such as `TimeValue("1")` fail, as it
does in Excel
- Support for AM/PM designators (`TimeValue("6:00 PM")`), as it is
supported in Excel
- Support for wrapping hours (`Value(TimeValue("27:00:00")) =
Value(TimeValue("3:00:00"))`), as it is done in Excel
This PR fixes the issue where inbuilt enums are no longer part of the
config if the config's symbol table is replaced after initialization.
After initializing the config if SymbolTable was replaced, we were
loosing the enums attached to the previous default symbol table. This PR
will adds a default symbol table(seprate from existing table) to handle
that.
On an effort to remove null rule binding, we need the ability to have an
option to apply null binding before doing the check if binding is null.
This change adds a new method on IExternalRule to help with that.
Formatting , structural printing and cloning were broken for type
literals. This PR fixes these issues and adds tests to ensure the
changes work as expected.
Formatting of user definitions is still not perfect and has a bug where
it would fail if we had definitions of same kind with same name. That is
not in the scope of this PR and shall be fixed as a follow up
As PA is moving away from rules with null binding, this PR introduces a
new property called HasValidBinding which needs to be used to check the
binding validity in future rather than Binding property itself.
Eventually we should remove the Binding property from rule to abstract
that. This change is first step towards that direction.
* Remove `AllowParseAsTypeLiteral, AllowTypeLiteral` parser flag.
* AsType, IsType and ParseJSON overloads are part of Builtin Functions
* Add constant for Type Keyword.
* Add type arg functions to Built-in
* Refactor test
NameResolver.Lookup is a weirdly expensive operation when done from the
middle of a running analysis pass.
A few functions call TryGetConstantValue from CheckTypes, which is
called during analysis to get functions result types.
In JSON it was possible to move that to CheckSemantics, but in Match, we
want to avoid the expensive call to Lookup if we can, so we first look
in the EntityStore to resolve enums.
This doesn't meaningfully change the scenario for non PA hosts, as the
entity store is a PA-only concept.
1. UDF():DS = Filter(DS, Sqrt(Value) > 5));
2. use UDF() elsewhere, no delegation warning is shown
This has always been the case for named formulas as well, change for NF
delegation warning flag is in other repo so test cannot be written to
for that scenario.
Refactor CDP implementation
Use AssociatedDataSources for CDP record types
Make all CDP records lazy
Add x-ms-enum management
New TabularRecordType (lazy)
Make CdpTableResolver return ConnectorType
Remove CdpDType hack
Remove CdpTableType hack
Remove CdpTableDescriptor
Remove ExternalCdpDataSource
Remove ICdpTableResolver.GenerateADS hack
Rework Connector service capabilities
Add Relationships to CdpService
Add TableParameters to CdpTable
New InternalTableMetadata and related classes in Pfx Core
New InternalTableParameters in Pfx Core (implementing
IExternalTabularDataSource)
Fix DType ToRecord, ToTable
Only exposed in REPL, and must be explicitly activated.
Only new concept in core is adding **FileLocation**. We need to report
errors within a file (line,col), not just character offset in an
expression.
Also implement the Assert() function in the repl - this helps with
wrigin modules that act as unit tests.
Module support is defined via Repl. Module format is deserialized via
YamlDotNet.
Modules only support:
- a single Formulas section that behaves like app.formulas.
- an "imports" section for importing other modules.
The tests demonstrate the various combinations for public/private,
conflict, shadowing, etc.
Add management functions to repl:
Import(path)
DeleteModule(path) - remove from list
ListModules() - show which moduels are loaded
Fixes#2679 . Currently the PlainText doesn't handle some open tags correctly - the function is supposed to convert things like <br/> to a new line or <p> to two new lines, but it is matching tags such as <bra> and <para> which should not be matched.
Add PowerFx feature flag for User-defined types to show compile error
when a function that uses UDT type argument is used when the feature is
turned off. This PR also also fixes an error message string
I would also like to cleanup the Parser flag `AllowTypeLiteral` and use
only feature flag, but that needs bit more refactoring and will do in a
follow up PR
Use logical names and running a single query to get relationships for
Azure SQL
---------
Co-authored-by: Luc Genetier <lucgen@microsoft.com>
Co-authored-by: Luc Genetier <69138830+LucGenetier@users.noreply.github.com>
Co-authored-by: Marimuthu Gurusamy <magurusa@microsoft.com>
Currently the tree that stores fields of a complex DType (records or arrays) stores those in an ordered way (ordinal comparison). There is some code that relies on that, so codifying it as a test to make it a "specification"