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

Failed to parse typeof(string[]) #172

Closed
ealeykin opened this issue Oct 19, 2021 · 1 comment · Fixed by #173
Closed

Failed to parse typeof(string[]) #172

ealeykin opened this issue Oct 19, 2021 · 1 comment · Fixed by #173

Comments

@ealeykin
Copy link
Contributor

Looks like some parsing issue

var interpreter = new Interpreter().Reference(typeof(string[]), "string[]");

interpreter.Eval("typeof(string)"); // Ok: System.String
interpreter.Eval("typeof(string[])"); // Fail: DynamicExpresso.Exceptions.ParseException: '.' or '(' expected (at index 13).
@metoule
Copy link
Contributor

metoule commented Oct 20, 2021

Type parsing is currently fairly limited. It supports nullable types, but not arrays, nor generics.
I'll try to improve it.

metoule added a commit to metoule/DynamicExpresso that referenced this issue Oct 20, 2021
metoule added a commit to metoule/DynamicExpresso that referenced this issue Oct 25, 2021
davideicardi pushed a commit that referenced this issue Oct 27, 2021
* ?. and ?[ operators now use the existing GenerateNullableTypeConversion that ensures a nullable type isn't converted to a nullable of nullable.
Fixes #169

* Promote operands before generating the equality check on ?. and ?[ operators.

* No longer consider ?. and ?[ as tokens, because it prevents the proper parsing of an array of a nullable type (e.g. int?[]).

* Improve type parsing to support arrays and generics.
Fixes #172

* No longer consider ?. and ?[ as tokens, because it prevents the proper parsing of an array of a nullable type (e.g. int?[]).

* Improve type parsing to support arrays and generics.
Fixes #172
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants