text:
namespace Kvasir {
//Analog-to-Digital Converter
    namespace Adc12Isr{    ///<interrupt and status register
        using Addr = Register::Address<0x50000000,0xfffff800,0x00000000,unsigned>;
        ///JQOVF
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,unsigned> jqovf{};
        ///AWD3
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,unsigned> awd3{};
        ///AWD2
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,unsigned> awd2{};
        ///AWD1
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,unsigned> awd1{};
        ///JEOS
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,unsigned> jeos{};
        ///JEOC
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,unsigned> jeoc{};
        ///OVR
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,unsigned> ovr{};
        ///EOS
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> eos{};
        ///EOC
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> eoc{};
        ///EOSMP
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> eosmp{};
        ///ADRDY
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> adrdy{};
    }
    namespace Adc12Ier{    ///<interrupt enable register
        using Addr = Register::Address<0x50000004,0xfffff800,0x00000000,unsigned>;
        ///JQOVFIE
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,unsigned> jqovfie{};
        ///AWD3IE
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,unsigned> awd3ie{};
        ///AWD2IE
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,unsigned> awd2ie{};
        ///AWD1IE
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,unsigned> awd1ie{};
        ///JEOSIE
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,unsigned> jeosie{};
        ///JEOCIE
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,unsigned> jeocie{};
        ///OVRIE
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,unsigned> ovrie{};
        ///EOSIE
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> eosie{};
        ///EOCIE
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> eocie{};
        ///EOSMPIE
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> eosmpie{};
        ///ADRDYIE
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> adrdyie{};
    }
    namespace Adc12Cr{    ///<control register
        using Addr = Register::Address<0x50000008,0x0fffffc0,0x00000000,unsigned>;
        ///ADCAL
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,unsigned> adcal{};
        ///ADCALDIF
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,30),Register::ReadWriteAccess,unsigned> adcaldif{};
        ///DEEPPWD
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,29),Register::ReadWriteAccess,unsigned> deeppwd{};
        ///ADVREGEN
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,28),Register::ReadWriteAccess,unsigned> advregen{};
        ///JADSTP
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,unsigned> jadstp{};
        ///ADSTP
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,unsigned> adstp{};
        ///JADSTART
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> jadstart{};
        ///ADSTART
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> adstart{};
        ///ADDIS
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> addis{};
        ///ADEN
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> aden{};
    }
    namespace Adc12Cfgr{    ///<configuration register
        using Addr = Register::Address<0x5000000c,0x80000004,0x00000000,unsigned>;
        ///AWDCH1CH
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,26),Register::ReadWriteAccess,unsigned> awdch1ch{};
        ///JAUTO
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,unsigned> jauto{};
        ///JAWD1EN
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,unsigned> jawd1en{};
        ///AWD1EN
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,23),Register::ReadWriteAccess,unsigned> awd1en{};
        ///AWD1SGL
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,22),Register::ReadWriteAccess,unsigned> awd1sgl{};
        ///JQM
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,21),Register::ReadWriteAccess,unsigned> jqm{};
        ///JDISCEN
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,unsigned> jdiscen{};
        ///DISCNUM
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,17),Register::ReadWriteAccess,unsigned> discnum{};
        ///DISCEN
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,unsigned> discen{};
        ///AUTOFF
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,unsigned> autoff{};
        ///AUTDLY
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,14),Register::ReadWriteAccess,unsigned> autdly{};
        ///CONT
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,unsigned> cont{};
        ///OVRMOD
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,unsigned> ovrmod{};
        ///EXTEN
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,10),Register::ReadWriteAccess,unsigned> exten{};
        ///EXTSEL
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,6),Register::ReadWriteAccess,unsigned> extsel{};
        ///ALIGN
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,unsigned> align{};
        ///RES
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,3),Register::ReadWriteAccess,unsigned> res{};
        ///DMACFG
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> dmacfg{};
        ///DMAEN
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> dmaen{};
    }
    namespace Adc12Smpr1{    ///<sample time register 1
        using Addr = Register::Address<0x50000014,0xc0000007,0x00000000,unsigned>;
        ///SMP9
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,27),Register::ReadWriteAccess,unsigned> smp9{};
        ///SMP8
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,24),Register::ReadWriteAccess,unsigned> smp8{};
        ///SMP7
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,21),Register::ReadWriteAccess,unsigned> smp7{};
        ///SMP6
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,18),Register::ReadWriteAccess,unsigned> smp6{};
        ///SMP5
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,15),Register::ReadWriteAccess,unsigned> smp5{};
        ///SMP4
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,12),Register::ReadWriteAccess,unsigned> smp4{};
        ///SMP3
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,9),Register::ReadWriteAccess,unsigned> smp3{};
        ///SMP2
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,6),Register::ReadWriteAccess,unsigned> smp2{};
        ///SMP1
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,3),Register::ReadWriteAccess,unsigned> smp1{};
    }
    namespace Adc12Smpr2{    ///<sample time register 2
        using Addr = Register::Address<0x50000018,0xf8000000,0x00000000,unsigned>;
        ///SMP18
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,24),Register::ReadWriteAccess,unsigned> smp18{};
        ///SMP17
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,21),Register::ReadWriteAccess,unsigned> smp17{};
        ///SMP16
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,18),Register::ReadWriteAccess,unsigned> smp16{};
        ///SMP15
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,15),Register::ReadWriteAccess,unsigned> smp15{};
        ///SMP14
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,12),Register::ReadWriteAccess,unsigned> smp14{};
        ///SMP13
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,9),Register::ReadWriteAccess,unsigned> smp13{};
        ///SMP12
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,6),Register::ReadWriteAccess,unsigned> smp12{};
        ///SMP11
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,3),Register::ReadWriteAccess,unsigned> smp11{};
        ///SMP10
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,0),Register::ReadWriteAccess,unsigned> smp10{};
    }
    namespace Adc12Tr1{    ///<watchdog threshold register 1
        using Addr = Register::Address<0x50000020,0xf000f000,0x00000000,unsigned>;
        ///HT1
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,16),Register::ReadWriteAccess,unsigned> ht1{};
        ///LT1
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,0),Register::ReadWriteAccess,unsigned> lt1{};
    }
    namespace Adc12Tr2{    ///<watchdog threshold register
        using Addr = Register::Address<0x50000024,0xff00ff00,0x00000000,unsigned>;
        ///HT2
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,16),Register::ReadWriteAccess,unsigned> ht2{};
        ///LT2
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> lt2{};
    }
    namespace Adc12Tr3{    ///<watchdog threshold register 3
        using Addr = Register::Address<0x50000028,0xff00ff00,0x00000000,unsigned>;
        ///HT3
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,16),Register::ReadWriteAccess,unsigned> ht3{};
        ///LT3
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> lt3{};
    }
    namespace Adc12Sqr1{    ///<regular sequence register 1
        using Addr = Register::Address<0x50000030,0xe0820830,0x00000000,unsigned>;
        ///SQ4
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,24),Register::ReadWriteAccess,unsigned> sq4{};
        ///SQ3
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,18),Register::ReadWriteAccess,unsigned> sq3{};
        ///SQ2
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,12),Register::ReadWriteAccess,unsigned> sq2{};
        ///SQ1
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,6),Register::ReadWriteAccess,unsigned> sq1{};
        ///L3
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,0),Register::ReadWriteAccess,unsigned> l3{};
    }
    namespace Adc12Sqr2{    ///<regular sequence register 2
        using Addr = Register::Address<0x50000034,0xe0820820,0x00000000,unsigned>;
        ///SQ9
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,24),Register::ReadWriteAccess,unsigned> sq9{};
        ///SQ8
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,18),Register::ReadWriteAccess,unsigned> sq8{};
        ///SQ7
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,12),Register::ReadWriteAccess,unsigned> sq7{};
        ///SQ6
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,6),Register::ReadWriteAccess,unsigned> sq6{};
        ///SQ5
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,0),Register::ReadWriteAccess,unsigned> sq5{};
    }
    namespace Adc12Sqr3{    ///<regular sequence register 3
        using Addr = Register::Address<0x50000038,0xe0820820,0x00000000,unsigned>;
        ///SQ14
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,24),Register::ReadWriteAccess,unsigned> sq14{};
        ///SQ13
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,18),Register::ReadWriteAccess,unsigned> sq13{};
        ///SQ12
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,12),Register::ReadWriteAccess,unsigned> sq12{};
        ///SQ11
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,6),Register::ReadWriteAccess,unsigned> sq11{};
        ///SQ10
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,0),Register::ReadWriteAccess,unsigned> sq10{};
    }
    namespace Adc12Sqr4{    ///<regular sequence register 4
        using Addr = Register::Address<0x5000003c,0xfffff820,0x00000000,unsigned>;
        ///SQ16
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,6),Register::ReadWriteAccess,unsigned> sq16{};
        ///SQ15
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,0),Register::ReadWriteAccess,unsigned> sq15{};
    }
    namespace Adc12Dr{    ///<regular Data Register
        using Addr = Register::Address<0x50000040,0xffff0000,0x00000000,unsigned>;
        ///regularDATA
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> regulardata{};
    }
    namespace Adc12Jsqr{    ///<injected sequence register
        using Addr = Register::Address<0x5000004c,0x82082000,0x00000000,unsigned>;
        ///JSQ4
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,26),Register::ReadWriteAccess,unsigned> jsq4{};
        ///JSQ3
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,20),Register::ReadWriteAccess,unsigned> jsq3{};
        ///JSQ2
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,14),Register::ReadWriteAccess,unsigned> jsq2{};
        ///JSQ1
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,8),Register::ReadWriteAccess,unsigned> jsq1{};
        ///JEXTEN
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,6),Register::ReadWriteAccess,unsigned> jexten{};
        ///JEXTSEL
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,2),Register::ReadWriteAccess,unsigned> jextsel{};
        ///JL
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,0),Register::ReadWriteAccess,unsigned> jl{};
    }
    namespace Adc12Ofr1{    ///<offset register 1
        using Addr = Register::Address<0x50000060,0x03fff000,0x00000000,unsigned>;
        ///OFFSET1_EN
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,unsigned> offset1En{};
        ///OFFSET1_CH
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,26),Register::ReadWriteAccess,unsigned> offset1Ch{};
        ///OFFSET1
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,0),Register::ReadWriteAccess,unsigned> offset1{};
    }
    namespace Adc12Ofr2{    ///<offset register 2
        using Addr = Register::Address<0x50000064,0x03fff000,0x00000000,unsigned>;
        ///OFFSET2_EN
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,unsigned> offset2En{};
        ///OFFSET2_CH
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,26),Register::ReadWriteAccess,unsigned> offset2Ch{};
        ///OFFSET2
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,0),Register::ReadWriteAccess,unsigned> offset2{};
    }
    namespace Adc12Ofr3{    ///<offset register 3
        using Addr = Register::Address<0x50000068,0x03fff000,0x00000000,unsigned>;
        ///OFFSET3_EN
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,unsigned> offset3En{};
        ///OFFSET3_CH
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,26),Register::ReadWriteAccess,unsigned> offset3Ch{};
        ///OFFSET3
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,0),Register::ReadWriteAccess,unsigned> offset3{};
    }
    namespace Adc12Ofr4{    ///<offset register 4
        using Addr = Register::Address<0x5000006c,0x03fff000,0x00000000,unsigned>;
        ///OFFSET4_EN
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,unsigned> offset4En{};
        ///OFFSET4_CH
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,26),Register::ReadWriteAccess,unsigned> offset4Ch{};
        ///OFFSET4
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,0),Register::ReadWriteAccess,unsigned> offset4{};
    }
    namespace Adc12Jdr1{    ///<injected data register 1
        using Addr = Register::Address<0x50000080,0xffff0000,0x00000000,unsigned>;
        ///JDATA1
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> jdata1{};
    }
    namespace Adc12Jdr2{    ///<injected data register 2
        using Addr = Register::Address<0x50000084,0xffff0000,0x00000000,unsigned>;
        ///JDATA2
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> jdata2{};
    }
    namespace Adc12Jdr3{    ///<injected data register 3
        using Addr = Register::Address<0x50000088,0xffff0000,0x00000000,unsigned>;
        ///JDATA3
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> jdata3{};
    }
    namespace Adc12Jdr4{    ///<injected data register 4
        using Addr = Register::Address<0x5000008c,0xffff0000,0x00000000,unsigned>;
        ///JDATA4
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> jdata4{};
    }
    namespace Adc12Awd2cr{    ///<Analog Watchdog 2 Configuration          Register
        using Addr = Register::Address<0x500000a0,0xfff80001,0x00000000,unsigned>;
        ///AWD2CH
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,1),Register::ReadWriteAccess,unsigned> awd2ch{};
    }
    namespace Adc12Awd3cr{    ///<Analog Watchdog 3 Configuration          Register
        using Addr = Register::Address<0x500000a4,0xfff80001,0x00000000,unsigned>;
        ///AWD3CH
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,1),Register::ReadWriteAccess,unsigned> awd3ch{};
    }
    namespace Adc12Difsel{    ///<Differential Mode Selection Register          2
        using Addr = Register::Address<0x500000b0,0xfff80001,0x00000000,unsigned>;
        ///Differential mode for channels 15 to              1
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,1),Register::ReadWriteAccess,unsigned> difsel115{};
        ///Differential mode for channels 18 to              16
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,16),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> difsel1618{};
    }
    namespace Adc12Calfact{    ///<Calibration Factors
        using Addr = Register::Address<0x500000b4,0xff80ff80,0x00000000,unsigned>;
        ///CALFACT_D
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,16),Register::ReadWriteAccess,unsigned> calfactD{};
        ///CALFACT_S
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,0),Register::ReadWriteAccess,unsigned> calfactS{};
    }
    namespace Adc12Csr{    ///<ADC Common status register
        using Addr = Register::Address<0x50000300,0xf800f800,0x00000000,unsigned>;
        ///ADDRDY_MST
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> addrdyMst{};
        ///EOSMP_MST
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> eosmpMst{};
        ///EOC_MST
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> eocMst{};
        ///EOS_MST
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> eosMst{};
        ///OVR_MST
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,unsigned> ovrMst{};
        ///JEOC_MST
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,unsigned> jeocMst{};
        ///JEOS_MST
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,unsigned> jeosMst{};
        ///AWD1_MST
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,unsigned> awd1Mst{};
        ///AWD2_MST
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,unsigned> awd2Mst{};
        ///AWD3_MST
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,unsigned> awd3Mst{};
        ///JQOVF_MST
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,unsigned> jqovfMst{};
        ///ADRDY_SLV
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,unsigned> adrdySlv{};
        ///EOSMP_SLV
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,unsigned> eosmpSlv{};
        ///End of regular conversion of the slave              ADC
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::ReadWriteAccess,unsigned> eocSlv{};
        ///End of regular sequence flag of the              slave ADC
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,unsigned> eosSlv{};
        ///Overrun flag of the slave              ADC
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,unsigned> ovrSlv{};
        ///End of injected conversion flag of the              slave ADC
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,21),Register::ReadWriteAccess,unsigned> jeocSlv{};
        ///End of injected sequence flag of the              slave ADC
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,22),Register::ReadWriteAccess,unsigned> jeosSlv{};
        ///Analog watchdog 1 flag of the slave              ADC
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,23),Register::ReadWriteAccess,unsigned> awd1Slv{};
        ///Analog watchdog 2 flag of the slave              ADC
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,unsigned> awd2Slv{};
        ///Analog watchdog 3 flag of the slave              ADC
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,unsigned> awd3Slv{};
        ///Injected Context Queue Overflow flag of              the slave ADC
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,unsigned> jqovfSlv{};
    }
    namespace Adc12Ccr{    ///<ADC common control register
        using Addr = Register::Address<0x50000308,0xfe3c10e0,0x00000000,unsigned>;
        ///Multi ADC mode selection
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,0),Register::ReadWriteAccess,unsigned> mult{};
        ///Delay between 2 sampling              phases
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,8),Register::ReadWriteAccess,unsigned> delay{};
        ///DMA configuration (for multi-ADC              mode)
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,unsigned> dmacfg{};
        ///Direct memory access mode for multi ADC              mode
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,14),Register::ReadWriteAccess,unsigned> mdma{};
        ///ADC clock mode
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,16),Register::ReadWriteAccess,unsigned> ckmode{};
        ///VREFINT enable
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,22),Register::ReadWriteAccess,unsigned> vrefen{};
        ///Temperature sensor enable
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,23),Register::ReadWriteAccess,unsigned> tsen{};
        ///VBAT enable
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,unsigned> vbaten{};
    }
    namespace Adc12Cdr{    ///<ADC common regular data register for dual          and triple modes
        using Addr = Register::Address<0x5000030c,0x00000000,0x00000000,unsigned>;
        ///Regular data of the slave              ADC
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,16),Register::ReadWriteAccess,unsigned> rdataSlv{};
        ///Regular data of the master              ADC
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> rdataMst{};
    }
}


