Commit Graph

12 Commits

Author SHA1 Message Date
Anthony Latsis
daaac531cb Gardening: Migrate test suite to GH issues: SILGen (1/2) 2022-09-04 07:02:59 +03:00
Allan Shortlidge
c13dd18ef8 Sema: Diagnose the availability of global actor attributes. This includes SPI and resilience diagnostics. 2022-08-20 17:57:25 -07:00
Max Ovtsin
b8b8a20dfe [SILGen] Emit unreachable in emitProlog() for uninhabited arguments after other codegen 2022-07-21 11:01:01 +01:00
Robert Widmann
4802c318f8 Add Tests for Parameters with Uninhabited Product Types 2021-09-27 20:17:33 -07:00
Robert Widmann
5bbd126179 Redo The Notes For "Uninhabited" Parameter Types
The use of the term 'uninhabited' does not make sense outside of formal type theoretic contexts. In Swift, we also do not use this term in a standard way - hence the term "structurally uninhabited" since we only consider products and sums eligible for the check. (Aside: We do not do exponentials because... well, Swift's type system implements Harper's "typerec" operator and as a consequence parametricity is just _not a thing_). I digress...

So, improve upon the old diagnostic in two ways:
1) Do away with 'uninhabited' - instead, mention that it's either an enum or a tuple with an enum in it that 'has no cases'
2) Since the SIL parameter convention flattens all tuples, point directly at the offending uninhabited element type

rdar://83600669
2021-09-27 20:17:28 -07:00
Suyash Srijan
6ef4b0db4b [SILGen] Emit unreachable code diagnostic for single expression closures with implicit returns too (#33604)
* [SILGen] Emit unreachable code diagnostics for single expression closures with implicit returns too

* [Test] Update diagnostic in test/SILGen/functions_uninhabited_param.swift
2020-09-21 21:58:14 +01:00
Slava Pestov
1401cbaf2b SILGen: Fudge emitProlog() to emit unreachable later
For some reason, doing it in the other order causes a crash.
I suspect this is because we create new instructions below,
but if there's no insertion point, the instruction is never
added to a basic block.
2019-12-13 15:39:47 -05:00
Michael Gottesman
f854547c55 [ownership] Enable ownership verification by default.
I also removed the -verify-sil-ownership flag in favor of a disable flag
-disable-sil-ownership-verifier. I used this on only two tests that still need
work to get them to pass with ownership, but whose problems are well understood,
small corner cases. I am going to fix them in follow on commits. I detail them
below:

1. SILOptimizer/definite_init_inout_super_init.swift. This is a test case where
DI is supposed to error. The only problem is that we crash before we error since
the code emitting by SILGen to trigger this error does not pass ownership
invariants. I have spoken with JoeG about this and he suggested that I fix this
earlier in the compiler. Since we do not run the ownership verifier without
asserts enabled, this should not affect compiler users. Given that it has
triggered DI errors previously I think it is safe to disable ownership here.

2. PrintAsObjC/extensions.swift. In this case, the signature generated by type
lowering for one of the thunks here uses an unsafe +0 return value instead of
doing an autorelease return. The ownership checker rightly flags this leak. This
is going to require either an AST level change or a change to TypeLowering. I
think it is safe to turn this off since it is such a corner case that it was
found by a test that has nothing to do with it.

rdar://43398898
2019-03-25 00:11:52 -07:00
Michael Gottesman
0dfaa19f9f [ownership] Rename enable-sil-ownership => verify-sil-ownership.
I have been meaning to do this change for a minute, but kept on putting it off.
This describes what is actually happening and is a better name for the option.
2019-03-18 01:31:44 -07:00
Suyash Srijan
4f39e3b588 [silgen] [ast] adds param name to diagnostics 2018-11-26 18:32:06 +00:00
Suyash Srijan
e8d3caaac0 [test] update expected-note in test 2018-11-19 22:59:57 +00:00
Suyash Srijan
4b4bb4ce19 [test] move test file to SILGen/ 2018-11-18 20:08:19 +00:00