Skip to content

Conversation

raftario
Copy link
Contributor

@raftario raftario commented Jul 23, 2020

Implements support for using both nullability and type overrides at the same time, following the syntax proposed by @mehcode in #489.

  • as "ident" emits either DbType or Option<DbType> depending on inferred nullability
  • as "ident!" emits DbType regardless of inferred nullability
  • as "ident?" emits Option<DbType> regardless of inferred nullability
  • as "ident: Type" emits either Type or Option<Type> depending on inferred nullability
  • as "ident!: Type" emits Type regardless of inferred nullability
  • as "ident?: Type" emits Option<Type> regardless of inferred nullability

At the moment, the wildcard syntax stays the same, and both as "ident!: _" and as "ident?: _" result in a compile time parsing error.

  • as "ident: _" emits either try_get or try_get::<Option<_>, _> depending on inferred nullability
  • as "ident!: _" emits try_get regardless of inferred nullability
  • as "ident?: _" emits try_get::<Option<_>, _> regardless of inferred nullability

Addresses #489

@raftario
Copy link
Contributor Author

Added support for as "ident!: _" and as "ident?: _" as discussed on Discord.

@raftario raftario force-pushed the override-nullability branch 3 times, most recently from ef45b8c to abd9086 Compare July 23, 2020 06:15
@mehcode
Copy link
Member

mehcode commented Jul 27, 2020

Skimming through, this looks awesome. I'm not confident in this part of the codebase though so I'll let @abonander merge this.

After #535 this needs a rebase.

@mehcode mehcode requested a review from abonander July 27, 2020 00:57
@raftario raftario force-pushed the override-nullability branch from abd9086 to 2612d04 Compare July 27, 2020 02:39
@raftario raftario force-pushed the override-nullability branch from 2612d04 to 57b28ea Compare July 27, 2020 02:50
@mehcode mehcode merged commit ced09e0 into launchbadge:master Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants