0

This is not a code-level question, per se, but a question about false code error messages. I would have posted on Apple's developer forums, but the registration page is currently broken.

I'm using Xcode 9.3 on macOS 10.13.4 on a Mac Mini with 16 GB of RAM. I frequently get false code error messages even when my code is fine. The false errors are usually Expected expression, Expected ']' and similar. Please see the examples below:

An example of a false error:

False error message

Now I retype the same line exactly, and the false error goes away:

Retyped the same line

Another example:

Another false error message

As you can see, as soon as I retype the same exact code below the 'offending' line, that new line of code doesn't show an error. As seen in the examples, I have enabled the display of 'invisible' characters to see if maybe some unprintable character was causing a problem, but I don't see anything like that.

Something fishy is going on here. Am I missing something or is this a bug I need to report?

2
  • 2
    I looked at the FAQ and this appears to be 'on topic'. I was not asking for code help, I was asking for help with improper app behavior.
    – Will B
    May 10, 2018 at 23:16
  • 1
    this question is not off-topic, this is an IDE related issue not a software development question Jun 28, 2018 at 23:39

1 Answer 1

2

Even though you can't see any weird characters on the screenshots (or in person) where the error is, there's actually a 'DLE' control code at the end of the line (see image):

DLE control character

I copied the suspect text to another text editor where I discovered the control character. I do not know how this character got there as I've been typing code and not copy/pasting from the web or other sources.

Deleting the semicolon and everything after it all the way to the new line fixed the problem. This and other invisible control characters really should be visible when 'view invisibles' are turned on.

4
  • i have the same problem, did you find root cause of this issue? Jun 28, 2018 at 23:36
  • Alper, the information I've discovered says that Apple is aware of the issue, but I have no idea if they've fixed it, or if they plan on fixing it.
    – Will B
    Jun 29, 2018 at 5:48
  • What was the text editor you used to discover the invisible characters?
    – anotherDev
    Jul 24, 2019 at 5:21
  • 1
    @HarshKanchina I was using Geany to display that. I enabled 'Show Invisible Characters' or something similar. I don't seem to see that on the latest version, though.
    – Will B
    Jul 24, 2019 at 15:56

Not the answer you're looking for? Browse other questions tagged .