text:
package org.jetbrains.plugins.scala
package lang
package psi
package api
package expr

import com.intellij.openapi.progress.ProgressManager
import com.intellij.psi._
import org.jetbrains.plugins.scala.extensions.{ElementText, PsiElementExt, PsiNamedElementExt, StringExt}
import org.jetbrains.plugins.scala.lang.psi.ScalaPsiUtil.{MethodValue, isAnonymousExpression}
import org.jetbrains.plugins.scala.lang.psi.api.InferUtil.{SafeCheckException, extractImplicitParameterType}
import org.jetbrains.plugins.scala.lang.psi.api.base.types.ScTypeElement
import org.jetbrains.plugins.scala.lang.psi.api.base.{ScIntLiteral, ScLiteral}
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.imports.usages.ImportUsed
import org.jetbrains.plugins.scala.lang.psi.impl.ScalaPsiElementFactory.createExpressionFromText
import org.jetbrains.plugins.scala.lang.psi.implicits.{ImplicitCollector, ImplicitResolveResult, ScImplicitlyConvertible}
import org.jetbrains.plugins.scala.lang.psi.types.api._
import org.jetbrains.plugins.scala.lang.psi.types.api.designator.ScDesignatorType
import org.jetbrains.plugins.scala.lang.psi.types.nonvalue.{Parameter, ScMethodType, ScTypePolymorphicType}
import org.jetbrains.plugins.scala.lang.psi.types.result._
import org.jetbrains.plugins.scala.lang.psi.types.{api, _}
import org.jetbrains.plugins.scala.lang.resolve.processor.MethodResolveProcessor
import org.jetbrains.plugins.scala.lang.resolve.{ScalaResolveResult, StdKinds}
import org.jetbrains.plugins.scala.macroAnnotations.{CachedWithRecursionGuard, ModCount}
import org.jetbrains.plugins.scala.project.ProjectPsiElementExt
import org.jetbrains.plugins.scala.project.ScalaLanguageLevel.Scala_2_11

