You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I was trying to run the example given in the package. But when I run the code generator I get the following exception.
[SEVERE] built_union_generator:built_value on lib/models/union.dart:
An error `FormatterException` occurred while formatting the generated source for
`package:basicappl/models/union.dart`
which was output to
`lib/models/union.built_union.g.part`.
This may indicate an issue in the generator, the input source code, or in the
source formatter.
Could not format because the source could not be parsed:
line 20, column 28: Expected to find ')'.
╷
20 │ _$SimpleUnion.string(String* string): _type = _$SimpleUnionType.string, assert(string != null, '_$SimpleUnion constructor argument string can not be null!'), _values = [string];
│ ^
╵
line 24, column 25: Expected to find ')'.
╷
24 │ @required T Function(int*) integer,
│ ^
╵
line 101, column 66: Expected an identifier.
╷
101 │ serializers.serialize(integer, specifiedType: const FullType(int*))
│ ^
╵
line 108, column 142: Expected an identifier.
╷
108 │ serializers.serialize(tupleInt, specifiedType: const FullType(int*)),serializers.serialize(tupleString, specifiedType: const FullType(String*))
│ ^
╵
line 19, column 24: Expected to find ')'.
╷
19 │ _$SimpleUnion.tuple(int* tupleInt,String* tupleString): _type = _$SimpleUnionType.tuple, assert(tupleInt != null, '_$SimpleUnion constructor argument tupleInt can not be null!'), assert(tupleString != null, '_$SimpleUnion constructor argument tupleString can not be null!'), _values = [tupleInt,tupleString];
│ ^
╵
line 132, column 106: Expected an identifier.
╷
132 │ result = SimpleUnion.integer(serializers.deserialize(iterator.current, specifiedType: const FullType(int*)));
│ ^
╵
line 25, column 25: Expected to find ')'.
╷
25 │ @required T Function(int*,String*) tuple,
│ ^
╵
line 142, column 68: Expected an identifier.
╷
142 │ serializers.deserialize(tupleInt,specifiedType: const FullType(int*)),
│ ^
╵
line 26, column 28: Expected to find ')'.
╷
26 │ @required T Function(String*) string,
│ ^
╵
line 148, column 108: Expected an identifier.
╷
148 │ result = SimpleUnion.string(serializers.deserialize(iterator.current, specifiedType: const FullType(String*)));
│ ^
╵
I just quickly checked on my side (although with a bit different list of dependencies), and I couldn't reproduce the issue. Maybe something else is different between our setups.
One thing that I already managed to see is the asterisk (*) symbol that got into many strange places in the generated code on your setup, and I am not sure why it happens. Example:
26 │ @requiredTFunction(String*) string,
^
It might take a while before I manage to dive into this. For now, here are some ways in which we might be able to debug the issue:
Try to clone the repository (git clone https://github.com/freedomlayer/built_union.dart). Then run tool/presubmit and see if the tests pass. If they don't, it will be very helpful if you could provide the output you see on your machine.
Try to change the dependencies you use to the older dependencies specified in the project's readme, just to see if any new version in one of the dependencies is what causing this issue. I would try to do this gradually, to see where the breakage happens.
Thanks @realcr for the timely response. I highly appreciate it.
I tried option 1, all the tests passed with a minor modification of sed to gsed in the local_deps script as I am using Mac. Could MacOS be causing this issue somehow?
For option 2, I changed all my current dependencies to the ones given in project's README, even the built_value & built_value_generator ones too. But I am still seeing the same exception. My project has many more dependencies, probably one of them is causing the issue.
Hi, I was trying to run the example given in the package. But when I run the code generator I get the following exception.
This is the exact code in my model file
And these are dependencies I am using -
Could you please let me know, what is causing this issue?
The text was updated successfully, but these errors were encountered: