ns am acquiring a "Type the expression is pass out without an ext context " top top this part of password from a task I to be trying to upgrade to recent Swift version. Ns can"t it seems to be ~ to number it out. Ns tried different things but can"t obtain it to work.

You are watching: Type of expression is ambiguous without more context

The difficulty is ~ above the syntax that this heat

let imageToDeleteParameters = imagesToDelete.map <"id": $0.id, "url": $0.url.absoluteString, "_destroy": true> Full code:

extension TutorialCreationRequest: WebserviceParametrable func toParameters() -> let imageParameters = images.map <"url": $0> allow imageToDeleteParameters = imagesToDelete.map <"id": $0.id, "url": $0.url.absoluteString, "_destroy": true> return < "title": title, "is_draft": isDraft, "difficulty": difficulty, "duration": duration, "cost": cost, "user_id": userId, "description": description, "to_sell": toSell, "images": .flatMap $0 >
swift swift3
re-superstructure
monitor
edited Nov 30 "16 in ~ 17:32

*

rmaddy
304k4040 yellow badges493493 silver badges533533 bronze title
asked Nov 30 "16 at 17:28
*

Florian VIDALFlorian VIDAL
1,22122 yellow badges77 silver badges66 bronze badges
add a comment |

16 answer 16


active oldest Votes
91
This happens when you have a function with wrong dispute names.

Example:

functionWithArguments(argumentNameWrong: , argumentName2: )and You declared your role as:

functionWithArguments(argumentName1: , argumentName2: )This commonly happens when you adjusted the surname of a Variable. Make certain you refactor as soon as you perform that.


re-publishing
follow
reply Jun 30 "18 at 8:42
*

Daniel BastidasDaniel Bastidas
1,53588 silver badges1515 bronze title
6
| display 1 more comment
53
This can happen if any part of her highlighted method or residential property is attempting to access a residential or commercial property or method with the untrue type.

Here is a troubleshooting checklist, make sure:

the kind of debates match in the speak to site and also implementation.the dispute names complement in the speak to site and also implementation.the technique name matches in the call site and implementation.the reverted value that a home or an approach matches in the usage and implementation (ie: enumerated())you don"t have a duplicated an approach with potentially ambiguous types such just like protocols or generics.the compiler deserve to infer the correct type when using type inference.

A Strategy

Try break apart your method into a greater variety of simpler method/implementations.

For example, lets say you space running compactMap on selection of custom Types. In the closure you room passing to the compactMap method, friend initialize and also return another custom struct. As soon as you get this error, that is daunting to call which part of your password is offending.

For debugging purposes, you deserve to use a for in loop instead of compactMap.instead of happen the arguments, directly, you have the right to assign them come constants in the for loop.

See more: The Bizarre Backstory Of The “Can You Feel It” Amazon Commercial Song 2018

By this point, girlfriend may concerned a realization, such as, rather of the building you assumed you want to entrust actually had a residential property on that that had the actual worth you want to pass.