import scala.annotation.tailrec
import scala.collection.mutable.ArrayBuffer
import scala.collection.{Seq, Set}

/**
  * @author ilyas, Alexander Podkhalyuzin
  */

trait ScExpression extends ScBlockStatement with PsiAnnotationMemberValue with ImplicitParametersOwner
  with ScModificationTrackerOwner with Typeable {

  import org.jetbrains.plugins.scala.lang.psi.api.expr.ScExpression._

  override def getType(ctx: TypingContext): TypeResult[ScType] =
    this.getTypeAfterImplicitConversion().tr

  @volatile
  private var implicitParameters: Option[Seq[ScalaResolveResult]] = None

  @volatile
  private var implicitParametersFromUnder: Option[Seq[ScalaResolveResult]] = None

  final protected def setImplicitParameters(results: Option[Seq[ScalaResolveResult]], fromUnderscore: Boolean): Unit = {
    if (fromUnderscore)
      implicitParametersFromUnder = results
    else
      implicitParameters = results
  }

  /**
    * Warning! There is a hack in scala compiler for ClassManifest and ClassTag.
    * In case of implicit parameter with type ClassManifest[T]
    * this method will return ClassManifest with substitutor of type T.
    *
    * @return implicit parameters used for this expression
    */
  def findImplicitParameters: Option[Seq[ScalaResolveResult]] = {
    ProgressManager.checkCanceled()

    if (ScUnderScoreSectionUtil.isUnderscoreFunction(this)) {
      this.getTypeWithoutImplicits(fromUnderscore = true) //to update implicitParametersFromUnder
      implicitParametersFromUnder
    } else {
      getType(TypingContext.empty) //to update implicitParameters field
      implicitParameters
    }
  }

  protected def innerType: TypeResult[ScType] =
    Failure(ScalaBundle.message("no.type.inferred", getText), Some(this))

  /**
    * Some expression may be replaced only with another one
    */
  def replaceExpression(expr: ScExpression, removeParenthesis: Boolean): ScExpression = {
    val oldParent = getParent
    if (oldParent == null) throw new PsiInvalidElementAccessException(this)
    if (removeParenthesis && oldParent.isInstanceOf[ScParenthesisedExpr]) {
      return oldParent.asInstanceOf[ScExpression].replaceExpression(expr, removeParenthesis = true)
    }
    val newExpr = if (ScalaPsiUtil.needParentheses(this, expr)) {
      createExpressionFromText(expr.getText.parenthesize(needParenthesis = true))
    } else expr
    val parentNode = oldParent.getNode
    val newNode = newExpr.copy.getNode
    parentNode.replaceChild(this.getNode, newNode)
    newNode.getPsi.asInstanceOf[ScExpression]
  }

  @volatile
  private var additionalExpression: Option[(ScExpression, ScType)] = None

  def setAdditionalExpression(additionalExpression: Option[(ScExpression, ScType)]) {
    this.additionalExpression = additionalExpression
  }

  /**
    * This method should be used to get implicit conversions and used imports, while eta expanded method return was
    * implicitly converted
    *
    * @return mirror for this expression, in case if it exists
    */
  def getAdditionalExpression: Option[(ScExpression, ScType)] = {
    getType(TypingContext.empty)
    additionalExpression
  }

  def implicitElement(fromUnderscore: Boolean = false,
                      expectedOption: => Option[ScType] = this.smartExpectedType()): Option[PsiNamedElement] = {
    def referenceImplicitFunction(reference: ScReferenceExpression) = reference.multiResolve(false) match {
      case Array(result: ScalaResolveResult) => result.implicitFunction
      case _ => None
    }

    def implicitFunction(element: ScalaPsiElement): Option[PsiNamedElement] = element.getParent match {
      case reference: ScReferenceExpression =>
        referenceImplicitFunction(reference)
      case infix: ScInfixExpr if this == infix.getBaseExpr =>
        referenceImplicitFunction(infix.operation)
      case call: ScMethodCall => call.getImplicitFunction
      case generator: ScGenerator => implicitFunction(generator)
      case _ =>
        this.getTypeAfterImplicitConversion(expectedOption = expectedOption, fromUnderscore = fromUnderscore).implicitFunction
    }

    implicitFunction(this)
  }

  def getAllImplicitConversions(fromUnderscore: Boolean = false): Seq[PsiNamedElement] = {
    new ScImplicitlyConvertible(this, fromUnderscore)
      .implicitMap(arguments = this.expectedTypes(fromUnderscore).toSeq)
      .map(_.element)
      .sortWith {
        case (first, second) =>
          val firstName = first.name
          val secondName = second.name

          def isAnyTo(string: String): Boolean =
            string.matches("^[a|A]ny(2|To|to).+$")

          val isSecondAnyTo = isAnyTo(secondName)

          if (isAnyTo(firstName) ^ isSecondAnyTo) isSecondAnyTo
          else firstName.compareTo(secondName) < 0
      }
  }

  final def calculateReturns(withBooleanInfix: Boolean = false): Seq[PsiElement] = {
    val res = new ArrayBuffer[PsiElement]

    def calculateReturns0(el: PsiElement) {
      el match {
        case tr: ScTryStmt =>
          calculateReturns0(tr.tryBlock)
          tr.catchBlock match {
            case Some(ScCatchBlock(caseCl)) =>
              caseCl.caseClauses.flatMap(_.expr).foreach(calculateReturns0)
            case _ =>
          }
        case block: ScBlock =>
          block.lastExpr match {
            case Some(expr) => calculateReturns0(expr)
            case _ => res += block
          }
        case pe: ScParenthesisedExpr =>
          pe.expr.foreach(calculateReturns0)
        case m: ScMatchStmt =>
          m.getBranches.foreach(calculateReturns0)
        case i: ScIfStmt =>
          i.elseBranch match {
            case Some(e) =>
              calculateReturns0(e)
              i.thenBranch match {
                case Some(thenBranch) => calculateReturns0(thenBranch)
                case _ =>
              }
            case _ => res += i
          }
        case ScInfixExpr(left, ElementText(op), right)
          if withBooleanInfix && (op == "&&" || op == "||") &&
            left.getType(TypingContext.empty).exists(_ == api.Boolean) &&
            right.getType(TypingContext.empty).exists(_ == api.Boolean) => calculateReturns0(right)
        //TODO "!contains" is a quick fix, function needs unit testing to validate its behavior
        case _ => if (!res.contains(el)) res += el
      }
    }

    calculateReturns0(this)
    res
  }
}

