Open micimize opened 4 years ago
I attempted to work around this with generic interfaces, but it still fails:
@BuiltValue(instantiable: false)
abstract class Character<V extends Character<V, B>,
B extends CharacterBuilder<V, B>> extends Built<V, B>
abstract class CharacterBuilder<V extends Character<V, B>,
B extends CharacterBuilder<V, B>> extends Builder<V, B>
abstract class DroidBuilder
implements
CharacterBuilder<Droid, DroidBuilder>,
Builder<Droid, DroidBuilder>
// builder field that fails with
// Make builder field droids have type:
// BuiltList<Droid> (or, if applicable, builder)
ListBuilder<DroidBuilder> droids;
My attempt to apply the same technique to actual "generic builders" also fails:
// fails with
// Make builder field hero have type: Character<Character<Character<Character, CharacterBuilder>, CharacterBuilder<Character, CharacterBuilder>>, CharacterBuilder<Character<Character, CharacterBuilder>, CharacterBuilder<Character, CharacterBuilder>>>
@nullable
Character<Character<Character, CharacterBuilder>,
CharacterBuilder<Character, CharacterBuilder>> get hero;
I honestly didn't exactly expect it to work đŸ˜… just thought it seemed related enough to #426 to be worth taking a crack at
I think the problem is that the type NamedBuilder
is not available yet as it hasn't been generated, so the generator is getting confused about the field type.
It might work to move Named
to another file/package.
Or, the generator should be fixed so it doesn't get confused :)
The following fails due to the
NamedBuilder named
attribute on the builder, probably because non-instantiable builders aren't reallyBuilders
:Source:
relevant pubspec: