Commit Graph

5 Commits

Author SHA1 Message Date
Erik Eckstein
833560f08f SIL: fix printing of dependent existential archetypes
We were missing parentheses:
```
  $@opened("...", any P2) Self.A
```
->
```
  $(@opened("...", any P2) Self).A
```
2025-08-25 19:38:26 +02:00
Erik Eckstein
7cceaff5f3 SIL: don't print operand types in textual SIL
Type annotations for instruction operands are omitted, e.g.

```
  %3 = struct $S(%1, %2)
```

Operand types are redundant anyway and were only used for sanity checking in the SIL parser.

But: operand types _are_ printed if the definition of the operand value was not printed yet.
This happens:

* if the block with the definition appears after the block where the operand's instruction is located

* if a block or instruction is printed in isolation, e.g. in a debugger

The old behavior can be restored with `-Xllvm -sil-print-types`.
This option is added to many existing test files which check for operand types in their check-lines.
2024-11-21 18:49:52 +01:00
Holly Borla
8713d78704 [PrintOptions] Print explicit 'any' in SIL. 2022-08-18 01:15:12 -04:00
Slava Pestov
d222ac5f6e Sema: New syntax for @opened archetypes in textual SIL
The old syntax was

    @opened("UUID") constraintType

Where constraintType was the right hand side of a conformance requirement.

This would always create an archetype where the interface type was `Self`,
so it couldn't cope with member types of opened existential types.

Member types of opened existential types is now a thing with SE-0309, so
this lack of support prevented writing SIL test cases using this feature.

The new syntax is

    @opened("UUID", constraintType) interfaceType

The interfaceType is a type parameter rooted in an implicit `Self`
generic parameter, which is understood to be the underlying type of the
existential.

Fixes rdar://problem/93771238.
2022-08-07 19:03:46 -04:00
Anthony Latsis
21500abe25 AST: Never query the map with non-root archetypes in QueryTypeSubstitutionMapOrIdentity
This makes `SILCloner::getASTTypeInClonedContext` and `getTypeInClonedContext`,
which use `QueryTypeSubstitutionMapOrIdentity`, work for nested opened archetypes
and consequently fixes inlining of instructions involving these archetypes.
2022-05-02 14:13:55 +03:00