tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(25,5): error TS2322: Type '`aA${string}`' is not assignable to type '"aA"'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(26,5): error TS2322: Type '`AA${Uppercase<string>}`' is not assignable to type '"AA"'.
  Type '`AA${string}`' is not assignable to type '"AA"'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(27,5): error TS2322: Type '`aa${Lowercase<string>}`' is not assignable to type '"aa"'.
  Type '`aa${string}`' is not assignable to type '"aa"'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(30,5): error TS2322: Type '`AA${Uppercase<string>}`' is not assignable to type '`aA${string}`'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(31,5): error TS2322: Type '`aa${Lowercase<string>}`' is not assignable to type '`aA${string}`'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(33,5): error TS2322: Type '`aA${string}`' is not assignable to type '`AA${Uppercase<string>}`'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(34,5): error TS2322: Type '`aa${Lowercase<string>}`' is not assignable to type '`AA${Uppercase<string>}`'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(36,5): error TS2322: Type '`aA${string}`' is not assignable to type '`aa${Lowercase<string>}`'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(37,5): error TS2322: Type '`AA${Uppercase<string>}`' is not assignable to type '`aa${Lowercase<string>}`'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(51,5): error TS2322: Type 'string' is not assignable to type 'Uppercase<string>'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(52,5): error TS2322: Type 'Lowercase<string>' is not assignable to type 'Uppercase<string>'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(53,5): error TS2322: Type 'string' is not assignable to type 'Lowercase<string>'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(54,5): error TS2322: Type 'Uppercase<string>' is not assignable to type 'Lowercase<string>'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(56,5): error TS2322: Type 'string' is not assignable to type 'Uppercase<string>'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(57,5): error TS2322: Type 'string' is not assignable to type 'Lowercase<string>'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(78,5): error TS2322: Type 'Uppercase<string>' is not assignable to type 'Uppercase<Lowercase<string>>'.
  Type 'string' is not assignable to type 'Lowercase<string>'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(79,5): error TS2322: Type 'Uppercase<string>' is not assignable to type 'Uppercase<Lowercase<string>>'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(83,5): error TS2322: Type 'Lowercase<Uppercase<string>>' is not assignable to type 'Uppercase<string>'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(84,5): error TS2322: Type 'Lowercase<Uppercase<string>>' is not assignable to type 'Uppercase<string>'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(85,5): error TS2322: Type 'Lowercase<Uppercase<string>>' is not assignable to type 'Uppercase<Lowercase<string>>'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(87,5): error TS2322: Type 'Uppercase<string>' is not assignable to type 'Lowercase<Uppercase<string>>'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(88,5): error TS2322: Type 'Uppercase<string>' is not assignable to type 'Lowercase<Uppercase<string>>'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(89,5): error TS2322: Type 'Uppercase<Lowercase<string>>' is not assignable to type 'Lowercase<Uppercase<string>>'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(129,5): error TS2322: Type 'Capitalize<string>' is not assignable to type '`A${string}`'.
  Type 'string' is not assignable to type '`A${string}`'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(130,5): error TS2322: Type 'Capitalize<string>' is not assignable to type '`A${string}`'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(131,5): error TS2322: Type 'Capitalize<string>' is not assignable to type '`A${string}`'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(147,5): error TS2322: Type 'Uncapitalize<string>' is not assignable to type '`a${string}`'.
  Type 'string' is not assignable to type '`a${string}`'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(148,5): error TS2322: Type 'Uncapitalize<string>' is not assignable to type '`a${string}`'.
tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts(149,5): error TS2322: Type 'Uncapitalize<string>' is not assignable to type '`a${string}`'.