object ScExpression {

  case class ExpressionTypeResult(tr: TypeResult[ScType],
                                  importsUsed: scala.collection.Set[ImportUsed] = Set.empty,
                                  implicitFunction: Option[PsiNamedElement] = None)

  object Type {
    def unapply(exp: ScExpression): Option[ScType] = exp.getType(TypingContext.empty).toOption
  }

  implicit class Ext(val expr: ScExpression) extends AnyVal {
    private implicit def elementScope = expr.elementScope
    private def project = elementScope.projectContext

    def expectedType(fromUnderscore: Boolean = true): Option[ScType] =
      expectedTypeEx(fromUnderscore).map(_._1)

    def expectedTypeEx(fromUnderscore: Boolean = true): Option[(ScType, Option[ScTypeElement])] =
      ExpectedTypes.expectedExprType(expr, fromUnderscore)

    def expectedTypes(fromUnderscore: Boolean = true): Array[ScType] = expectedTypesEx(fromUnderscore).map(_._1)

    @CachedWithRecursionGuard(expr, Array.empty[(ScType, Option[ScTypeElement])], ModCount.getBlockModificationCount)
    def expectedTypesEx(fromUnderscore: Boolean = true): Array[(ScType, Option[ScTypeElement])] = {
      ExpectedTypes.expectedExprTypes(expr, fromUnderscore = fromUnderscore)
    }

    @CachedWithRecursionGuard(expr, None, ModCount.getBlockModificationCount)
    def smartExpectedType(fromUnderscore: Boolean = true): Option[ScType] = ExpectedTypes.smartExpectedType(expr, fromUnderscore)

    def getTypeIgnoreBaseType: TypeResult[ScType] = getTypeAfterImplicitConversion(ignoreBaseTypes = true).tr

    @CachedWithRecursionGuard(expr, Failure("Recursive getNonValueType", Some(expr)), ModCount.getBlockModificationCount)
    def getNonValueType(ignoreBaseType: Boolean = false,
                        fromUnderscore: Boolean = false): TypeResult[ScType] = {
      ProgressManager.checkCanceled()
      if (fromUnderscore) expr.innerType
      else {
        val unders = ScUnderScoreSectionUtil.underscores(expr)
        if (unders.isEmpty) expr.innerType
        else {
          val params = unders.zipWithIndex.map {
            case (u, index) =>
              val tpe = u.getNonValueType(ignoreBaseType).getOrAny.inferValueType.unpackedType
              Parameter(tpe, isRepeated = false, index = index)
          }
          val methType =
            ScMethodType(expr.getTypeAfterImplicitConversion(ignoreBaseTypes = ignoreBaseType,
              fromUnderscore = true).tr.getOrAny,
              params, isImplicit = false)
          Success(methType, Some(expr))
        }
      }
    }

    /**
      * This method returns real type, after using implicit conversions.
      * Second parameter to return is used imports for this conversion.
      *
      * @param expectedOption  to which type we trying to convert
      * @param ignoreBaseTypes parameter to avoid value discarding, literal narrowing, widening
      *                        this parameter is useful for refactorings (introduce variable)
      */
    @CachedWithRecursionGuard(expr, ExpressionTypeResult(Failure("Recursive getTypeAfterImplicitConversion", Some(expr))), ModCount.getBlockModificationCount)
    def getTypeAfterImplicitConversion(checkImplicits: Boolean = true,
                                       isShape: Boolean = false,
                                       expectedOption: Option[ScType] = None,
                                       ignoreBaseTypes: Boolean = false,
                                       fromUnderscore: Boolean = false): ExpressionTypeResult = {

      def isJavaReflectPolymorphic = expr.scalaLanguageLevelOrDefault >= Scala_2_11 && ScalaPsiUtil.isJavaReflectPolymorphicSignature(expr)

      val expected = expectedOption.orElse {
        expectedType(fromUnderscore = fromUnderscore)
      }

      if (isShape) ExpressionTypeResult(Success(shape(expr).getOrElse(Nothing), Some(expr)))
      else {
        val tr = getTypeWithoutImplicits(ignoreBaseTypes, fromUnderscore)
        (expected, tr.toOption) match {
          case (Some(expType), Some(tp))
            if checkImplicits && !tp.conforms(expType) => //do not try implicit conversions for shape check or already correct type

            val samType = tryConvertToSAM(fromUnderscore, expType, tp)

            if (samType.nonEmpty) samType.get
            else if (isJavaReflectPolymorphic) ExpressionTypeResult(Success(expType, Some(expr)))
            else {
              val functionType = FunctionType(expType, Seq(tp))
              val implicitCollector = new ImplicitCollector(expr, functionType, functionType, None, isImplicitConversion = true)
              val fromImplicit = implicitCollector.collect() match {
                case Seq(res) =>
                  val `type` = extractImplicitParameterType(res).flatMap {
                    case FunctionType(rt, Seq(_)) => Some(rt)
                    case paramType =>
                      expr.elementScope.cachedFunction1Type.flatMap { functionType =>
                        val (_, substitutor) = paramType.conforms(functionType, ScUndefinedSubstitutor())
                        substitutor.getSubstitutor.map {
                          _.subst(functionType.typeArguments(1))
                        }.filter {
                          !_.isInstanceOf[UndefinedType]
                        }
                      }
                  }

                  `type`.map((_, res))
                case _ => None
              }
              fromImplicit match {
                case Some((mr, result)) =>
                  ExpressionTypeResult(Success(mr, Some(expr)), result.importsUsed, Some(result.getElement))
                case _ =>
                  ExpressionTypeResult(tr)
              }
            }
          case _ => ExpressionTypeResult(tr)
        }
      }
    }

    @CachedWithRecursionGuard(expr, Failure("Recursive getTypeWithoutImplicits", Some(expr)),
      ModCount.getBlockModificationCount)
    def getTypeWithoutImplicits(ignoreBaseTypes: Boolean = false, fromUnderscore: Boolean = false): TypeResult[ScType] = {
      ProgressManager.checkCanceled()
      val fromNullLiteral = expr match {
        case lit: ScLiteral =>
          val typeForNull = lit.getTypeForNullWithoutImplicits
          if (typeForNull.nonEmpty) Option(Success(typeForNull.get, None))
          else None
        case _ => None
      }

      if (fromNullLiteral.nonEmpty) fromNullLiteral.get
      else {
        val inner = expr.getNonValueType(ignoreBaseTypes, fromUnderscore)
        inner match {
          case Success(rtp, _) =>
            var res = rtp

            val expType = expectedType(fromUnderscore)

            def updateExpected(oldRes: ScType): ScType = {
              try {
                val updatedWithExpected =
                  InferUtil.updateAccordingToExpectedType(Success(rtp, Some(expr)), fromImplicitParameters = true,
                    filterTypeParams = false, expectedType = expType, expr = expr, check = true)
                updatedWithExpected match {
                  case Success(newRes, _) =>
                    updateWithImplicitParameters(newRes, checkExpectedType = true, fromUnderscore)
                  case _ =>
                    updateWithImplicitParameters(oldRes, checkExpectedType = true, fromUnderscore)
                }
              } catch {
                case _: SafeCheckException =>
                  updateWithImplicitParameters(oldRes, checkExpectedType = false, fromUnderscore)
              }
            }

            if (!isMethodInvocation(expr)) {
              //it is not updated according to expected type, let's do it
              expr.getParent match {
                case _: ScGenericCall => // all the implicits belong to the parent ScGenericCall
                case _                => res = updateExpected(rtp)
              }
            }

            def removeMethodType(retType: ScType, updateType: ScType => ScType = t => t) {
              expType match {
                case Some(expected) =>
                  expected.removeAbstracts match {
                    case FunctionType(_, _) =>
                    case expect if ScalaPsiUtil.isSAMEnabled(expr) =>
                      val languageLevel = expr.scalaLanguageLevelOrDefault
                      if (languageLevel != Scala_2_11 || ScalaPsiUtil.toSAMType(expect, expr).isEmpty) {
                        res = updateType(retType)
                      }
                    case _ => res = updateType(retType)
                  }
                case _ => res = updateType(retType)
              }
            }

            res match {
              case ScTypePolymorphicType(ScMethodType(retType, params, _), tp) if params.isEmpty &&
                !ScUnderScoreSectionUtil.isUnderscore(expr) =>
                removeMethodType(retType, t => ScTypePolymorphicType(t, tp))
              case ScMethodType(retType, params, _) if params.isEmpty &&
                !ScUnderScoreSectionUtil.isUnderscore(expr) =>
                removeMethodType(retType)
              case _ =>
            }

            val valType = res.inferValueType.unpackedType

            if (ignoreBaseTypes) Success(valType, Some(expr))
            else {
              expType match {
                case None =>
                  Success(valType, Some(expr))
                case Some(expected) if expected.removeAbstracts equiv Unit =>
                  //value discarding
                  Success(Unit, Some(expr))
                case Some(expected) =>
                  val narrowing = isNarrowing(expected)
                  if (narrowing.isDefined) narrowing.get
                  else {
                    val widening = isWidening(valType, expected)
                    if (widening.isDefined) widening.get
                    else Success(valType, Some(expr))
                  }
              }
            }
          case _ => inner
        }
      }
    }

    @CachedWithRecursionGuard(expr, Array.empty[ScalaResolveResult], ModCount.getBlockModificationCount)
    def applyShapeResolveForExpectedType(tp: ScType, exprs: Seq[ScExpression], call: Option[MethodInvocation]): Array[ScalaResolveResult] = {
      val applyProc =
        new MethodResolveProcessor(expr, "apply", List(exprs), Seq.empty, Seq.empty /* todo: ? */ ,
          StdKinds.methodsOnly, isShapeResolve = true)
      applyProc.processType(tp, expr)
      var cand = applyProc.candidates
      if (cand.length == 0 && call.isDefined) {
        val expr = call.get.getEffectiveInvokedExpr
        ScalaPsiUtil.findImplicitConversion(expr, "apply", expr, applyProc, noImplicitsForArgs = false).foreach { result =>
          val builder = new ImplicitResolveResult.ResolverStateBuilder(result).withImplicitFunction
          applyProc.processType(result.typeWithDependentSubstitutor, expr, builder.state)
          cand = applyProc.candidates
        }
      }
      if (cand.length == 0 && ScalaPsiUtil.approveDynamic(tp, expr.getProject, expr.resolveScope) && call.isDefined) {
        cand = ScalaPsiUtil.processTypeForUpdateOrApplyCandidates(call.get, tp, isShape = true, isDynamic = true)
      }
      cand
    }

    //has side effect!
    private def updateWithImplicitParameters(tpe: ScType, checkExpectedType: Boolean, fromUnderscore: Boolean): ScType = {
      val (newType, params) = updatedWithImplicitParameters(tpe, checkExpectedType)

      expr.setImplicitParameters(params, fromUnderscore)

      newType
    }

    def updatedWithImplicitParameters(tpe: ScType, checkExpectedType: Boolean): (ScType, Option[Seq[ScalaResolveResult]]) = {
      val checkImplicitParameters = ScalaPsiUtil.withEtaExpansion(expr)
      if (checkImplicitParameters)
        InferUtil.updateTypeWithImplicitParameters(tpe, expr, None, checkExpectedType, fullInfo = false)
      else (tpe, None)
    }

    //numeric literal narrowing
    def isNarrowing(expected: ScType): Option[TypeResult[ScType]] = {
      import expr.projectContext

      def isByte(v: Long)  = v >= scala.Byte.MinValue  && v <= scala.Byte.MaxValue
      def isChar(v: Long)  = v >= scala.Char.MinValue  && v <= scala.Char.MaxValue
      def isShort(v: Long) = v >= scala.Short.MinValue && v <= scala.Short.MaxValue

      def success(t: ScType) = Some(Success(t, Some(expr)))

      val intLiteralValue: Int = expr match {
        case ScIntLiteral(value) => value
        case ScPrefixExpr(op, ScIntLiteral(value)) if Set("+", "-").contains(op.refName) =>
          val mult = if (op.refName == "-") -1 else 1
          mult * value
        case _ => return None
      }

      val stdTypes = StdTypes.instance
      import stdTypes._

      expected.removeAbstracts match {
        case Char  if isChar(intLiteralValue)  => success(Char)
        case Byte  if isByte(intLiteralValue)  => success(Byte)
        case Short if isShort(intLiteralValue) => success(Short)
        case _ => None
      }
    }

    //numeric widening
    private def isWidening(valueType: ScType, expected: ScType): Option[TypeResult[ScType]] = {
      val (l, r) = (getStdType(valueType), getStdType(expected)) match {
        case (Some(left), Some(right)) => (left, right)
        case _ => return None
      }
      val stdTypes = project.stdTypes
      import stdTypes._

      (l, r) match {
        case (Byte, Short | Int | Long | Float | Double) => Some(Success(expected, Some(expr)))
        case (Short, Int | Long | Float | Double) => Some(Success(expected, Some(expr)))
        case (Char, Byte | Short | Int | Long | Float | Double) => Some(Success(expected, Some(expr)))
        case (Int, Long | Float | Double) => Some(Success(expected, Some(expr)))
        case (Long, Float | Double) => Some(Success(expected, Some(expr)))
        case (Float, Double) => Some(Success(expected, Some(expr)))
        case _ => None
      }
    }

    private def getStdType(t: ScType): Option[StdType] = {
      val stdTypes = project.stdTypes
      import stdTypes._

      t match {
        case AnyVal => Some(AnyVal)
        case valType: ValType => Some(valType)
        case designatorType: ScDesignatorType => designatorType.getValType
        case _ => None
      }
    }

    @tailrec
    private def isMethodInvocation(expr: ScExpression): Boolean = {
      expr match {
        case _: ScPrefixExpr => false
        case _: ScPostfixExpr => false
        case _: MethodInvocation => true
        case p: ScParenthesisedExpr =>
          p.expr match {
            case Some(exp) => isMethodInvocation(exp)
            case _ => false
          }
        case _ => false
      }
    }

    private def tryConvertToSAM(fromUnderscore: Boolean, expected: ScType, tp: ScType) = {
      def checkForSAM(etaExpansionHappened: Boolean = false): Option[ExpressionTypeResult] = {
        def expectedResult = Some(ExpressionTypeResult(Success(expected, Some(expr))))

        tp match {
          case FunctionType(_, params) if ScalaPsiUtil.isSAMEnabled(expr) =>
            ScalaPsiUtil.toSAMType(expected, expr) match {
              case Some(methodType) if tp.conforms(methodType) => expectedResult
              case Some(methodType@FunctionType(retTp, _)) if etaExpansionHappened && retTp.equiv(Unit) =>
                val newTp = FunctionType(Unit, params)
                if (newTp.conforms(methodType)) expectedResult
                else None
              case _ => None
            }
          case _ => None
        }
      }

      expr match {
        case ScFunctionExpr(_, _) if fromUnderscore => checkForSAM()
        case _ if !fromUnderscore && ScalaPsiUtil.isAnonExpression(expr) => checkForSAM()
        case MethodValue(method) if expr.scalaLanguageLevelOrDefault == Scala_2_11 || method.getParameterList.getParametersCount > 0 =>
          checkForSAM(etaExpansionHappened = true)
        case _ => None
      }
    }

    private def removeMethodType(tp: ScType, expected: ScType): ScType = {
      def inner(retType: ScType, updateType: ScType => ScType): ScType = {
        expected.removeAbstracts match {
          case FunctionType(_, _) => tp
          case expect if ScalaPsiUtil.isSAMEnabled(expr) =>
            val languageLevel = expr.scalaLanguageLevelOrDefault
            if (languageLevel != Scala_2_11 || ScalaPsiUtil.toSAMType(expect, expr).isEmpty) {
              updateType(retType)
            }
            else tp
          case _ => updateType(retType)
        }
      }

      tp match {
        case ScTypePolymorphicType(ScMethodType(retType, params, _), typeParams) if params.isEmpty &&
          !ScUnderScoreSectionUtil.isUnderscore(expr) =>
          inner(retType, t => ScTypePolymorphicType(t, typeParams))
        case ScMethodType(retType, params, _) if params.isEmpty &&
          !ScUnderScoreSectionUtil.isUnderscore(expr) =>
          inner(retType, t => t)
        case _ => tp
      }
    }
  }

