Skip to content

Commit f93838f

Browse files
committed
Log slow type-checkers.
1 parent 136b832 commit f93838f

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

App/InjectionNext/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleShortVersionString</key>
2020
<string>$(MARKETING_VERSION)</string>
2121
<key>CFBundleVersion</key>
22-
<string>10838</string>
22+
<string>10852</string>
2323
<key>LSApplicationCategoryType</key>
2424
<string>public.app-category.developer-tools</string>
2525
<key>LSMinimumSystemVersion</key>

App/InjectionNext/NextCompiler.swift

+13-7
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ class NextCompiler {
176176
let baseOptionsToAdd = ["-o", object, "-DDEBUG", "-DINJECTING"]
177177
let languageSpecific = (isSwift ?
178178
["-c", "-filelist", filesfile, "-primary-file", source,
179+
"-warn-long-expression-type-checking=150",
179180
"-external-plugin-path",
180181
platformUsr+"lib/swift/host/plugins#" +
181182
platformUsr+"bin/swift-plugin-server",
@@ -189,13 +190,18 @@ class NextCompiler {
189190
// Call compiler process
190191
if let errors = Popen.task(exec: compiler,
191192
arguments: stored.arguments + languageSpecific,
192-
cd: stored.workingDir, errors: nil), // Always returns stdout
193-
errors.contains(" error: ") {
194-
print(([compiler] + stored.arguments +
195-
languageSpecific).joined(separator: " "))
196-
_ = error("Recompile failed for: \(source)\n"+errors)
197-
lastError = errors
198-
return nil
193+
cd: stored.workingDir, errors: nil) { // Always returns stdout
194+
if errors.contains(" error: ") {
195+
print(([compiler] + stored.arguments +
196+
languageSpecific).joined(separator: " "))
197+
_ = error("Recompile failed for: \(source)\n"+errors)
198+
lastError = errors
199+
return nil
200+
}
201+
for slow: String in errors[
202+
#"(?<=/)\w+\.swift:\d+:\d+: warning: expression took \d+ms to type-check.*"#] {
203+
log(slow)
204+
}
199205
}
200206

201207
return object

0 commit comments

Comments
 (0)