Open swift-ci opened 7 years ago
Interesting! I think the best way to do this would be to check for various executable formats' "magic numbers" at the start of a source buffer. "\xCA\xFE\xBA\xBE"
and "\x7fELF"
would handle both Mach-O and ELF executables (Darwin and Linux/BSD).
Resetting assignee on all Starter Bugs not modified since 2018.
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Improvement, Parser, StarterBug | |Assignee | None | |Priority | Medium | md5: 111feeb80ab569e4bee27d9d511be231Issue Description:
I was talking to a new Swift programmer who came from the ruby/python world. He had this output:
Because he had started with Swift scripts, where you put
swift
in front of thefile.swift
name.The error message above is perfectly valid, but unhelpful in this case. I would guess enough new programmers would make this mistake that it's worth discussing a special-case error message if the file to be run is already a Swift executable.