  private def shape(expression: ScExpression, ignoreAssign: Boolean = false): Option[ScType] = {
    import expression.projectContext

    def shapeIgnoringAssign(maybeExpression: Option[ScExpression]) = maybeExpression.flatMap {
      shape(_, ignoreAssign = true)
    }

    expression match {
      case assign: ScAssignStmt if !ignoreAssign && assign.assignName.isDefined =>
        shapeIgnoringAssign(assign.getRExpression)
      case _ =>
        val arityAndResultType = Option(isAnonymousExpression(expression)).filter {
          case (-1, _) => false
          case _ => true
        }.map {
          case (i, expr: ScFunctionExpr) => (i, shapeIgnoringAssign(expr.result))
          case (i, _) => (i, None)
        }

        arityAndResultType.map {
          case (i, tp) => (Seq.fill(i)(Any), tp)
        }.map {
          case (argumentsTypes, maybeResultType) =>
            FunctionType(maybeResultType.getOrElse(Nothing), argumentsTypes)(expression.elementScope)
        }
    }
  }
}

object ExpectedType {
  def unapply(e: ScExpression): Option[ScType] = e.expectedType()
}

object NonValueType {
  def unapply(e: ScExpression): Option[ScType] = e.getNonValueType().toOption
}

redpajama_set_name: RedPajamaGithub