==== tests/cases/conformance/types/literal/stringMappingOverPatternLiterals.ts (29 errors) ====
    // non-template
    type A = "aA";
    type B = Uppercase<A>;
    type C = Lowercase<A>;
    
    // templated
    type ATemplate = `aA${string}`;
    type BTemplate = Uppercase<ATemplate>;
    type CTemplate = Lowercase<ATemplate>;
    
    function f1(
        a: A,
        b: B,
        c: C,
        a_template: ATemplate,
        b_template: BTemplate,
        c_template: CTemplate
    ) {
        // non-template versions should be assignable to templated versions (empty string matches string)
        a_template = a;
        b_template = b;
        c_template = c;
    
        // not the other way around
        a = a_template;
        ~
!!! error TS2322: Type '`aA${string}`' is not assignable to type '"aA"'.
        b = b_template;
        ~
!!! error TS2322: Type '`AA${Uppercase<string>}`' is not assignable to type '"AA"'.
!!! error TS2322:   Type '`AA${string}`' is not assignable to type '"AA"'.
        c = c_template;
        ~
!!! error TS2322: Type '`aa${Lowercase<string>}`' is not assignable to type '"aa"'.
!!! error TS2322:   Type '`aa${string}`' is not assignable to type '"aa"'.
    
        // Additionally, all the template versions should be mutually incompatible (they describe differing sets)
        a_template = b_template;
        ~~~~~~~~~~
!!! error TS2322: Type '`AA${Uppercase<string>}`' is not assignable to type '`aA${string}`'.
        a_template = c_template;
        ~~~~~~~~~~
!!! error TS2322: Type '`aa${Lowercase<string>}`' is not assignable to type '`aA${string}`'.
    
        b_template = a_template;
        ~~~~~~~~~~
!!! error TS2322: Type '`aA${string}`' is not assignable to type '`AA${Uppercase<string>}`'.
        b_template = c_template;
        ~~~~~~~~~~
!!! error TS2322: Type '`aa${Lowercase<string>}`' is not assignable to type '`AA${Uppercase<string>}`'.
    
        c_template = a_template;
        ~~~~~~~~~~
!!! error TS2322: Type '`aA${string}`' is not assignable to type '`aa${Lowercase<string>}`'.
        c_template = b_template;
        ~~~~~~~~~~
!!! error TS2322: Type '`AA${Uppercase<string>}`' is not assignable to type '`aa${Lowercase<string>}`'.
    }
    
    // Raw string mapping assignability
    
    function f2(x1: string, x2: Uppercase<string>, x3: Lowercase<string>) {
        // ok
        x1 = x2;
        x1 = x3;
    
        x2 = "ABC";
        x3 = "abc";
    
        // should fail (sets do not match)
        x2 = x1;
        ~~
!!! error TS2322: Type 'string' is not assignable to type 'Uppercase<string>'.
        x2 = x3;
        ~~
!!! error TS2322: Type 'Lowercase<string>' is not assignable to type 'Uppercase<string>'.
        x3 = x1;
        ~~
!!! error TS2322: Type 'string' is not assignable to type 'Lowercase<string>'.
        x3 = x2;
        ~~
!!! error TS2322: Type 'Uppercase<string>' is not assignable to type 'Lowercase<string>'.
    
        x2 = "AbC";
        ~~
!!! error TS2322: Type 'string' is not assignable to type 'Uppercase<string>'.
        x3 = "AbC";
        ~~
!!! error TS2322: Type 'string' is not assignable to type 'Lowercase<string>'.
    }
    
    // Mappings over mappings
    
    function f3(
        x1: Uppercase<string>,
        x2: Uppercase<Uppercase<string>>,
        x3: Uppercase<Lowercase<string>>) {
    
        // _ideally_ these would all be equivalent
        x1 = x2;
        x1 = x3;
    
        x2 = x1;
        x2 = x3;
    
        // you'd think these were equivalent - the outer `Uppercase` conceptually
        // makes the inner `Lowercase` effectively a noop - but that's not so;
        // the german sharp s makes that not completely true (lowercases to ss,
        // which then uppercases to SS), so arbitrary nestings of mappings make differing sets!
        x3 = x1;
        ~~
!!! error TS2322: Type 'Uppercase<string>' is not assignable to type 'Uppercase<Lowercase<string>>'.
!!! error TS2322:   Type 'string' is not assignable to type 'Lowercase<string>'.
        x3 = x2;
        ~~
!!! error TS2322: Type 'Uppercase<string>' is not assignable to type 'Uppercase<Lowercase<string>>'.
    
        // and this should also not be equivlent to any others
        var x4: Lowercase<Uppercase<string>> = null as any;
        x1 = x4;
        ~~
!!! error TS2322: Type 'Lowercase<Uppercase<string>>' is not assignable to type 'Uppercase<string>'.
        x2 = x4;
        ~~
!!! error TS2322: Type 'Lowercase<Uppercase<string>>' is not assignable to type 'Uppercase<string>'.
        x3 = x4;
        ~~
!!! error TS2322: Type 'Lowercase<Uppercase<string>>' is not assignable to type 'Uppercase<Lowercase<string>>'.
    
        x4 = x1;
        ~~
!!! error TS2322: Type 'Uppercase<string>' is not assignable to type 'Lowercase<Uppercase<string>>'.
        x4 = x2;
        ~~
!!! error TS2322: Type 'Uppercase<string>' is not assignable to type 'Lowercase<Uppercase<string>>'.
        x4 = x3;
        ~~
!!! error TS2322: Type 'Uppercase<Lowercase<string>>' is not assignable to type 'Lowercase<Uppercase<string>>'.
    }
    
    // string mapping over non-string pattern literals is preserved
    
    type NonStringPat = Uppercase<`aA${number}${bigint}${boolean}`>;
    type EquivalentNonStringPat = `AA${Uppercase<`${number}`>}${Uppercase<`${bigint}`>}${Uppercase<`${boolean}`>}`;
    
    function f4(x1: NonStringPat, x2: EquivalentNonStringPat) {
        // Should both work
        x1 = x2;
        x2 = x1;
    }
    
    // Capitalize and uncapitalize on template literals
    
    function f5(
        cap_tem: `A${string}`,
        cap_str: Capitalize<string>,
        cap_tem_map: Capitalize<`A${string}`>,
        cap_tem_map2: Capitalize<`a${string}`>,
        uncap_tem: `a${string}`,
        uncap_str: Uncapitalize<string>,
        uncap_tem_map: Uncapitalize<`A${string}`>,
        uncap_tem_map2: Uncapitalize<`a${string}`>,
    ) {
        // All these are capitalized
        cap_str = cap_tem;
        cap_str = cap_tem_map;
        cap_str = cap_tem_map2;
    
        // these are all equivalent
        cap_tem = cap_tem_map;
        cap_tem = cap_tem_map2;
        cap_tem_map = cap_tem_map2;
        cap_tem_map = cap_tem;
        cap_tem_map2 = cap_tem_map;
        cap_tem_map2 = cap_tem;
    
        // meanwhile, these all require a `A` prefix
        cap_tem = cap_str;
        ~~~~~~~
!!! error TS2322: Type 'Capitalize<string>' is not assignable to type '`A${string}`'.
!!! error TS2322:   Type 'string' is not assignable to type '`A${string}`'.
        cap_tem_map = cap_str;
        ~~~~~~~~~~~
!!! error TS2322: Type 'Capitalize<string>' is not assignable to type '`A${string}`'.
        cap_tem_map2 = cap_str;
        ~~~~~~~~~~~~
!!! error TS2322: Type 'Capitalize<string>' is not assignable to type '`A${string}`'.
    
        // All these are uncapitalized
        uncap_str = uncap_tem;
        uncap_str = uncap_tem_map;
        uncap_str = uncap_tem_map2;
    
        // these are all equivalent
        uncap_tem = uncap_tem_map;
        uncap_tem = uncap_tem_map2;
        uncap_tem_map = uncap_tem_map2;
        uncap_tem_map = uncap_tem;
        uncap_tem_map2 = uncap_tem_map;
        uncap_tem_map2 = uncap_tem;
    
        // meanwhile, these all require a `a` prefix
        uncap_tem = uncap_str;
        ~~~~~~~~~
!!! error TS2322: Type 'Uncapitalize<string>' is not assignable to type '`a${string}`'.
!!! error TS2322:   Type 'string' is not assignable to type '`a${string}`'.
        uncap_tem_map = uncap_str;
        ~~~~~~~~~~~~~
!!! error TS2322: Type 'Uncapitalize<string>' is not assignable to type '`a${string}`'.
        uncap_tem_map2 = uncap_str;
        ~~~~~~~~~~~~~~
!!! error TS2322: Type 'Uncapitalize<string>' is not assignable to type '`a${string}`'.
    }