fmt: keep module alias in interfaces (#9985)

pull/9987/head
Lukas Neubert 2021-05-03 14:07:12 +02:00 committed by GitHub
parent 597a774d36
commit 5b826b2663
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -1191,9 +1191,6 @@ pub fn (mut f Fmt) interface_decl(node ast.InterfaceDecl) {
}
// TODO: alignment, comments, etc.
mut ft := f.no_cur_mod(f.table.type_to_str_using_aliases(field.typ, f.mod2alias))
if !ft.contains('C.') && !ft.contains('JS.') && !ft.contains('fn (') {
ft = f.short_module(ft)
}
f.writeln('\t$field.name $ft')
f.mark_types_import_as_used(field.typ)
}

View File

@ -1,5 +1,14 @@
import time
import semver as sv
import term.ui as tui
interface Inter {
code tui.KeyCode
}
struct TuiStruct {
code tui.KeyCode
}
fn foo(f time.Time) time.Time {
f2 := time.Time{}