text:
<?php
/**
 * Created by PhpStorm.
 * User: etouraille
 * Date: 17/10/14
 * Time: 19:44
 */

namespace OP\OAuth;

class Token {

    protected $duration;
    protected $tokenModel;

    public function __construct($duration=31449600)
    {
        $this->duration = $duration;
        $this->tokenModel = new \OP\Model\Token();

    }

    protected function create($idMe)
    {
        $this->tokenModel->add(array(
            'idMe'=>$idMe,
            'value'=>$tokenValue = strtolower(md5(time().$idMe)),
            'duration'=>$this->duration,
            )
        );
        return $tokenValue;
    }

    public function isValid($value)
    {
        $rowToken = $this->tokenModel->getRow(array('value'=>$value));
        if($rowToken){
            $duration = $rowToken['duration'];
            if($duration == 0){
                return $rowToken['idMe'];
            }
            else
            {
                $creation = $rowToken['creation'];
                $time = time();
                $valid =  (strtotime($creation)+$duration) > $time;
                if($valid)
                {
                    return $rowToken['idMe'];
                }
                else
                {
                    return false;
                }
            }
        }
        else
        {
            return false;
        }
    }

    public function getTokenValue($idMe)
    {
        $rowsToken = $this->tokenModel->getRows(array('idMe'=>$idMe),array('creation'=>'DESC'));
        $idToken = false;
        $tokenValue = false;
        foreach($rowsToken as $rowToken)
        {
            if($this->isValid($rowToken['value']))
            {
                  $idToken = $rowToken['id'];
                  $tokenValue = $rowToken['value'];
                  break;
            }
        }
        if($idToken)
        {
            $this->tokenModel->clean($idMe,$idToken);
            return $tokenValue;
        }
        else
        {
            return $this->create($idMe);
        }
    }
}


text:
package com.langpath.commands;

import com.langpath.Application;
import com.langpath.data.model.entity.word.Word;
import com.langpath.data.repositories.WordRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * Created by root on 11.10.16.
 */
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = Application.class)
@ActiveProfiles(value = "test")
public class IncreaseWrongAnswersTest {

    @Autowired
    IncreaseWrongAnswers increaseWrongAnswers;

    @Autowired
    WordRepository wordRepository;

    @Test
    public void shouldIncreaseWrongAnswers(){
        for(int i=0;i<500;i++) {
            Page<Word> wordsPage = wordRepository.findAll(new PageRequest(i,5));
                wordsPage.forEach(word -> {
                    int last = word.getWrongAnswers();
                    increaseWrongAnswers.increaseWrongAnswers(word.getId());
                    //assertTrue(last < ); //todo add assert
                });
        }
    }

}


text:
#ifndef XMLDocumentParserScope_h
#define XMLDocumentParserScope_h

#include <wtf/Noncopyable.h>

#if ENABLE(XSLT)
#include <libxml/xmlerror.h>
#endif

namespace WebCore {

    class CachedResourceLoader;

    class XMLDocumentParserScope {
        WTF_MAKE_NONCOPYABLE(XMLDocumentParserScope);
    public:
        explicit XMLDocumentParserScope(CachedResourceLoader*);
        ~XMLDocumentParserScope();

        static CachedResourceLoader* currentCachedResourceLoader;

#if ENABLE(XSLT)
        XMLDocumentParserScope(CachedResourceLoader*, xmlGenericErrorFunc, xmlStructuredErrorFunc structuredErrorFunc = 0, void* errorContext = nullptr);
#endif

    private:
        CachedResourceLoader* m_oldCachedResourceLoader;

#if ENABLE(XSLT)
        xmlGenericErrorFunc m_oldGenericErrorFunc;
        xmlStructuredErrorFunc m_oldStructuredErrorFunc;
        void* m_oldErrorContext;
#endif
    };

} // namespace WebCore

#endif // XMLDocumentParserScope_h


text:
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:zstack="http://zstack.org/schema/zstack"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
         http://www.springframework.org/schema/aop
         http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
         http://www.springframework.org/schema/tx
     	 http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
     	 http://zstack.org/schema/zstack
         http://zstack.org/schema/zstack/plugin.xsd"
	default-init-method="init" default-destroy-method="destroy">

    <bean id="TagManager" class="org.zstack.tag.TagManagerImpl">
        <zstack:plugin>
            <zstack:extension interface="org.zstack.header.Component" />
            <zstack:extension interface="org.zstack.header.Service" />
            <zstack:extension interface="org.zstack.core.db.SoftDeleteEntityExtensionPoint" />
            <zstack:extension interface="org.zstack.core.db.HardDeleteEntityExtensionPoint" />
            <zstack:extension interface="org.zstack.header.apimediator.GlobalApiMessageInterceptor" />
            <zstack:extension interface="org.zstack.header.tag.SystemTagLifeCycleExtension" />
        </zstack:plugin>
    </bean>

    <bean id="TagSubQueryExtension" class="org.zstack.tag.TagSubQueryExtension">
        <zstack:plugin>
            <zstack:extension interface="org.zstack.query.MysqlQuerySubQueryExtension" />
        </zstack:plugin>
    </bean>

    <bean id="TagApiInterceptor" class="org.zstack.tag.TagApiInterceptor">
        <zstack:plugin>
            <zstack:extension interface="org.zstack.header.apimediator.ApiMessageInterceptor" />
        </zstack:plugin>
    </bean>
</beans>


text:
<?xml version="1.0" encoding="UTF-8"?>
<billStatus>
  <bill>
    <subjects>
      <billSubjects>
        <policyArea>
          <name>Health</name>
        </policyArea>
        <legislativeSubjects>
          <item>
            <name>Government information and archives</name>
          </item>
          <item>
            <name>Government studies and investigations</name>
          </item>
          <item>
            <name>Health care coverage and access</name>
          </item>
          <item>
            <name>Health care quality</name>
          </item>
          <item>
            <name>Health information and medical records</name>
          </item>
          <item>
            <name>Health programs administration and funding</name>
          </item>
          <item>
            <name>Health promotion and preventive care</name>
          </item>
          <item>
            <name>Minority health</name>
          </item>
          <item>
            <name>Performance measurement</name>
          </item>
          <item>
            <name>State and local government operations</name>
          </item>
          <item>
            <name>Women's health</name>
          </item>
        </legislativeSubjects>
      </billSubjects>
    </subjects>
    <committees>
      <billCommittees>
        <item>
          <subcommittees />
          <systemCode>sshr00</systemCode>
          <type>Standing</type>
          <name>Health, Education, Labor, and Pensions Committee</name>
          <activities>
            <item>
              <name>Referred to</name>
              <date>2017-05-11T20:21:49Z</date>
            </item>
          </activities>
          <chamber>Senate</chamber>
        </item>
      </billCommittees>
    </committees>
    <latestAction>
      <links />
      <actionDate>2017-05-11</actionDate>
      <text>Read twice and referred to the Committee on Health, Education, Labor, and Pensions.</text>
    </latestAction>
    <actions>
      <actionTypeCounts>
        <introducedInSenate>1</introducedInSenate>
        <referredToCommittee>1</referredToCommittee>
      </actionTypeCounts>
      <item>
        <actionDate>2017-05-11</actionDate>
        <committee>
          <name>Health, Education, Labor, and Pensions Committee</name>
          <systemCode>sshr00</systemCode>
        </committee>
        <links />
        <sourceSystem>
          0
          <name>Senate</name>
        </sourceSystem>
        <text>Read twice and referred to the Committee on Health, Education, Labor, and Pensions.</text>
        <type>IntroReferral</type>
      </item>
      <item>
        <type>IntroReferral</type>
        <actionCode>10000</actionCode>
        <committee />
        <links />
        <text>Introduced in Senate</text>
        <sourceSystem>
          9
          <name>Library of Congress</name>
        </sourceSystem>
        <actionDate>2017-05-11</actionDate>
      </item>
      <actionByCounts>
        <senate>2</senate>
      </actionByCounts>
    </actions>
    <summaries>
      <billSummaries />
    </summaries>
    <originChamber>Senate</originChamber>
    <cboCostEstimates />
    <congress>115</congress>
    <calendarNumbers />
    <version>1.0.0</version>
    <sponsors>
      <item>
        <state>ND</state>
        <middleName />
        <identifiers>
          <lisID>2174</lisID>
          <bioguideId>H001069</bioguideId>
          <gpoId />
        </identifiers>
        <fullName>Sen. Heitkamp, Heidi [D-ND]</fullName>
        <lastName>Heitkamp</lastName>
        <bioguideId>H001069</bioguideId>
        <firstName>Heidi</firstName>
        <party>D</party>
        <byRequestType />
      </item>
    </sponsors>
    <policyArea>
      <name>Health</name>
    </policyArea>
    <updateDate>2017-09-13T12:49:02Z</updateDate>
    <relatedBills>
      <item>
        <congress>115</congress>
        <relationshipDetails>
          <item>
            <type>Related bill</type>
            <identifiedBy>CRS</identifiedBy>
          </item>
        </relationshipDetails>
        <latestTitle>Preventing Maternal Deaths Act of 2017</latestTitle>
        <type>HR</type>
        <number>1318</number>
        <latestAction>
          <actionDate>2017-03-17</actionDate>
          <text>Referred to the Subcommittee on Health.</text>
        </latestAction>
      </item>
    </relatedBills>
    <notes />
    <title>Maternal Health Accountability Act of 2017</title>
    <recordedVotes />
    <committeeReports />
    <billType>S</billType>
    <cosponsors>
      <item>
        <sponsorshipDate>2017-05-11</sponsorshipDate>
        <state>WV</state>
        <sponsorshipWithdrawnDate />
        <identifiers>
          <bioguideId>C001047</bioguideId>
          <lisID>1676</lisID>
          <gpoId>8223</gpoId>
        </identifiers>
        <fullName>Sen. Capito, Shelley Moore [R-WV]</fullName>
        <isOriginalCosponsor>True</isOriginalCosponsor>
        <lastName>CAPITO</lastName>
        <bioguideId>C001047</bioguideId>
        <firstName>SHELLEY</firstName>
        <middleName>MOORE</middleName>
        <party>R</party>
      </item>
      <item>
        <sponsorshipDate>2017-06-05</sponsorshipDate>
        <state>NJ</state>
        <sponsorshipWithdrawnDate />
        <identifiers>
          <lisID>2194</lisID>
          <bioguideId>B001288</bioguideId>
          <gpoId />
        </identifiers>
        <fullName>Sen. Booker, Cory A. [D-NJ]</fullName>
        <isOriginalCosponsor>False</isOriginalCosponsor>
        <lastName>Booker</lastName>
        <bioguideId>B001288</bioguideId>
        <firstName>Cory</firstName>
        <middleName>A.</middleName>
        <party>D</party>
      </item>
      <item>
        <sponsorshipDate>2017-07-10</sponsorshipDate>
        <state>NY</state>
        <sponsorshipWithdrawnDate />
        <identifiers>
          <lisID>1866</lisID>
          <bioguideId>G000555</bioguideId>
          <gpoId>8336</gpoId>
        </identifiers>
        <fullName>Sen. Gillibrand, Kirsten E. [D-NY]</fullName>
        <isOriginalCosponsor>False</isOriginalCosponsor>
        <lastName>Gillibrand</lastName>
        <bioguideId>G000555</bioguideId>
        <firstName>Kirsten</firstName>
        <middleName>E.</middleName>
        <party>D</party>
      </item>
      <item>
        <sponsorshipDate>2017-09-12</sponsorshipDate>
        <state>NH</state>
        <sponsorshipWithdrawnDate />
        <identifiers>
          <bioguideId>H001076</bioguideId>
          <lisID>2302</lisID>
          <gpoId />
        </identifiers>
        <fullName>Sen. Hassan, Margaret Wood [D-NH]</fullName>
        <isOriginalCosponsor>False</isOriginalCosponsor>
        <lastName>Hassan</lastName>
        <bioguideId>H001076</bioguideId>
        <firstName>Margaret</firstName>
        <middleName>Wood</middleName>
        <party>D</party>
      </item>
    </cosponsors>
    <amendments />
    <laws />
    <titles>
      <item>
        <parentTitleType />
        <title>Maternal Health Accountability Act of 2017</title>
        <titleType>(Extracted from GPO) Short Titles as Introduced</titleType>
        <chamberCode />
        <chamberName />
      </item>
      <item>
        <parentTitleType />
        <title>Maternal Health Accountability Act of 2017</title>
        <titleType>Short Titles as Introduced</titleType>
        <chamberCode />
        <chamberName />
      </item>
      <item>
        <parentTitleType />
        <title>A bill to support States in their work to save and sustain the health of mothers during pregnancy, childbirth, and in the postpartum period, to eliminate disparities in maternal health outcomes for pregnancy-related and pregnancy-associated deaths, to identify solutions to improve health care quality and health outcomes for mothers, and for other purposes.</title>
        <titleType>Official Title as Introduced</titleType>
        <chamberCode />
        <chamberName />
      </item>
      <item>
        <parentTitleType />
        <title>Maternal Health Accountability Act of 2017</title>
        <titleType>Display Title</titleType>
        <chamberCode />
        <chamberName />
      </item>
    </titles>
    <createDate>2017-05-12T00:26:39Z</createDate>
    <introducedDate>2017-05-11</introducedDate>
    <billNumber>1112</billNumber>
  </bill>
  <dublinCore xmlns:dc="http://purl.org/dc/elements/1.1/">
    <dc:format>text/xml</dc:format>
    <dc:language>EN</dc:language>
    <dc:rights>Pursuant to Title 17 Section 105 of the United States Code, this file is not subject to copyright protection and is in the public domain.</dc:rights>
    <dc:contributor>Congressional Research Service, Library of Congress</dc:contributor>
    <dc:description>This file contains bill summaries and statuses for federal legislation. A bill summary describes the most significant provisions of a piece of legislation and details the effects the legislative text may have on current law and federal programs. Bill summaries are authored by the Congressional Research Service (CRS) of the Library of Congress. As stated in Public Law 91-510 (2 USC 166 (d)(6)), one of the duties of CRS is "to prepare summaries and digests of bills and resolutions of a public general nature introduced in the Senate or House of Representatives". For more information, refer to the User Guide that accompanies this file.</dc:description>
  </dublinCore>
</billStatus>


text:
namespace mtl {	namespace vector {

template< typename Vector >
struct indexbuffer
{
    typedef typename Collection<Vector>::value_type value_type;
    typedef typename Collection<Vector>::size_type size_type;
    typedef indexbuffer self;

    indexbuffer(const Vector& v) : vec(v) {}

    inline self& operator()(const size_type p, value_type& dest)
    {
	dest = vec[p];
	return *this;
    }

    inline void update() {}
  private:
    const Vector& vec;
};

template< typename Vector >
class extracter
{
  public:
    typedef typename Collection<Vector>::value_type value_type;
    typedef typename Collection<Vector>::size_type  size_type;
    typedef indexbuffer< Vector >                   buffer_type;

    extracter(const Vector& vec):
      destroyBuffer(true), buffer(new buffer_type(vec))
    {}
    extracter(buffer_type& buf):
      destroyBuffer(false), buffer(&buf)
    {}

    struct bracket_proxy
    {
	const size_type p;
	buffer_type& buffer;
	bracket_proxy(const size_type p, buffer_type& b) : p(p), buffer(b) {}

	inline buffer_type& operator>>(value_type& dest) { return buffer(p, dest); }
    };

    inline bracket_proxy operator[](const size_type p) { return bracket_proxy(p, *buffer); }

    ~extracter() {
	buffer->update();
	if(destroyBuffer)
	    delete buffer;
    }
  private:
    const bool destroyBuffer;
    buffer_type* buffer;
};

}} //namespace mtl::vector
#endif


text:
import * as React from 'react'
import {Textarea} from '../../../components'

export interface ITextareaValueState {
  value: string
}

export default class TextareaValue extends React.Component<{}, ITextareaValueState> {

  state = {
    value: 'default'
  }

  render () {
    const {value} = this.state

    return (

{value}

        <Textarea value={value}/>

    )
  }
}


text:
package com.cisco.qte.jdtn.events;

import com.cisco.qte.jdtn.bp.Bundle;

/**
 * Event signifying that a Bundle has finished being held and must now be
 * processed.
 */
public class PostBundleHoldEvent extends BundleEvent {

	/**
	 * Bundle has finished being held and must now be
	 * processed.
	 * @param bundle Affected Bundle
	 */
	public PostBundleHoldEvent(Bundle bundle) {
		super(JDTNEvent.EventType.POST_BUNDLE_HOLD, bundle);
	}

}


text:
<?php

namespace App\UserBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use App\AdminBundle\Compiler\Annotation as Admin ;

use FOS\UserBundle\Model\GroupInterface ;
use Doctrine\Common\Collections\ArrayCollection ;

use FOS\MessageBundle\Model\ParticipantInterface;

/**
 * @ORM\Entity
 * @ORM\Table(name="app_fos_user")
 * @Admin\Entity("app_user", label="User", position=2, string="username", icon="user", dashboard=true )
 *
 * @Admin\Table("id", order=true)
 *
 * @Admin\Form("username", label="User Name", unique="用户名已经被使用了!")
 * @Admin\Table("username", order=true)
 *
 * @Admin\Form("email", label="Email", unique="地址已经被使用了!")
 * @Admin\Table("email", order=true)
 *
 * @Admin\Form("enabled")
 * @Admin\Table("enabled", order=true)
 *
 * @Admin\Form("expiresAt", label="过期日期")
 *
 * @Admin\Form("plainPassword", type="password", label="Password", auth="super")
 */
class User extends \FOS\UserBundle\Model\User implements ParticipantInterface
{
    const ROLE_USER  = 'ROLE_USER' ;
    const ROLE_MEMBER  = 'ROLE_MEMBER' ;
    const ROLE_ADMIN  = 'ROLE_ADMIN' ;

    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @var Group
     * @ORM\ManyToOne(targetEntity="Group", inversedBy="users", cascade={"persist"} )
     * @Admin\Table
     * @Admin\Form(auth=true)
     * @Admin\Filter
     */
    protected $user_group ;

    /**
     * @ORM\Column(type="string", length=18, nullable=true)
     * @Admin\Form(label="身份证")
     */
    public $id_card ;

    public $registration_term ;

    public $id_term ;

    /**
     * @ORM\OneToMany(targetEntity="UserLog", mappedBy="user", cascade={"remove"})
     * @Admin\Table()
     */
    public $logs ;

    /**
     * @ORM\Column(type="string", length=12, nullable=true)
     * @Admin\Form(label="真实姓名")
     */
    public $real_name ;

    /**
     * @ORM\Column(type="integer")
     * @Admin\Form(label="性别", type="choice",  choices={"1":"男", "0":"女" } )
     */
    public $gender = 1 ;

    /**
     * @ORM\OneToOne(targetEntity="App\AdminBundle\Entity\File")
     * @Admin\Form(label="头像", type="image", max_size="1m", image_size="128x128", small_size="24x24" )
     */
    public $avatar ;

    /**
     * @ORM\Column(type="string", length=12, nullable=true)
     * @Admin\Form(label="座机")
     */
    public $phone_number ;

    /**
     * @ORM\Column(type="string", length=12, nullable=true)
     * @Admin\Form(label="手机")
     */
    public $mobile_phone_number ;

    /**
     * @var datetime $created
     *
     * @Gedmo\Timestampable(on="create")
     * @ORM\Column(type="datetime")
     */
    private $created;

    /**
     * @var string
     */
    public $old_password;

    public function __construct() {
        parent::__construct();
        $this->enabled = true ;
        $this->created = new \DateTime('now') ;
    }

    /**
     * @return \DateTime
     */
    public function getCreated()
    {
        return $this->created;
    }

    public function getId(){
        return $this->id ;
    }

    /**
     * @return Group
     */
    public function getUserGroup() {
        return $this->user_group ;
    }

    public function setUserGroup(Group $group ) {
         $this->user_group = $group ;
    }

    /**
     * Returns the user roles
     *
     * @return array The roles
     */
    public function getRoles()
    {
        $roles = $this->roles;

        if( $this->user_group ) {
            $roles = array_merge($roles, $this->user_group->getRoles());
        }

        // we need to make sure to have at least one role
        $roles[] = static::ROLE_DEFAULT ;
        return array_unique($roles);
    }

    public function isEqual($user){
        if( $user && $user instanceof User ) {
            if( $this->id ) {
                return $this->id === $user->getId() ;
            }
            return $user === $this ;
        }
    }

    public function __toString() {
        return $this->username ;
    }

    public function getExpiresAt(){
        return $this->expiresAt ;
    }

    public function getCredentialsExpireAt(){
        return $this->credentialsExpireAt ;
    }
}


text:
require_relative 'hash'

describe Hash do

end


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\UserProfile;
use bs\Flatpickr\FlatpickrWidget;
use vova07\fileapi\Widget as FileApi;

/* @var $this yii\web\View */
/* @var $model common\models\UserProfile */
/* @var $form yii\widgets\ActiveForm */

$this->title = Yii::t('frontend', 'Settings');
$this->params['breadcrumbs'][] = $this->title;
?>

<?= Html::encode($this->title) ?>

        <?= Html::a(Yii::t('frontend', 'Change password'), ['password'], ['class' => 'btn btn-success']) ?>

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'firstname')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'lastname')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'birthday')->widget(FlatpickrWidget::class, [
        'locale' => strtolower(substr(Yii::$app->language, 0, 2)),
        'groupBtnShow' => true,
        'options' => [
            'class' => 'form-control',
        ],
        'clientOptions' => [
            'allowInput' => true,
            'defaultDate' => $model->birthday ? date(DATE_ATOM, $model->birthday) : null,
        ],
    ]) ?>

    <?= $form->field($model, 'avatar_path')->widget(FileApi::class, [
        'settings' => [
            'url' => ['/site/fileapi-upload'],
        ],
        'crop' => true,
        'cropResizeWidth' => 100,
        'cropResizeHeight' => 100,
    ]) ?>

    <?= $form->field($model, 'gender')->dropDownlist([
        UserProfile::GENDER_MALE => Yii::t('frontend', 'Male'),
        UserProfile::GENDER_FEMALE => Yii::t('frontend', 'Female'),
    ], ['prompt' => '']) ?>

    <?= $form->field($model, 'website')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'other')->textarea(['rows' => 6]) ?>

        <?= Html::submitButton(Yii::t('frontend', 'Update'), ['class' => 'btn btn-primary']) ?>

    <?php ActiveForm::end() ?>