[ty] Support declaration-only attributes (#19048)

## Summary

Following ty issue [#698](https://github.com/astral-sh/ty/issues/698)
this PR adds support for declarations.

closes #698

## Test Plan

Tested against mdtest (specifically attributes).

---------

Co-authored-by: David Peter <mail@david-peter.de>
This commit is contained in:
Ivan Yakushev 2025-07-07 14:55:32 +04:00 committed by GitHub
parent b6edfbc70f
commit e0b7f496f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 90 additions and 16 deletions

View file

@ -509,6 +509,18 @@ impl<'db> UseDefMap<'db> {
.is_always_false()
}
pub(crate) fn is_declaration_reachable(
&self,
db: &dyn crate::Db,
declaration: &DeclarationWithConstraint<'db>,
) -> Truthiness {
self.reachability_constraints.evaluate(
db,
&self.predicates,
declaration.reachability_constraint,
)
}
pub(crate) fn is_binding_reachable(
&self,
db: &dyn crate::Db,