but it really seems to work on entities?
Yes, substitution are used for both keywords and type entities.
And substitution array has elements which is mixed with these two kinds.
a reference to that would be "A"?
Yes.
This code generates AA.
// carlo.swift
public struct StructTest<T> {
public var x: T
public func Fred(carlo a: Int, _ b: StructTest<T>) {}
}
// StructTest.Fred(carlo:_:)
sil @$s5carlo10StructTestV4FredAA_ySi_ACyxGtF
if the module name was "HelloWorld", it would still be A?
In module HelloWorld, AA represents HelloWorld.
So, this code which is only differ on filename does not generates AA.
// HelloWorld.swift
public struct StructTest<T> {
public var x: T
public func Fred(carlo a: Int, _ b: StructTest<T>) {}
}
// StructTest.Fred(carlo:_:)
sil @$s2hw10StructTestV4Fred5carlo_ySi_ACyxGtF
and in this case, StructTest would be B? What I don't get is why C then refers to StructTest again?
StructTest for AB is keyword.
it used at keyword position such like parameter labels.
StructTest for AC is type entity.
it used at type position such like parameter types.
when to use lowercase letters for substitution.
Continuous substitution uses lowercase letters to compress them.
For example, AA + AB is compressed into AaB.
Here is example:
public struct StructTest<T> {
public var x: T
public func Fred(carlo a: Int, StructTest b: StructTest<T>) {}
}
// StructTest.Fred(carlo:StructTest:)
sil @$s5carlo10StructTestV4FredAaBySi_ACyxGtF