Skip to content

Conversation

@stephencelis
Copy link
Member

The macro has to make assumptions about the types involved in the function, i.e. that they are "query representable." We rely on a _columnWidth property that produces the following, unhelpful error when dealing with types that aren't representable in queries:

Type 'CKShare' has no member '_columnWidth'

By moving things to a function, the error provides better breadcrumbs:

Global function '_columnWidth' requires that 'CKShare' conform to
'QueryExpression'

The compiler generates more instructions here, but _columnWidth is only called a single time for database functions at the time of installation.

The other fix is for decode, which is heavily overloaded, so the existing error:

No exact matches in call to instance method 'decode'

Gets deemphasized for:

Global function '_requireQueryRepresentable' requires that 'Foo'
conform to 'QueryRepresentable'

The macro has to make assumptions about the types involved in the
function, _i.e._ that they are "query representable." We rely on a
`_columnWidth` property that produces the following, unhelpful error
when dealing with types that aren't representable in queries:

> Type 'CKShare' has no member '_columnWidth'

By moving things to a function, the error provides better breadcrumbs:

> Global function '_columnWidth' requires that 'CKShare' conform to
> 'QueryExpression'

The compiler generates more instructions here, but `_columnWidth` is
only called a single time for database functions at the time of
installation.

The other fix is for `decode`, which is heavily overloaded, so the
existing error:

> No exact matches in call to instance method 'decode'

Gets deemphasized for:

> Global function '_requireQueryRepresentable' requires that 'Foo'
> conform to 'QueryRepresentable'
@stephencelis stephencelis merged commit 2e3cb76 into main Oct 29, 2025
3 checks passed
@stephencelis stephencelis deleted the db-fun-errors branch October 29, 2025 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants