I keep getting error: standard library error: _MaxBuiltinFloatType is not properly defined

So, I'm unable to run lit tests properly for some reason.

If I try to run lit, I get loads of errors about UNRESOLVED tests...

/Users/carlpeto/avr-swift/llvm-project/llvm/utils/lit/lit.py /Users/carlpeto/avr-swift/build/Ninja-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64

gives

lit.py: /Users/carlpeto/avr-swift/swift/test/lit.cfg:244: note: using swift: /Users/carlpeto/avr-swift/build/Ninja-DebugAssert/swift-macosx-x86_64/bin/swift
lit.py: /Users/carlpeto/avr-swift/swift/test/lit.cfg:244: note: using swiftc: /Users/carlpeto/avr-swift/build/Ninja-DebugAssert/swift-macosx-x86_64/bin/swiftc
lit.py: /Users/carlpeto/avr-swift/swift/test/lit.cfg:247: warning: couldn't find 'sil-opt' program, try setting SIL_OPT in your environment
...snip...
lit.py: /Users/carlpeto/avr-swift/llvm-project/llvm/utils/lit/lit/discovery.py:210: warning: test suite 'Swift-Unit' contained no tests
-- Testing: 4809 tests, 8 threads --
UNRESOLVED: Swift(macosx-x86_64) :: APINotes/broken-swift-name.swift (1 of 4809)
UNRESOLVED: Swift(macosx-x86_64) :: APINotes/basic.swift (2 of 4809)
UNRESOLVED: Swift(macosx-x86_64) :: APINotes/obsoleted.swift (3 of 4809)
UNRESOLVED: Swift(macosx-x86_64) :: APINotes/blocks.swift (4 of 4809)
UNRESOLVED: Swift(macosx-x86_64) :: APINotes/properties.swift (5 of 4809)
UNRESOLVED: Swift(macosx-x86_64) :: APINotes/irgen-prop-getter-setter.swift (6 of 4809)
UNSUPPORTED: Swift(macosx-x86_64) :: AutolinkExtract/empty_archive.swift (7 of 4809)
UNSUPPORTED: Swift(macosx-x86_64) :: AutolinkExtract/empty.swift (8 of 4809)
UNSUPPORTED: Swift(macosx-x86_64) :: AutolinkExtract/error_no_inputs.swift (9 of 4809)
Exception in thread Thread-3:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 408, in _handle_results
    cache[job]._set(i, obj)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 577, in _set
    self._callback(self._value)
  File "/Users/carlpeto/avr-swift/llvm-project/llvm/utils/lit/lit/run.py", line 179, in consume_test_result
    self.display.update(test_with_result)
  File "/Users/carlpeto/avr-swift/llvm-project/llvm/utils/lit/lit/main.py", line 98, in update
    sys.stdout.flush()

So in order to get around this, I ran what I thought would be equivalent commands to what llvm-lit would run...

swift-macosx-x86_64/bin/swiftc -typecheck -emit-module -parse-stdlib -module-name Swift stdlib.swift

produces

/Users/carlpeto/avr-swift/swift/test/NameBinding/stdlib.swift:11:31: error: standard library error: _MaxBuiltinFloatType is not properly defined
  var _maxLoadFactorInverse = 1.0 // expected-error{{standard library error: _MaxBuiltinFloatType is not properly defined}}
                              ^

as expected, and it's the same error if I add -target avr-atmel-linux-gnueabihf.

Also if I use the installed "system" swift compiler from Xcode (version 5.1.3)...

/usr/bin/swiftc -typecheck -emit-module -parse-stdlib -module-name Swift stdlib.swift

the same error.

But here's the crazy thing...

If I change the test script like this...

// RUN: %target-typecheck-verify-swift -parse-stdlib -module-name Swift
  
enum Optional<T> {
  case none
  case some(T)
}

// <rdar://problem/15593704>
struct X {
  // This is in parse-stdlib mode with no default literal type.
  var _maxLoadFactorInverse = 1.0 // expected-error{{standard library error: _MaxBuiltinFloatType is not properly defined}}
}

typealias _MaxBuiltinFloatType = Builtin.FPIEEE64

protocol _ExpressibleByBuiltinFloatLiteral {
  static func _convertFromBuiltinFloatLiteral(
                value: _MaxBuiltinFloatType) -> Self
}

protocol ExpressibleByFloatLiteral {
  associatedtype FloatLiteralType : _ExpressibleByBuiltinFloatLiteral
  static func convertFromFloatLiteral(value: FloatLiteralType) -> Self
}

Then I still get the same error...

stdlib.swift:11:31: error: standard library error: _MaxBuiltinFloatType is not properly defined
  var _maxLoadFactorInverse = 1.0 // expected-error{{standard library error: _MaxBuiltinFloatType is not properly defined}}
                              ^

So I'm a bit confused what's going on. This is now using swiftc from a standard version of Xcode and I would not expect to see this error any more?