C# Language Specification



Download 0,75 Mb.
bet190/524
Sana06.01.2022
Hajmi0,75 Mb.
#324842
1   ...   186   187   188   189   190   191   192   193   ...   524
Bog'liq
CSharp Language Specification

Exact inferences


An exact inference from a type U to a type V is made as follows:

  • If V is one of the unfixed Xi then U is added to the set of exact bounds for Xi.

  • Otherwise, sets V1…Vk and U1…Uk are determined by checking if any of the following cases apply:

  • V is an array type V1[…] and U is an array type U1[…] of the same rank

  • V is the type V1? and U is the type U1?

  • V is a constructed type C1…Vk> and U is a constructed type C1…Uk>

If any of these cases apply then an exact inference is made from each Ui to the corresponding Vi.

  • Otherwise no inferences are made.
        1. Lower-bound inferences


A lower-bound inference from a type U to a type V is made as follows:

  • If V is one of the unfixed Xi then U is added to the set of lower bounds for Xi.

  • Otherwise, if V is the type V1? and U is the type U1? then a lower bound inference is made from U1 to V1.

  • Otherwise, sets U1…Uk and V1…Vk are determined by checking if any of the following cases apply:

  • V is an array type V1[…]and U is an array type U1[…] (or a type parameter whose effective base type is U1[…]) of the same rank

  • V is one of IEnumerable1>, ICollection1> or IList1> and U is a one-dimensional array type U1[](or a type parameter whose effective base type is U1[])

  • V is a constructed class, struct, interface or delegate type C1…Vk> and there is a unique type C1…Uk> such that U (or, if U is a type parameter, its effective base class or any member of its effective interface set) is identical to, inherits from (directly or indirectly), or implements (directly or indirectly) C1…Uk>.

(The “uniqueness” restriction means that in the case interface C{} class U: C, C{}, then no inference is made when inferring from U to C because U1 could be X or Y.)

If any of these cases apply then an inference is made from each Ui to the corresponding Vi as follows:



  • If Ui is not known to be a reference type then an exact inference is made

  • Otherwise, if U is an array type then a lower-bound inference is made

  • Otherwise, if V is C1…Vk> then inference depends on the i-th type parameter of C:

  • If it is covariant then a lower-bound inference is made.

  • If it is contravariant then an upper-bound inference is made.

  • If it is invariant then an exact inference is made.

  • Otherwise, no inferences are made.

        1. Download 0,75 Mb.

          Do'stlaringiz bilan baham:
1   ...   186   187   188   189   190   191   192   193   ...   524




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish